# File lib/stringex/localization/backend/internal.rb, line 16 def default_locale @default_locale || DEFAULT_LOCALE end
# File lib/stringex/localization/backend/internal.rb, line 20 def default_locale=(new_locale) @default_locale = @locale = new_locale.to_sym end
# File lib/stringex/localization/backend/internal.rb, line 40 def initial_translation(scope, key, locale) translations[locale][scope][key.to_sym] end
# File lib/stringex/localization/backend/internal.rb, line 8 def locale @locale || default_locale end
# File lib/stringex/localization/backend/internal.rb, line 12 def locale=(new_locale) @locale = new_locale.to_sym end
# File lib/stringex/localization/backend/internal.rb, line 36 def store_translations(locale, scope, data) self.translations[locale.to_sym][scope.to_sym] = Hash[data.map { |k, v| [k.to_sym, v] }] # Symbolize keys end
# File lib/stringex/localization/backend/internal.rb, line 31 def translations # Set up hash like translations[:en][:transliterations]["é"] @translations ||= Hash.new { |k, v| k[v] = Hash.new({}) } end
# File lib/stringex/localization/backend/internal.rb, line 24 def with_locale(new_locale, &block) original_locale = locale self.locale = new_locale yield self.locale = original_locale end