diff options
author | Ruben Davila <rdavila84@gmail.com> | 2017-05-04 05:05:38 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-05-04 05:08:43 +0300 |
commit | dbd1bdaeed596f14af89d662e73030bb02571cfd (patch) | |
tree | 16712553353aa5f4f43997863357da9fd0347ce9 /lib/gitlab/i18n.rb | |
parent | b7f01f2b18940eb8dc0fa30e8ebbf1784c864304 (diff) |
More updates for translations plus some refactoring.
Diffstat (limited to 'lib/gitlab/i18n.rb')
-rw-r--r-- | lib/gitlab/i18n.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/i18n.rb b/lib/gitlab/i18n.rb index a7addee0dcd..9081ced0238 100644 --- a/lib/gitlab/i18n.rb +++ b/lib/gitlab/i18n.rb @@ -11,5 +11,15 @@ module Gitlab def available_locales AVAILABLE_LANGUAGES.keys end + + def set_locale(current_user) + requested_locale = current_user&.preferred_language || ::I18n.default_locale + locale = FastGettext.set_locale(requested_locale) + ::I18n.locale = locale + end + + def reset_locale + ::I18n.locale = ::I18n.default_locale + end end end |