lib/translate/keys.rb in translate-rails3-0.2.3 vs lib/translate/keys.rb in translate-rails3-0.4.0
- old
+ new
@@ -24,9 +24,18 @@
def i18n_keys(locale)
I18n.backend.send(:init_translations) unless I18n.backend.initialized?
Translate::Keys.to_shallow_hash(I18n.backend.send(:translations)[locale.to_sym]).keys.sort
end
+ def duplicate_keys
+ Translate::Keys.translated_locales.inject({}) do |missing, locale|
+ missing[locale] = i18n_keys(I18n.default_locale).map do |key|
+ I18n.backend.send(:lookup, locale, key) == I18n.backend.send(:lookup, I18n.default_locale, key) ? key : nil
+ end.compact
+ missing
+ end
+ end
+
def untranslated_keys
Translate::Keys.translated_locales.inject({}) do |missing, locale|
missing[locale] = i18n_keys(I18n.default_locale).map do |key|
I18n.backend.send(:lookup, locale, key).nil? ? key : nil
end.compact