diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index 95c1434d3d0d0be58a17972bdab798dc7af51df8..6408d933ce329c1f0675f330cf1839f078981fa2 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -24,6 +24,7 @@ class Admin::ApplicationController < ApplicationController def set_locale return unless current_user - # I18n.locale = current_user.locale + return unless current_user.language + I18n.locale = current_user.language.iso_code end end diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index ae95702de099a20e3aed7b67653790026653cb92..d46e205911946091a78f617db102c954fc5e13dd 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -6,7 +6,7 @@ <th><%= User.human_attribute_name('email') %></th> <th><%= User.human_attribute_name('first_name') %></th> <th><%= User.human_attribute_name('last_name') %></th> - <th><%= User.human_attribute_name('role') %></th> + <th><%= User.human_attribute_name('language') %></th> <th></th> </tr> </thead> @@ -16,7 +16,7 @@ <td><%= link_to user.email, [:admin, user] %></td> <td><%= user.first_name %></td> <td><%= user.last_name %></td> - <td><%= user.role %></td> + <td><%= user.language %></td> <td class="text-end"> <%= edit_link user %> <%= destroy_link user %> diff --git a/config/application.rb b/config/application.rb index 57b2e3cc52d6f4f5f92400c0d98a76f586551a2b..f74a7f0d7874db791f42d3794b3dd12cb7104e34 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,7 +31,7 @@ module Osuny config.sass.preferred_syntax = :sass - config.i18n.available_locales = [:fr] + config.i18n.available_locales = [:fr, :en] config.i18n.default_locale = :fr config.i18n.load_path += Dir["#{Rails.root.to_s}/config/locales/**/*.yml"] diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000000000000000000000000000000000000..f4d0070fcdad14e495b154e39835e127751431f8 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,41 @@ +en: + true: Yes + false: No + home: Home + dashboard: Dashboard + show: Show + create: Create + edit: Edit + delete: Delete + please-confirm: Are you sure? + activerecord: + models: + university: + one: University + other: Universities + language: + one: Language + other: Languages + user: + one: User + other: Users + attributes: + university: + name: Name + address: Address + zipcode: Zipcode + city: City + country: Country + private: Private + public_or_private: Public/private + public: Public + private: Private + user: + email: Email + first_name: First name + last_name: Last name + role: Role + researcher: Researcher profile + language: Favourite language + simple_form: + hints: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ccc4744ce2b87ebc3957a6cd10430c0271219f06..fa229b932d611041cf279aacb444fc8aed520e62 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -36,5 +36,6 @@ fr: last_name: Nom role: Rôle researcher: Profil de chercheur + language: Langue préférée simple_form: hints: