Skip to content

Commit 0c2a585

Browse files
committed
Publish 2025-08-01
1 parent a3ce9f7 commit 0c2a585

File tree

1 file changed

+54
-20
lines changed

1 file changed

+54
-20
lines changed

elements/pay-tiers.js

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,18 @@ function currencyButton(currency, flagCls) {
100100
}
101101

102102
const today = new Date();
103-
const usDate = today.toLocaleDateString('en-US', { month: 'long', day: 'numeric' });
104-
const deDate = today.toLocaleDateString('de', { month: 'long', day: 'numeric' });
105-
const frDate = today.toLocaleDateString('fr', { month: 'long', day: 'numeric' });
103+
/** @type {(locale: string) => string} */
104+
const formatDate = (locale) => today.toLocaleDateString(locale, { month: 'long', day: 'numeric' });
106105

107-
108-
const takeCareMsg = [
109-
`Today is <strong>${usDate}</strong>, and we're kindly asking you to complete the payment to keep Dark Reader going.`,
106+
const takeCareMsgEnUS = [
107+
`Today is <strong>${formatDate('en-US')}</strong>, and we're kindly asking you to complete the payment to keep Dark Reader going.`,
110108
`For <strong>over 10 years</strong>, Dark Reader has helped millions of people with migraines, photophobia, and light sensitivity.`,
111109
`Please <strong>make a payment now</strong> or soon after trying the app.`,
112110
`Take part in spreading dark mode across the internet and help making the web easier on everyone's eyes.`,
113111
].join(' ');
114112

115113
const locales = {
116-
cn: {
114+
'zh-CN': {
117115
heading: '支付 Dark Reader 使用费',
118116
heading_short: '使用费',
119117
regular: '个人使用',
@@ -136,7 +134,7 @@ const locales = {
136134
price_per_user: 'Preis pro Benutzer',
137135
pay: 'Zahlen',
138136
we_take_care: [
139-
`Heute ist <strong>${deDate}</strong>, und wir bitten Sie höflich, die Zahlung abzuschließen, damit Dark Reader weiterlaufen kann.`,
137+
`Heute ist <strong>${formatDate('de')}</strong>, und wir bitten Sie höflich, die Zahlung abzuschließen, damit Dark Reader weiterlaufen kann.`,
140138
`Sei <strong>über 10 Jahren</strong>, hilft Dark Reader Millionen von Menschen mit Migräne, Photophobie und Lichtempfindlichkeit.`,
141139
`Bitte <strong>tätigen Sie jetzt oder</strong> kurz nach dem Ausprobieren der App eine Zahlung.`,
142140
`Beteiligen Sie sich an der Verbreitung des Dunkelmodus im Internet und helfen Sie dabei, das Web für alle Augen angenehmer zu gestalten.`,
@@ -150,20 +148,62 @@ const locales = {
150148
price_per_user: 'Prix par utilisateur',
151149
pay: 'Payer',
152150
we_take_care: [
153-
`Aujourd'hui c'est <strong>${frDate}</strong>, et nous vous demandons de bien vouloir effectuer le paiement pour que Dark Reader continue.`,
151+
`Aujourd'hui c'est <strong>${formatDate('fr')}</strong>, et nous vous demandons de bien vouloir effectuer le paiement pour que Dark Reader continue.`,
154152
`Depuis <strong>plus de 10 ans</strong>, Dark Reader a aidé des millions de personnes souffrant de migraines, de photophobie et de sensibilité à la lumière.`,
155153
`Veuillez <strong>effectuer un paiement maintenan</strong> ou peu de temps après avoir essayé l'application..`,
156154
`Participez à la diffusion du mode sombre sur Internet et contribuez à rendre le Web plus agréable pour les yeux de tous.`,
157155
].join(' '),
158156
},
157+
es: {
158+
heading: 'Pague por Dark Reader',
159+
regular: 'Uso individual',
160+
corporate: 'Organizaciones',
161+
one_time: 'Pago único',
162+
price_per_user: 'Precio por usuario',
163+
pay: 'Pagar',
164+
we_take_care: [
165+
`Hoy es <strong>${formatDate('es')}</strong>, y te pedimos que completes el pago para que Dark Reader siga funcionando.`,
166+
`For <strong>más de 10 años</strong>, Dark Reader ha ayudado a millones de personas con migrañas, fotofobia y sensibilidad a la luz.`,
167+
`Por favor, <strong>realiza el pago ahora</strong> o poco después de probar la app.`,
168+
`Participa en la difusión del modo oscuro en internet y ayuda a que la web sea más cómoda para todos.`,
169+
].join(' '),
170+
},
171+
nl: {
172+
heading: 'Betaal voor Dark Reader',
173+
regular: 'Individueel gebruik',
174+
corporate: 'Organisaties',
175+
one_time: 'Eenmalige betaling',
176+
price_per_user: 'Prijs per gebruiker',
177+
pay: 'Betaling',
178+
we_take_care: [
179+
`Vandaag is het <strong>${formatDate('nl')}</strong>, en we vragen u vriendelijk om de betaling te voltooien om Dark Reader te kunnen blijven gebruiken.`,
180+
`Dark Reader helpt <strong>al meer dan 10 jaar</strong>, miljoenen mensen met migraine, fotofobie en lichtgevoeligheid.`,
181+
`Doe nu of kort na het uitproberen van de app een betaling.`,
182+
`Doe mee aan de verspreiding van de donkere modus op internet en help het web prettiger te maken voor iedereen.`,
183+
].join(' '),
184+
},
185+
ja: {
186+
heading: 'Dark Reader の料金を支払う',
187+
regular: '個人使用',
188+
corporate: '組織',
189+
one_time: '1回限りの支払い',
190+
price_per_user: 'ユーザーあたりの価格',
191+
pay: '支払う',
192+
we_take_care: [
193+
`今日は <strong>${formatDate('ja')}</strong>, Dark Readerを継続するために、お支払いを完了していただきますようお願いいたします。`,
194+
`Dark Readerは10年以上にわたり、片頭痛、羞明、光過敏症に悩む何百万人もの方々を支援してきました。`,
195+
`今すぐ、またはアプリをお試しいただいた後すぐにお支払いください。`,
196+
`インターネット上でダークモードを広め、皆様の目に優しいウェブ環境づくりにご協力ください。`,
197+
].join(' '),
198+
},
159199
};
160200

161201
const htmlText = `
162202
<section class="pr">
163203
<div class="pr-wrapper">
164204
<h2 class="pr-heading" data-text="heading">Please pay for <span class="pr-heading__darkreader">Dark Reader</span></h2>
165205
<div class="pr-description" data-text="we_take_care">
166-
${takeCareMsg}
206+
${takeCareMsgEnUS}
167207
</div>
168208
<section class="payment-wrapper">
169209
<div class="currencies">
@@ -903,19 +943,13 @@ class PayTiersElement extends HTMLElement {
903943
update();
904944

905945
if (document.documentElement.lang === 'zh-CN') {
906-
Object.entries(locales.cn).forEach(([key, text]) => {
907-
s(`[data-text="${key}"]`).each((node) => node.textContent = text);
908-
});
909946
s('.js-card-icon').each((node) => node.classList.add('button-link__card-icon--cn'));
910-
} else if (document.documentElement.lang === 'de') {
911-
Object.entries(locales.de).forEach(([key, text]) => {
912-
s(`[data-text="${key}"]`).each((node) => node.innerHTML = text);
913-
});
914-
} else if (document.documentElement.lang === 'fr') {
915-
Object.entries(locales.fr).forEach(([key, text]) => {
947+
}
948+
const lang = document.documentElement.lang;
949+
if (Object.keys(locales).includes(lang)) {
950+
Object.entries(locales[lang]).forEach(([key, text]) => {
916951
s(`[data-text="${key}"]`).each((node) => node.innerHTML = text);
917952
});
918-
919953
}
920954

921955
if (PADDLE_MODE) {

0 commit comments

Comments
 (0)