33import './sponsors-graph.js' ;
44import './sponsors-top-short.js' ;
55import './pay-tiers.js' ;
6- import { country , isEUCountry , isHCountry , isPCountry } from './locales.js' ;
76import { clicker } from './stats.js' ;
87import {
98 createHTMLElement as html ,
@@ -12,20 +11,23 @@ import {
1211const safariURL = 'https://apps.apple.com/us/app/dark-reader-for-safari/id1438243180?platform=iphone' ;
1312const 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
2123const 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-
7171const cssText = `
7272a {
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
0 commit comments