Browse Source

Ruby intl8n for themes

closed-social-glitch-2
kibigo! 7 years ago
parent
commit
d08d0f9f33
6 changed files with 24 additions and 2 deletions
  1. +6
    -0
      app/javascript/flavours/glitch/names.yml
  2. +6
    -0
      app/javascript/flavours/vanilla/names.yml
  3. +0
    -0
      app/javascript/skins/vanilla/win95/common.scss
  4. +4
    -0
      app/javascript/skins/vanilla/win95/names.yml
  5. +2
    -2
      app/views/settings/preferences/show.html.haml
  6. +6
    -0
      config/initializers/locale.rb

+ 6
- 0
app/javascript/flavours/glitch/names.yml View File

@ -0,0 +1,6 @@
en:
flavours:
glitch: Glitch Edition
skins:
glitch:
default: Default

+ 6
- 0
app/javascript/flavours/vanilla/names.yml View File

@ -0,0 +1,6 @@
en:
flavours:
vanilla: Vanilla Mastodon
skins:
vanilla:
default: Default

app/javascript/skins/vanilla/win95.scss → app/javascript/skins/vanilla/win95/common.scss View File


+ 4
- 0
app/javascript/skins/vanilla/win95/names.yml View File

@ -0,0 +1,4 @@
en:
skins:
vanilla:
win95: Masto95

+ 2
- 2
app/views/settings/preferences/show.html.haml View File

@ -27,8 +27,8 @@
.fields-group
- if Themes.instance.flavours.size > 1
= f.input :setting_flavour, collection: Themes.instance.flavours, label_method: lambda { |flavour| I18n.t("themes.#{flavour}", default: flavour) }, wrapper: :with_label, include_blank: false
= f.input :setting_skin, collection: Themes.instance.skins_for(current_flavour), label_method: lambda { |skin| I18n.t("themes.#{current_flavour}.skins.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false
= f.input :setting_flavour, collection: Themes.instance.flavours, label_method: lambda { |flavour| I18n.t("flavours.#{flavour}", default: flavour) }, wrapper: :with_label, include_blank: false
= f.input :setting_skin, collection: Themes.instance.skins_for(current_flavour), label_method: lambda { |skin| I18n.t("skins.#{current_flavour}.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false
= f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label
= f.input :setting_boost_modal, as: :boolean, wrapper: :with_label

+ 6
- 0
config/initializers/locale.rb View File

@ -0,0 +1,6 @@
# frozen_string_literal: true
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'flavours', '*', 'names.{rb,yml}').to_s]
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'flavours', '*', 'names', '*.{rb,yml}').to_s]
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'skins', '*', '*', 'names.{rb,yml}').to_s]
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'skins', '*', '*', 'names', '*.{rb,yml}').to_s]

Loading…
Cancel
Save