Feature #29946 » 0001-Update-i18n-gem-to-1.5.3.patch
| Gemfile | ||
|---|---|---|
| 12 | 12 |
gem "mail", "~> 2.7.1" |
| 13 | 13 |
gem "csv", "~> 3.0.1" if RUBY_VERSION >= "2.3" && RUBY_VERSION < "2.6" |
| 14 | 14 |
gem "nokogiri", (RUBY_VERSION >= "2.3" ? "~> 1.10.0" : "~> 1.9.1") |
| 15 |
gem "i18n", "~> 0.7.0"
|
|
| 15 |
gem "i18n", "~> 1.5.3"
|
|
| 16 | 16 |
gem "rbpdf", "~> 1.19.6" |
| 17 | 17 | |
| 18 | 18 |
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem |
| config/application.rb | ||
|---|---|---|
| 28 | 28 |
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
| 29 | 29 |
# config.i18n.default_locale = :de |
| 30 | 30 | |
| 31 |
I18n.enforce_available_locales = true |
|
| 31 |
config.i18n.enforce_available_locales = true |
|
| 32 |
config.i18n.fallbacks = true |
|
| 33 |
config.i18n.default_locale = 'en' |
|
| 32 | 34 | |
| 33 | 35 |
# Configure the default encoding used in templates for Ruby 1.9. |
| 34 | 36 |
config.encoding = "utf-8" |
| config/initializers/30-redmine.rb | ||
|---|---|---|
| 1 |
I18n.default_locale = 'en' |
|
| 2 | 1 |
I18n.backend = Redmine::I18n::Backend.new |
| 3 | 2 |
# Forces I18n to load available locales from the backend |
| 4 | 3 |
I18n.config.available_locales = nil |
| lib/redmine/i18n.rb | ||
|---|---|---|
| 61 | 61 |
# Localizes the given args with user's language |
| 62 | 62 |
def lu(user, *args) |
| 63 | 63 |
lang = user.try(:language).presence || Setting.default_language |
| 64 |
ll(lang, *args)
|
|
| 64 |
ll(lang, *args) |
|
| 65 | 65 |
end |
| 66 | 66 | |
| 67 | 67 |
def format_date(date) |
| ... | ... | |
| 117 | 117 |
# unless :cache => false option is given |
| 118 | 118 |
def languages_options(options={})
|
| 119 | 119 |
options = if options[:cache] == false |
| 120 |
available_locales = ::I18n.backend.available_locales |
|
| 120 | 121 |
valid_languages. |
| 121 |
select {|locale| ::I18n.exists?(:general_lang_name, locale)}.
|
|
| 122 |
select {|locale| available_locales.include?(locale)}.
|
|
| 122 | 123 |
map {|lang| [ll(lang.to_s, :general_lang_name), lang.to_s]}.
|
| 123 | 124 |
sort_by(&:first) |
| 124 | 125 |
else |
- « Previous
- 1
- 2
- Next »