8
app/helpers/locales_helper.rb
Normal file
8
app/helpers/locales_helper.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
module LocalesHelper
|
||||
|
||||
def name_for_locale(locale)
|
||||
default = I18n.t("locale", locale: locale)
|
||||
I18n.backend.translate(locale, "i18n.language.name", default: default)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -8,7 +8,7 @@
|
||||
<% I18n.available_locales.map do |loc| %>
|
||||
<option <%= "selected" if loc == I18n.locale %>
|
||||
value="<%= current_path_with_query_params(locale: loc) %>">
|
||||
<%= I18n.t("locale", locale: loc) %>
|
||||
<%= name_for_locale(loc) %>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
@@ -20,10 +20,8 @@ module Consul
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
config.i18n.default_locale = :es
|
||||
|
||||
config.i18n.available_locales = [:en, :es]
|
||||
|
||||
# Add the new directories to the locales load path
|
||||
config.i18n.available_locales = [:en, :es, :fr, 'pt-BR']
|
||||
config.i18n.fallbacks = {'fr' => 'es', 'pt-br' => 'es'}
|
||||
|
||||
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
||||
|
||||
@@ -44,7 +42,6 @@ module Consul
|
||||
config.autoload_paths << "#{Rails.root}/app/models/custom"
|
||||
config.paths['app/views'].unshift(Rails.root.join('app', 'views', 'custom'))
|
||||
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'custom', '*.{rb,yml}')]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# The "main" locale.
|
||||
base_locale: en
|
||||
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
|
||||
# locales: [es, fr]
|
||||
locales: [en, es]
|
||||
## Reporting locale, default: en. Available: en, ru.
|
||||
# internal_locale: en
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
---
|
||||
pt-BR:
|
||||
i18n:
|
||||
language:
|
||||
name: Português
|
||||
account:
|
||||
show:
|
||||
change_credentials_link: Alterar meus dados pessoais
|
||||
Reference in New Issue
Block a user