summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--config/application.rb4
-rw-r--r--config/initializers/30-redmine.rb1
-rw-r--r--lib/redmine/i18n.rb5
4 files changed, 7 insertions, 5 deletions
diff --git a/Gemfile b/Gemfile
index 7335c5bd9..cc4531681 100644
--- a/Gemfile
+++ b/Gemfile
@@ -12,7 +12,7 @@ gem "mimemagic"
gem "mail", "~> 2.7.1"
gem "csv", "~> 3.0.1" if RUBY_VERSION < "2.6"
gem "nokogiri", "~> 1.10.0"
-gem "i18n", "~> 0.7.0"
+gem "i18n", "~> 1.5.3"
gem "rbpdf", "~> 1.19.6"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
diff --git a/config/application.rb b/config/application.rb
index d77d37e70..e182fc2b9 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -28,7 +28,9 @@ module RedmineApp
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- I18n.enforce_available_locales = true
+ config.i18n.enforce_available_locales = true
+ config.i18n.fallbacks = true
+ config.i18n.default_locale = 'en'
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
diff --git a/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb
index 698c94e47..bebed4aca 100644
--- a/config/initializers/30-redmine.rb
+++ b/config/initializers/30-redmine.rb
@@ -1,4 +1,3 @@
-I18n.default_locale = 'en'
I18n.backend = Redmine::I18n::Backend.new
# Forces I18n to load available locales from the backend
I18n.config.available_locales = nil
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
index 300fb8b06..cdac4ea77 100644
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -61,7 +61,7 @@ module Redmine
# Localizes the given args with user's language
def lu(user, *args)
lang = user.try(:language).presence || Setting.default_language
- ll(lang, *args)
+ ll(lang, *args)
end
def format_date(date)
@@ -117,8 +117,9 @@ module Redmine
# unless :cache => false option is given
def languages_options(options={})
options = if options[:cache] == false
+ available_locales = ::I18n.backend.available_locales
valid_languages.
- select {|locale| ::I18n.exists?(:general_lang_name, locale)}.
+ select {|locale| available_locales.include?(locale)}.
map {|lang| [ll(lang.to_s, :general_lang_name), lang.to_s]}.
sort_by(&:first)
else