FEATURE: Allow plugins to register a new locale

This commit is contained in:
Gerhard Schlager
2018-01-25 12:09:18 +01:00
parent ba6cd83e3a
commit eb52c5469e
29 changed files with 480 additions and 71 deletions

View File

@ -39,6 +39,13 @@ module I18n
if @loaded_locales.empty?
# load all rb files
I18n.backend.load_translations(I18n.load_path.grep(/\.rb$/))
# load plural rules from plugins
DiscoursePluginRegistry.locales.each do |locale, options|
if options[:plural]
I18n.backend.store_translations(locale, i18n: { plural: options[:plural] })
end
end
end
# load it