Support for finding new locales in plugins

This commit is contained in:
Robin Ward
2017-11-15 11:20:04 -05:00
parent 44081bdf73
commit fc73de9578
3 changed files with 15 additions and 2 deletions
+11 -1
View File
@@ -25,7 +25,17 @@ class LocaleSiteSetting < EnumSiteSetting
def self.supported_locales
@lock.synchronize do
@supported_locales ||= Dir.glob(File.join(Rails.root, 'config', 'locales', 'client.*.yml')).map { |x| x.split('.')[-2] }.sort
@supported_locales ||= begin
app_client_files = Dir.glob(
File.join(Rails.root, 'config', 'locales', 'client.*.yml')
)
plugin_client_files = Dir.glob(
File.join(Rails.root, 'plugins', '*', 'config', 'locales', 'client.*.yml')
)
(app_client_files + plugin_client_files).map { |x| x.split('.')[-2] }.uniq.sort
end
end
end