Jelajahi Sumber

[frontend] Fix issue with I18n when the global HUE_I81n property isn't set

Johan Ahlen 5 tahun lalu
induk
melakukan
63c5029453
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      desktop/core/src/desktop/js/utils/i18n.js

+ 2 - 2
desktop/core/src/desktop/js/utils/i18n.js

@@ -15,13 +15,13 @@
 // limitations under the License.
 
 const I18n = (identifier, ...replacements) => {
-  if (window.DJANGO_DEBUG_MODE && !HUE_I18n[identifier]) {
+  if (window.DJANGO_DEBUG_MODE && !window.HUE_I18n[identifier]) {
     if (!window.missing_I18n) {
       window.missing_I18n = [];
     }
     window.missing_I18n.push(`'${identifier}': '\${ _('${identifier}') }',`);
   }
-  let result = HUE_I18n[identifier] || identifier;
+  let result = (window.HUE_I18n && window.HUE_I18n[identifier]) || identifier;
   replacements.forEach(replacement => {
     result = result.replace('%s', replacement);
   });