class Stringex::Localization::Backend::Internal
Constants
- DEFAULT_LOCALE
Public Class Methods
Source
# File lib/stringex/localization/backend/internal.rb 16 def default_locale 17 @default_locale || DEFAULT_LOCALE 18 end
Source
# File lib/stringex/localization/backend/internal.rb 20 def default_locale=(new_locale) 21 @default_locale = @locale = new_locale.to_sym 22 end
Source
# File lib/stringex/localization/backend/internal.rb 40 def initial_translation(scope, key, locale) 41 translations[locale][scope][key.to_sym] 42 end
Source
# File lib/stringex/localization/backend/internal.rb 8 def locale 9 @locale || default_locale 10 end
Source
# File lib/stringex/localization/backend/internal.rb 12 def locale=(new_locale) 13 @locale = new_locale.to_sym 14 end
Source
# File lib/stringex/localization/backend/internal.rb 36 def store_translations(locale, scope, data) 37 self.translations[locale.to_sym][scope.to_sym] = Hash[data.map { |k, v| [k.to_sym, v] }] # Symbolize keys 38 end
Source
# File lib/stringex/localization/backend/internal.rb 31 def translations 32 # Set up hash like translations[:en][:transliterations]["é"] 33 @translations ||= Hash.new { |k, v| k[v] = Hash.new({}) } 34 end
Source
# File lib/stringex/localization/backend/internal.rb 24 def with_locale(new_locale, &block) 25 original_locale = locale 26 self.locale = new_locale 27 yield 28 self.locale = original_locale 29 end