1- import list from './i18n-cache-query-list.js'
2-
31export type Bundle = [ namespace : string , lang : string , json : Record < string , string > ]
42export async function queryRemoteI18NBundle ( lang : string ) : Promise < Bundle [ ] > {
53 // skip fetching in development. if you need to debug this, please comment this code.
@@ -17,9 +15,11 @@ export async function queryRemoteI18NBundle(lang: string): Promise<Bundle[]> {
1715}
1816
1917const I18N_LOCALES_HOST = 'https://maskbook.pages.dev/'
18+ // TODO: remote translate url
19+ const list : Record < string , string > = { }
2020
2121function fetchTranslatedBundle ( lang : string ) {
22- return Object . entries ( list as Record < string , string > ) . map ( async ( [ url , namespace ] ) : Promise < Bundle | null > => {
22+ return Object . entries ( list ) . map ( async ( [ url , namespace ] ) : Promise < Bundle | null > => {
2323 try {
2424 const path = url . replace ( '%locale%' , lang )
2525 const response = await fetch ( I18N_LOCALES_HOST + path , fetchOption )
@@ -32,7 +32,7 @@ function fetchTranslatedBundle(lang: string) {
3232 } )
3333}
3434function fetchEnglishBundle ( ) {
35- return Object . entries ( list as Record < string , string > ) . map ( async ( [ url , namespace ] ) : Promise < Bundle | null > => {
35+ return Object . entries ( list ) . map ( async ( [ url , namespace ] ) : Promise < Bundle | null > => {
3636 try {
3737 const path = url . replace ( '%locale%' , 'en-US' )
3838 const response = await fetch ( I18N_LOCALES_HOST + path , fetchOption )
0 commit comments