lib/i18n-spec/models/locale_file.rb in i18n-spec-0.2.2 vs lib/i18n-spec/models/locale_file.rb in i18n-spec-0.2.3
- old
+ new
@@ -64,9 +64,13 @@
def is_named_like_top_level_namespace?
translations.keys.first == File.basename(@filepath, File.extname(@filepath))
end
+ def has_a_valid_locale?
+ ISO::Tag.new(translations.keys.first).valid?
+ end
+
protected
def flatten_tree(data, prefix = '', result = {})
data.each do |key, value|
current_prefix = prefix.empty? ? key.to_s : "#{prefix}.#{key}"