Module: Redmine::I18n::Backend::Implementation
- Includes:
- I18n::Backend::Base, I18n::Backend::Pluralization
- Included in:
- Redmine::I18n::Backend
- Defined in:
- lib/redmine/i18n.rb
Instance Method Summary collapse
-
#available_locales ⇒ Object
Get available locales from the translations filenames.
-
#reload! ⇒ Object
Clean up translations.
-
#store_translations(locale, data, options = {}) ⇒ Object
Stores translations for the given locale in memory.
Instance Method Details
#available_locales ⇒ Object
Get available locales from the translations filenames
157 158 159 |
# File 'lib/redmine/i18n.rb', line 157 def available_locales @available_locales ||= ::I18n.load_path.map {|path| File.basename(path, '.*')}.uniq.sort.map(&:to_sym) end |
#reload! ⇒ Object
Clean up translations
162 163 164 165 166 |
# File 'lib/redmine/i18n.rb', line 162 def reload! @translations = nil @available_locales = nil super end |
#store_translations(locale, data, options = {}) ⇒ Object
Stores translations for the given locale in memory. This uses a deep merge for the translations hash, so existing translations will be overwritten by new ones only at the deepest level of the hash.
149 150 151 152 153 154 |
# File 'lib/redmine/i18n.rb', line 149 def store_translations(locale, data, = {}) locale = locale.to_sym translations[locale] ||= {} data = data.deep_symbolize_keys translations[locale].deep_merge!(data) end |