File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,20 @@ const getEditorMode = () => {
115115 return 'editor' ;
116116} ;
117117
118- const language = reduxInstance . state . locales . locale . split ( '-' ) [ 0 ] ;
118+ /**
119+ * @returns {string } Locale code
120+ */
121+ const getLocale = ( ) => {
122+ const locale = reduxInstance . state . locales . locale ;
123+ if ( Object . prototype . hasOwnProperty . call ( l10nEntries , locale ) ) {
124+ return locale ;
125+ }
126+ return locale . split ( '-' ) [ 0 ] ;
127+ } ;
128+ const language = getLocale ( ) ;
129+
119130const getTranslations = async ( ) => {
120- if ( l10nEntries [ language ] ) {
131+ if ( Object . prototype . hasOwnProperty . call ( l10nEntries , language ) ) {
121132 const localeMessages = await l10nEntries [ language ] ( ) ;
122133 Object . assign ( addonMessages , localeMessages ) ;
123134 }
You can’t perform that action at this time.
0 commit comments