Skip to content

Commit 06a746f

Browse files
committed
Publish 2024-10-01
1 parent 99c87a8 commit 06a746f

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

elements/mobile-side.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import './sponsors-graph.js';
44
import './sponsors-top-short.js';
55
import './pay-tiers.js';
6-
import {country, isEUCountry, isHCountry, isPCountry} from './locales.js';
76
import {clicker} from './stats.js';
87
import {
98
createHTMLElement as html,
@@ -12,20 +11,23 @@ import {
1211
const safariURL = 'https://apps.apple.com/us/app/dark-reader-for-safari/id1438243180?platform=iphone';
1312
const edgeURL = 'https://www.microsoft.com/edge/emmx/darkreadercollaboration';
1413

15-
const isEdge = navigator.userAgent.includes('Edg');
16-
const isSafari = navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrom');
17-
const language = navigator.language || 'en';
18-
19-
const buttonIcon = `<span class="b-icon${isEdge ? ' b-icon--edge' : isSafari ? ' b-icon--safari' : ''}"></span>`;
14+
const locales = {
15+
cn: {
16+
breaking_news: '突发新闻',
17+
is_now_available_for: '突发新闻',
18+
check_out_exclusive: '查看独家高级主题和自定义颜色',
19+
simply_scan: '只需扫描二维码即可在手机上安装',
20+
},
21+
};
2022

2123
const htmlText = `
2224
<section class="mob">
2325
<div class="mob-subtitle">
24-
<div class="mob-subtitle__news">
26+
<div class="mob-subtitle__news" data-text="breaking_news">
2527
Breaking News
2628
</div>
2729
<a class="mob-text-link" href="${edgeURL}" target="_blank" rel="noopener" data-s="drand-side-text">
28-
<span class="mob-text-link__darkreader">Dark Reader</span> is now<br>available for
30+
<span class="mob-text-link__darkreader">Dark Reader</span> <span data-text="is_now_available_for">is now<br>available for</span>
2931
<span class="mob-text-link__android">Android</span>!
3032
</a>
3133
</div>
@@ -35,13 +37,13 @@ const htmlText = `
3537
</a>
3638
</div>
3739
<div class="mob-description">
38-
<a href="${edgeURL}" target="_blank" rel="noopener" data-s="drand-side-text">
40+
<a href="${edgeURL}" target="_blank" rel="noopener" data-s="drand-side-text" data-text="check_out_exclusive">
3941
Check out exclusive <strong>Premium Themes & Custom Colors</strong>
4042
</a>
4143
</div>
4244
<div class="mob-qr-2">
4345
<img class="just-qr" src="/images/qr-code.png">
44-
<div class="mob-description">
46+
<div class="mob-description" data-text="simply_scan">
4547
Simply <strong>scan the QR code</strong> to install on your phone
4648
</div>
4749
</div>
@@ -66,8 +68,6 @@ const htmlText = `
6668
</section>
6769
`;
6870

69-
const outlineFilter = 'drop-shadow(0.0625rem 0 0 hsla(0, 0%, 100%, 1)) drop-shadow(-0.0625rem 0 0 hsla(0, 0%, 100%, 1)) drop-shadow(0 0.0625rem 0 hsla(0, 0%, 100%, 1)) drop-shadow(0 -0.0625rem 0 hsla(0, 0%, 100%, 1))';
70-
7171
const cssText = `
7272
a {
7373
color: var(--color-text);
@@ -269,6 +269,12 @@ class MobileSideElement extends HTMLElement {
269269
el.classList.toggle('mob-screenshot--visible', i === j);
270270
});
271271
}, 4000);
272+
273+
if (document.documentElement.lang === 'zh-CN') {
274+
Object.entries(locales.cn).forEach(([key, text]) => {
275+
shadowRoot.querySelectorAll(`[data-text="${key}"]`).forEach((node) => node.textContent = text);
276+
});
277+
}
272278
}
273279
}
274280

help/zh-CN/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ <h1>说明 — Dark Reader</h1>
3434
}
3535
</script>
3636

37-
<p>Dark Reader 是一套快速高效的算法。
38-
我们努力改进。
39-
重要的是您<a data-s="d-help-top" href="https://darkreader.org/support-us" target="_blank">为使用扩展程序付费</a>并支持我们的工作。
40-
安装我们的<a data-s="drios-help-top" href="https://apps.apple.com/us/app/dark-reader-for-safari/id1438243180" target="_blank" rel="noopener">iPhone 和 iPad 应用程序</a>
41-
准备好了吗?我们开始吧。</p>
37+
<p>亲爱的读者,我们投入了大量心血和精力来打造这款应用,让它变得高效易用。您的
38+
<a data-s="d-help-top" href="https://darkreader.org/support-us" target="_blank">付款</a>
39+
有助于我们继续改进它,推出新功能和改进。</p>
4240
<ul>
4341
<li><a href="#faq">常见问题</a></li>
4442
<li><a href="#contacts">联络方式</a></li>

0 commit comments

Comments
 (0)