@@ -38,61 +38,64 @@ export const Page = (
3838 _lunaria : LunariaInstance , // currenly not in use
3939) : string => {
4040 return html `
41- <!doctype html>
42- < html dir ="ltr " lang ="en ">
43- < head >
44- ${ Meta } ${ BaseStyles } ${ CustomStyles }
45- </ head >
46- < body >
47- ${ Body ( config , status ) }
48- </ body >
49- </ html >
50- `
41+ <!doctype html>
42+ < html dir ="ltr " lang ="en ">
43+ < head >
44+ ${ Meta } ${ BaseStyles } ${ CustomStyles }
45+ </ head >
46+ < body >
47+ ${ Body ( config , status ) }
48+ </ body >
49+ </ html >
50+ `
5151}
5252
5353const Meta = html `
54- < meta charset ="utf-8 " />
55- < meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 " />
56- < title > npmx - Translation Status</ title >
57- < meta
58- name ="description "
59- content ="Translation progress tracker for the npmx site. See how much has been translated in your language and get involved! "
60- />
61- < meta property ="last-build " content ="${ new Date ( Date . now ( ) ) . toString ( ) } " />
62- < link rel ="canonical " href ="https://i18n.npmx.dev/ " />
63- < link rel ="preconnect " href ="https://fonts.googleapis.com ">
64- < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin >
65- < link href ="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=swap " rel ="stylesheet ">
66- < meta property ="og:title " content ="npmx - Translation Status " />
67- < meta property ="og:type " content ="website " />
68- < meta property ="og:url " content ="https://i18n.npmx.dev/ " />
69- < meta
70- property ="og:description "
71- content ="Translation progress tracker for the npmx site. See how much has been translated in your language and get involved! "
72- />
73- < link rel ="icon " href ="https://npmx.dev/favicon.ico " type ="image/x-icon " />
74- < link rel ="icon " href ="https://npmx.dev/favicon.svg " type ="image/svg+xml " />
54+ < meta charset ="utf-8 " />
55+ < meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 " />
56+ < title > npmx - Translation Status</ title >
57+ < meta
58+ name ="description "
59+ content ="Translation progress tracker for the npmx site. See how much has been translated in your language and get involved! "
60+ />
61+ < meta property ="last-build " content ="${ new Date ( Date . now ( ) ) . toString ( ) } " />
62+ < link rel ="canonical " href ="https://i18n.npmx.dev/ " />
63+ < link rel ="preconnect " href ="https://fonts.googleapis.com " />
64+ < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin />
65+ < link
66+ href ="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=swap "
67+ rel ="stylesheet "
68+ />
69+ < meta property ="og:title " content ="npmx - Translation Status " />
70+ < meta property ="og:type " content ="website " />
71+ < meta property ="og:url " content ="https://i18n.npmx.dev/ " />
72+ < meta
73+ property ="og:description "
74+ content ="Translation progress tracker for the npmx site. See how much has been translated in your language and get involved! "
75+ />
76+ < link rel ="icon " href ="https://npmx.dev/favicon.ico " type ="image/x-icon " />
77+ < link rel ="icon " href ="https://npmx.dev/favicon.svg " type ="image/svg+xml " />
7578`
7679
7780const Body = ( config : LunariaConfig , status : I18nStatus ) : string => {
7881 return html `
79- < main >
80- < div class ="limit-to-viewport ">
81- < h1 > npmx Translation Status</ h1 >
82- ${ TitleParagraph } ${ StatusByLocale ( config , status ) }
83- </ div >
84- </ main >
85- `
82+ < main >
83+ < div class ="limit-to-viewport ">
84+ < h1 > npmx Translation Status</ h1 >
85+ ${ TitleParagraph } ${ StatusByLocale ( config , status ) }
86+ </ div >
87+ </ main >
88+ `
8689}
8790
8891const StatusByLocale = ( config : LunariaConfig , status : I18nStatus ) : string => {
8992 const { locales } = config
9093 return html `
91- < h2 id ="by-locale ">
92- < a href ="#by-locale "> Translation progress by locale</ a >
93- </ h2 >
94- ${ locales . map ( locale => LocaleDetails ( status , locale ) ) }
95- `
94+ < h2 id ="by-locale ">
95+ < a href ="#by-locale "> Translation progress by locale</ a >
96+ </ h2 >
97+ ${ locales . map ( locale => LocaleDetails ( status , locale ) ) }
98+ `
9699}
97100
98101const LocaleDetails = ( status : I18nStatus , locale : Locale ) : string => {
@@ -113,50 +116,49 @@ const LocaleDetails = (status: I18nStatus, locale: Locale): string => {
113116 } = localeStatus
114117
115118 return html `
116- < details class ="progress-details ">
117- < summary >
118- < strong > ${ label } < span class ="lang-code "> ${ lang } </ span > </ strong >
119- < hr />
120- < div class ="progress-summary ">
121- < span >
122- ${ missingKeys . length ? `${ missingKeys . length . toString ( ) } missing keys` : '✔' }
123- </ span >
119+ < details class ="progress-details ">
120+ < summary >
121+ < strong > ${ label } < span class ="lang-code "> ${ lang } </ span > </ strong >
122+ < hr />
123+ < div class ="progress-summary ">
124+ < span >
125+ ${ missingKeys . length ? `${ missingKeys . length . toString ( ) } missing keys` : '✔' }
126+ </ span >
124127 < span > ${ completedKeys } / ${ totalKeys } </ span >
125- </ div >
126- ${ ProgressBar ( percentComplete ) }
127- </ summary >
128- < br />
129- ${ ContentDetailsLinks ( { text : `i18n/locales/${ lang } .json` , url : githubEditUrl } , githubHistoryUrl ) }
130- < br />
131- < br />
132- ${
133- missingKeys . length > 0
134- ? html `${ MissingKeysList ( missingKeys ) } `
135- : html `
136- < p > This translation is complete, amazing job! 🎉</ p >
137- `
138- }
139- </ details >
140- `
128+ </ div >
129+ ${ ProgressBar ( percentComplete ) }
130+ </ summary >
131+ < br />
132+ ${ ContentDetailsLinks (
133+ { text : `i18n/locales/${ lang } .json` , url : githubEditUrl } ,
134+ githubHistoryUrl ,
135+ ) }
136+ < br />
137+ < br />
138+ ${ missingKeys . length > 0
139+ ? html `${ MissingKeysList ( missingKeys ) } `
140+ : html ` < p > This translation is complete, amazing job! 🎉</ p > ` }
141+ </ details >
142+ `
141143}
142144
143145const MissingKeysList = ( missingKeys : string [ ] ) : string => {
144146 return html `< details >
145- < summary > Show missing keys</ summary >
146- < ul >
147- ${ missingKeys . map ( key => html `< li > ${ key } </ li > ` ) }
148- </ ul >
149- </ details > `
147+ < summary > Show missing keys</ summary >
148+ < ul >
149+ ${ missingKeys . map ( key => html `< li > ${ key } </ li > ` ) }
150+ </ ul >
151+ </ details > `
150152}
151153
152154const ContentDetailsLinks = (
153155 githubEditLink : { text : string ; url : string } ,
154156 githubHistoryUrl : string ,
155157) : string => {
156158 return html `
157- ${ Link ( githubEditLink . url , githubEditLink . text ) } |
158- ${ Link ( githubHistoryUrl , 'source change history' ) }
159- `
159+ ${ Link ( githubEditLink . url , githubEditLink . text ) } |
160+ ${ Link ( githubHistoryUrl , 'source change history' ) }
161+ `
160162}
161163
162164const ProgressBar = ( percentComplete : number ) : string => {
@@ -175,10 +177,10 @@ const ProgressBar = (percentComplete: number): string => {
175177 }
176178
177179 return html `
178- < div class ="progress-bar-wrapper " aria-hidden ="true ">
179- < div class ="progress-bar ${ barClass } " style ="width:${ percentComplete } %; "> </ div >
180- </ div >
181- `
180+ < div class ="progress-bar-wrapper " aria-hidden ="true ">
181+ < div class ="progress-bar ${ barClass } " style ="width:${ percentComplete } %; "> </ div >
182+ </ div >
183+ `
182184}
183185
184186const Link = ( href : string , text : string ) : string => {
@@ -210,29 +212,29 @@ const _StatusByFile = (
210212) : string => {
211213 const { locales } = config
212214 return html `
213- < h2 id ="by-file ">
214- < a href ="#by-file "> Translation status by file</ a >
215- </ h2 >
216- < div class ="status-by-file-wrapper ">
217- < table class ="status-by-file ">
218- < thead >
219- < tr >
220- ${ [ 'File' , ...locales . map ( ( { lang } ) => lang ) ] . map ( col => html `< th > ${ col } </ th > ` ) }
221- </ tr >
222- </ thead >
223- ${ TableBody ( status , locales , lunaria ) }
224- </ table >
225- </ div >
226- < sup class ="capitalize "> ❌ missing 🔄 outdated ✔ done </ sup >
227- `
215+ < h2 id ="by-file ">
216+ < a href ="#by-file "> Translation status by file</ a >
217+ </ h2 >
218+ < div class ="status-by-file-wrapper ">
219+ < table class ="status-by-file ">
220+ < thead >
221+ < tr >
222+ ${ [ 'File' , ...locales . map ( ( { lang } ) => lang ) ] . map ( col => html `< th > ${ col } </ th > ` ) }
223+ </ tr >
224+ </ thead >
225+ ${ TableBody ( status , locales , lunaria ) }
226+ </ table >
227+ </ div >
228+ < sup class ="capitalize "> ❌ missing 🔄 outdated ✔ done </ sup >
229+ `
228230}
229231
230232const TableBody = ( status : LunariaStatus , locales : Locale [ ] , lunaria : LunariaInstance ) : string => {
231233 const links = lunaria . gitHostingLinks ( )
232234
233235 return html `
234- < tbody >
235- ${ status . map (
236+ < tbody >
237+ ${ status . map (
236238 file =>
237239 html `
238240 < tr >
@@ -243,8 +245,8 @@ const TableBody = (status: LunariaStatus, locales: Locale[], lunaria: LunariaIns
243245 </ td >
244246 </ tr > ` ,
245247 ) }
246- </ tbody >
247- `
248+ </ tbody >
249+ `
248250}
249251
250252const TableContentStatus = (
@@ -293,11 +295,11 @@ const EmojiFileLink = (
293295
294296 return href
295297 ? html `< a href ="${ href } " title ="${ statusTextOpts [ type ] } ">
296- < span aria-hidden ="true "> ${ statusEmojiOpts [ type ] } </ span >
297- </ a > `
298+ < span aria-hidden ="true "> ${ statusEmojiOpts [ type ] } </ span >
299+ </ a > `
298300 : html `< span title ="${ statusTextOpts [ type ] } ">
299- < span aria-hidden ="true "> ${ statusEmojiOpts [ type ] } </ span >
300- </ span > `
301+ < span aria-hidden ="true "> ${ statusEmojiOpts [ type ] } </ span >
302+ </ span > `
301303}
302304
303305const _CreateFileLink = ( href : string , text : string ) : string => {
@@ -311,20 +313,20 @@ const _SvgSummary = (config: LunariaConfig, status: LunariaStatus): string => {
311313 const localeHeight = 56 // Each locale’s summary is 56px high.
312314 const svgHeight = localeHeight * Math . ceil ( config . locales . length / 2 )
313315 return html `< svg
314- xmlns ="http://www.w3.org/2000/svg "
315- viewBox ="0 0 400 ${ svgHeight } "
316- font-family ="ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' "
317- >
318- ${ config . locales
316+ xmlns ="http://www.w3.org/2000/svg "
317+ viewBox ="0 0 400 ${ svgHeight } "
318+ font-family ="ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' "
319+ >
320+ ${ config . locales
319321 . map ( locale => SvgLocaleSummary ( status , locale ) )
320322 . sort ( ( a , b ) => b . progress - a . progress )
321323 . map (
322324 ( { svg } , index ) =>
323325 html `< g transform ="translate(${ ( index % 2 ) * 215 } ${ Math . floor ( index / 2 ) * 56 } ) "
324- > ${ svg } </ g
325- > `,
326+ > ${ svg } </ g
327+ > `,
326328 ) }
327- </ svg > `
329+ </ svg > `
328330}
329331
330332function SvgLocaleSummary (
@@ -359,18 +361,16 @@ function SvgLocaleSummary(
359361 return {
360362 progress : doneFraction ,
361363 svg : html `< text x ="0 " y ="12 " font-size ="11 " font-weight ="600 " fill ="#999 "
362- > ${ label } (${ lang } )</ text
363- >
364- < text x ="0 " y ="26 " font-size ="9 " fill ="#999 ">
365- ${
366- missingFiles . length == 0 && outdatedFiles . length == 0
367- ? '100% complete, amazing job! 🎉'
368- : html `${ doneLength } done, ${ outdatedFiles . length } outdated, ${ missingFiles . length }
369- missing`
370- }
371- </ text >
372- < rect x ="0 " y ="34 " width ="${ barWidth } " height ="8 " fill ="#999 " opacity ="0.25 "> </ rect >
373- < rect x ="0 " y ="34 " width ="${ outdatedWidth } " height ="8 " fill ="#fb923c "> </ rect >
374- < rect x ="0 " y ="34 " width ="${ doneWidth } " height ="8 " fill ="#c084fc "> </ rect > ` ,
364+ > ${ label } (${ lang } )</ text
365+ >
366+ < text x ="0 " y ="26 " font-size ="9 " fill ="#999 ">
367+ ${ missingFiles . length == 0 && outdatedFiles . length == 0
368+ ? '100% complete, amazing job! 🎉'
369+ : html `${ doneLength } done, ${ outdatedFiles . length } outdated, ${ missingFiles . length }
370+ missing` }
371+ </ text >
372+ < rect x ="0 " y ="34 " width ="${ barWidth } " height ="8 " fill ="#999 " opacity ="0.25 "> </ rect >
373+ < rect x ="0 " y ="34 " width ="${ outdatedWidth } " height ="8 " fill ="#fb923c "> </ rect >
374+ < rect x ="0 " y ="34 " width ="${ doneWidth } " height ="8 " fill ="#c084fc "> </ rect > ` ,
375375 }
376376}
0 commit comments