lib/i18n_screwdriver.rb in i18n_screwdriver-7.5 vs lib/i18n_screwdriver.rb in i18n_screwdriver-8.0

- old
+ new

@@ -2,12 +2,10 @@ require "i18n_screwdriver/translation" require "i18n_screwdriver/translation_helper" require "i18n_screwdriver/rails" module I18nScrewdriver - DUMMY_TEXT = "TRANSLATION_MISSING" - Error = Class.new(StandardError) def self.filename_for_locale(locale) File.join("config", "locales", "application.#{locale}.yml") end @@ -129,11 +127,12 @@ hash.each{ |k, v| new_hash[k.to_s] = v.to_s } end end def self.translate(string, options = {}) - translation = I18n.translate(generate_key(string), options) - translation.present? ? translation : DUMMY_TEXT + I18n.translate!(generate_key(string), options) + rescue I18n::MissingTranslationData + I18n.translate(string, options) end def self.extract_text(string) namespace, text = string.split("|", 2) text ? text : namespace