lib/i18n_screwdriver.rb in i18n_screwdriver-7.0 vs lib/i18n_screwdriver.rb in i18n_screwdriver-7.1
- old
+ new
@@ -106,21 +106,17 @@
raise "Please set I18.available_locales" unless I18n.available_locales.count > 0
I18n.available_locales.map(&:to_s)
end
end
- def self.dummy_text
- "TRANSLATION_MISSING"
- end
-
def self.update_translations_file(locale, translations)
existing_translations = file_with_translations_exists?(locale) ? load_translations(locale) : {}
existing_translations.select!{ |k| translations.has_key?(k) }
translations.each do |k, v|
next if existing_translations[k]
- existing_translations[k] = (default_locale == locale) ? v : dummy_text
+ existing_translations[k] = (default_locale == locale) ? v : nil
end
write_translations(locale, existing_translations)
end
@@ -129,10 +125,11 @@
hash.each{ |k, v| new_hash[k.to_s] = v.to_s }
end
end
def self.translate(string, options = {})
- I18n.translate(generate_key(string), options)
+ translation = I18n.translate(generate_key(string), options)
+ translation.present? ? translation : "TRANSLATION_MISSING"
end
def self.extract_text(string)
namespace, text = string.split("|", 2)
text ? text : namespace