diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-07-18 17:10:31 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-07-18 17:43:26 +0100 |
commit | bc0a6d54c4e5f3673a761ca434c49cbfebb89b09 (patch) | |
tree | ac7165739b51316122040be55d8ed5561f440ddf /lib | |
parent | 9fe48c5b9db1c0ba6c1a59f0d092c88e5cae1aa0 (diff) |
Extract code for setting locales in FastGettext and I18n
Diffstat (limited to 'lib')
-rw-r--r-- | lib/alaveteli_localization.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/alaveteli_localization.rb b/lib/alaveteli_localization.rb new file mode 100644 index 000000000..25de002c4 --- /dev/null +++ b/lib/alaveteli_localization.rb @@ -0,0 +1,13 @@ +class AlaveteliLocalization + class << self + def set_locales(available_locales, default_locale) + # fallback locale and available locales + available_locales = available_locales.split(/ /) + FastGettext.default_available_locales = available_locales + I18n.locale = default_locale + I18n.available_locales = available_locales.map { |locale_name| locale_name.to_sym } + I18n.default_locale = default_locale + end + + end +end |