aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-05-04 14:36:25 +0200
committerRobert2017-05-04 14:36:40 +0200
commita75b51bc9b4112d851a38f0e569565ce2c4602c6 (patch)
treef64a170a35d3890fe8cead449bdb5317a00d1115
parentc697909ed7acedf020c695440cdf44b0332dbb35 (diff)
downloadchouette-core-a75b51bc9b4112d851a38f0e569565ce2c4602c6.tar.bz2
easy change locale for testing and developping translations
-rw-r--r--app/controllers/application_controller.rb5
-rw-r--r--app/views/line_referentials/show.html.slim9
-rw-r--r--config/application.rb2
-rw-r--r--config/locales/line_referentials.en.yml3
-rw-r--r--config/locales/line_referentials.fr.yml3
5 files changed, 17 insertions, 5 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f2c9b4c6f..42b7c2a25 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -12,7 +12,10 @@ class ApplicationController < ActionController::Base
helper LanguageEngine::Engine.helpers
def set_locale
- I18n.locale = session[:language] || I18n.default_locale
+ # I18n.locale = session[:language] || I18n.default_locale
+ # For testing different locales w/o restarting the server
+ I18n.locale = (params['lang'] || session[:language] || I18n.default_locale).to_sym
+ logger.info "locale set to #{I18n.locale.inspect}"
end
def pundit_user
diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim
index 5c0df1a71..7d4067202 100644
--- a/app/views/line_referentials/show.html.slim
+++ b/app/views/line_referentials/show.html.slim
@@ -27,9 +27,12 @@
table.table
thead
tr
- th Synchronisé
- th Statut
- th Message
+ / th Synchronisé
+ th = t('.synchronized')
+ / th Statut
+ th = t('.status')
+ / th Message
+ th = t('.message')
tbody
- @line_referential.line_referential_syncs.each_with_index do |sync, i|
diff --git a/config/application.rb b/config/application.rb
index 8606a3156..6c8de781d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -25,7 +25,7 @@ module ChouetteIhm
# 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 = :fr
+ config.i18n.default_locale = ENV.fetch('RAILS_LOCALE', 'fr').to_sym
# Configure Browserify to use babelify to compile ES6
config.browserify_rails.commandline_options = "-t [ babelify --presets [ react es2015 ] ]"
diff --git a/config/locales/line_referentials.en.yml b/config/locales/line_referentials.en.yml
index 7d84a24f8..78083912d 100644
--- a/config/locales/line_referentials.en.yml
+++ b/config/locales/line_referentials.en.yml
@@ -8,6 +8,9 @@ en:
title: "Edit %{line_referential} referential"
show:
title: "iLICO synchronization"
+ synchronized: Synchronized
+ status: Status
+ message: Message
activerecord:
models:
line_referential:
diff --git a/config/locales/line_referentials.fr.yml b/config/locales/line_referentials.fr.yml
index fe8496d99..c8dfbd640 100644
--- a/config/locales/line_referentials.fr.yml
+++ b/config/locales/line_referentials.fr.yml
@@ -8,6 +8,9 @@ fr:
title: "Editer le référentiel %{line_referential}"
show:
title: 'Synchronisation iLICO'
+ synchronized: Synchronisé
+ status: Statut
+ message: Message
activerecord:
models:
line_referential: