diff --git a/src/js/intl/index.js b/src/js/intl/index.js index 49bec6ec..42ae86b0 100644 --- a/src/js/intl/index.js +++ b/src/js/intl/index.js @@ -9,6 +9,10 @@ var getDefaultLocale = exports.getDefaultLocale = function() { return 'en_US'; }; +var fallbackMap = { + 'zh_TW': 'zh_CN' +}; + var getLocale = exports.getLocale = function() { if (GlobalState.locale) { return GlobalState.locale; @@ -44,6 +48,11 @@ var str = exports.str = function(key, params) { return 'NO INTL support for key ' + key; } + if (!strings[key][locale]) { + // try falling back to another locale if in the map + locale = fallbackMap[locale] || locale; + } + if (!strings[key][locale]) { if (key !== 'error-untranslated') { return str('error-untranslated');