Return empty string instead of empty html element for empty text

This commit is contained in:
Quincy Morgan
2020-09-28 15:36:01 -04:00
parent 808eb21102
commit 03c32d2f6a

View File

@@ -322,7 +322,8 @@ export function coreLocalizer() {
// Returns the localized text wrapped in an HTML element encoding the locale info
localizer.t.html = function(stringId, replacements, locale) {
const info = localizer.tInfo(stringId, replacements, locale);
return localizer.htmlForLocalizedText(info.text, info.locale);
// text may be empty or undefined if `replacements.default` is
return info.text ? localizer.htmlForLocalizedText(info.text, info.locale) : '';
};
localizer.htmlForLocalizedText = function(text, localeCode) {