File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,14 @@ class Localization {
5151 }
5252
5353 async setInitialTranslation ( ) {
54+ await Localization . fetchDefaultTranslations ( ) ;
5455 await Localization . setTranslation ( Localization . initialLocale )
5556 }
5657
5758 static async setTranslation ( locale ) {
5859 if ( ! locale ) locale = Localization . systemLocale ;
5960
60- await Localization . setLocale ( locale )
61+ await Localization . fetchTranslations ( locale )
6162 await Localization . translatePage ( ) ;
6263
6364 if ( Localization . localeIsRtl ( locale ) ) {
@@ -78,10 +79,12 @@ class Localization {
7879 Events . fire ( "translation-loaded" ) ;
7980 }
8081
81- static async setLocale ( newLocale ) {
82- if ( newLocale === Localization . locale ) return false ;
82+ static async fetchDefaultTranslations ( ) {
83+ Localization . translationsDefaultLocale = await Localization . fetchTranslationsFor ( Localization . defaultLocale ) ;
84+ }
8385
84- Localization . defaultTranslations = await Localization . fetchTranslationsFor ( Localization . defaultLocale ) ;
86+ static async fetchTranslations ( newLocale ) {
87+ if ( newLocale === Localization . locale ) return false ;
8588
8689 const newTranslations = await Localization . fetchTranslationsFor ( newLocale ) ;
8790
You can’t perform that action at this time.
0 commit comments