Module | Gibberish::Localize |
In: |
lib/gibberish_db.rb
|
# File lib/gibberish_db.rb, line 128 128: def create_translation(string, key, *args) 129: format = args.first.delete(:format) if args.first.is_a?(Hash) 130: format ||= :inline 131: returning Translation.create(:value => string, 132: :key => key.to_s, 133: :language_id => Language.find_cached_by_name(current_language).id, 134: :format => format.to_s) do |translation| 135: RAILS_DEFAULT_LOGGER.warn "Failed to create translation: #{translation.errors.full_messages}" unless translation.errors.empty? 136: end 137: end
# File lib/gibberish_db.rb, line 122 122: def load_languages_with_db! 123: Language.find(:all).each do |lang| 124: @@languages[lang.name.to_sym] = Translator.new(lang) 125: end 126: end