I translated my active admin menu :
# encoding: utf-8
ActiveAdmin.register City do
menu :parent => "Données géographiques", :label => I18n.t(:cities)
end
In my active_admin.fr.yml :
fr:
active_admin:
dashboard: "Tableau de Bord"
dashboard_welcome:
welcome: "Bienvenue dans Active Admin. Ceci est la page par défaut."
call_to_action: "Pour ajouter des sections au tableau de bord, consultez 'app/admin/dashboards.rb'"
cities: "Villes"
In my local (debian 6) everything works fine, but on my pre-production (debian 6), it's writter :
translation missing: fr.cities
I tried to reboot apache, clear cache, reload I18n... I failed.
Any idea?
This worked for me:
config.after_initialize do
I18n.reload!
end
I found the solution, you have to write that on your application.rb :
config.before_configuration do
I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
I18n.locale = :fr
I18n.default_locale = :fr
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
config.i18n.locale = :fr
# bypasses rails bug with i18n in production\
I18n.reload!
config.i18n.reload!
end
config.i18n.locale = :fr
config.i18n.default_locale = :fr
Reboot apache and that's good!
I found the solution, add this in application.rb
config.before_configuration do # FIX conflict I18n ActiveAdmin
I18n.load_path += Dir[Rails.root.join('config', 'locales', '*.{rb,yml}').to_s]
I18n.locale = I18n.default_locale = config.i18n.default_locale
I18n.reload!
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With