mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 07:46:17 +01:00
Removes custom backend @Redmine::I18n::Backend@ (#42859):
* move custom logic to get the available locales by looking at translation file names to @config.i18n.available_locales@ option. * remove unnecessary fallback include which does the same thing as @config.i18n.fallbacks = true@. * include custom pluralization rules as Rails suggests. git-svn-id: https://svn.redmine.org/redmine/trunk@23830 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -173,22 +173,5 @@ module Redmine
|
||||
def current_language
|
||||
::I18n.locale
|
||||
end
|
||||
|
||||
# Custom backend based on I18n::Backend::Simple with the following changes:
|
||||
# * available_locales are determined by looking at translation file names
|
||||
class Backend < ::I18n::Backend::Simple
|
||||
# Get available locales from the translations filenames
|
||||
def available_locales
|
||||
@available_locales ||= begin
|
||||
redmine_locales = Dir[Rails.root / 'config' / 'locales' / '*.yml'].map { |f| File.basename(f, '.yml').to_sym }
|
||||
super & redmine_locales
|
||||
end
|
||||
end
|
||||
|
||||
# Adds custom pluralization rules
|
||||
include ::I18n::Backend::Pluralization
|
||||
# Adds fallback to default locale for untranslated strings
|
||||
include ::I18n::Backend::Fallbacks
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user