about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2017-12-10 15:41:22 -0500
committerGitHub <noreply@github.com>2017-12-10 15:41:22 -0500
commit26c9b9fa276fd629789fd06f65a5d698b182f67a (patch)
tree8480daa3428db3a2443ba45949a4182481e5ec16 /app/lib
parent282f48ddd1868fcd8fa2887bbaf13036c949c22d (diff)
parent64b839b76907e87c57d71762a81a9a8660f1df83 (diff)
Merge pull request #246 from glitch-soc/theme-intl8n
Internationalization for flavours and skins
Diffstat (limited to 'app/lib')
-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' => [] }