File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,12 @@ interface Locale {
1010i18next . use ( initReactI18next ) ;
1111const localeFiles = import . meta. glob ( "./translations/*/translation.json" , { eager : true } ) ;
1212const resources : Record < string , Record < string , Record < string , string > > > = { } ;
13- for ( const [ path , _translations ] of Object . entries ( localeFiles ) ) {
13+ for ( const [ path , module ] of Object . entries ( localeFiles ) ) {
1414 const id = path . split ( "/" ) . at ( - 2 ) ;
1515 if ( ! id ) continue ;
16- if ( ! resources [ id ] ) resources [ id ] = { } ;
17- const translations = _translations as { default : Record < string , string > } | Record < string , string > ;
18- if ( "default" in translations ) {
19- resources [ id ] . translation = translations . default as Record < string , string > ;
20- } else {
21- resources [ id ] . translation = translations ;
22- }
16+
17+ const translations = ( module as any ) . default ?? module ;
18+ resources [ id ] = { translation : translations } ;
2319}
2420
2521export function initTranslations ( lng : string ) {
You can’t perform that action at this time.
0 commit comments