mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Localization fallbacks (client)
This patch sets I18n.defaultLocale in the Discourse.start() script block (it was formerly always 'en') to SiteSetting.default_locale, and patches translate() to perform fallback to defaultLocale followed by english. Additionally, when enable_verbose_localization() is called, no fallbacks will be performed. It also memoizes the file loading operations in JsLocaleHelper and strips out translations from the fallbacks that are also present in a prefered language, to minimize file size.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
Discourse.Environment = '<%= Rails.env %>';
|
||||
Discourse.SiteSettings = PreloadStore.get('siteSettings');
|
||||
Discourse.LetterAvatarVersion = '<%= LetterAvatar.version %>';
|
||||
I18n.defaultLocale = '<%= SiteSetting.default_locale %>';
|
||||
PreloadStore.get("customEmoji").forEach(function(emoji) {
|
||||
Discourse.Dialect.registerEmoji(emoji.name, emoji.url);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user