lib/liquid/i18n.rb in locomotivecms-liquid-2.6.0 vs lib/liquid/i18n.rb in locomotivecms-liquid-4.0.0.alpha
- old
+ new
@@ -4,11 +4,11 @@
class I18n
DEFAULT_LOCALE = File.join(File.expand_path(File.dirname(__FILE__)), "locales", "en.yml")
class TranslationError < StandardError
end
-
+
attr_reader :path
def initialize(path = DEFAULT_LOCALE)
@path = path
end
@@ -29,10 +29,10 @@
"#{vars[$1.to_sym]}"
}
end
def deep_fetch_translation(name)
- name.split('.').reduce(locale) do |level, cur|
+ name.split('.'.freeze).reduce(locale) do |level, cur|
level[cur] or raise TranslationError, "Translation for #{name} does not exist in locale #{path}"
end
end
end
end