[frontend] Fix issue with I18n when the global HUE_I81n property isn't set
// 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);
});
