about summary refs log tree commit diff
path: root/app/lib/themes.rb
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-12-07 19:07:47 -0800
committerkibigo! <marrus-sh@users.noreply.github.com>2017-12-10 11:08:04 -0800
commitb28cd6769c77190160e4ffefde78b324c7aad269 (patch)
tree9b1957fb4e19c79ccc5018931eb5f1f57d996a79 /app/lib/themes.rb
parent83944300815cda2cd67c93ec7ca7f3d981b561fa (diff)
Javascript intl8n flavour support
Diffstat (limited to 'app/lib/themes.rb')
-rw-r--r--app/lib/themes.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/lib/themes.rb b/app/lib/themes.rb
index 863326e2d..49e9ebbc3 100644
--- a/app/lib/themes.rb
+++ b/app/lib/themes.rb
@@ -15,6 +15,14 @@ class Themes
     Dir.glob(Rails.root.join('app', 'javascript', 'flavours', '*', 'theme.yml')) do |path|
       data = YAML.load_file(path)
       name = File.basename(File.dirname(path))
+      if data['locales']
+        locales = []
+        Dir.glob(File.join(File.dirname(path), data['locales'], '*.{js,json}')) do |locale|
+          localeName = File.basename(locale, File.extname(locale))
+          locales.push(localeName) unless localeName.match(/defaultMessages|whitelist|index/)
+        end
+        data['locales'] = locales
+      end
       if data['pack']
         data['name'] = name
         data['skin'] = { 'default' => [] }