Remove superplus translations

This commit is contained in:
Simon Eskildsen
2013-08-30 12:31:17 -04:00
parent 380828f807
commit ad184fbfc9
4 changed files with 4 additions and 9 deletions

View File

@@ -25,14 +25,14 @@ module Liquid
private
def interpolate(name, vars)
name.gsub(/%{(\w+)}/) {
raise TranslationError, translate("errors.i18n.undefined_interpolation", :key => $1, :name => name) unless vars[$1.to_sym]
raise TranslationError, "Undefined key #{$1} for interpolation in translation #{name}" unless vars[$1.to_sym]
"#{vars[$1.to_sym]}"
}
end
def deep_fetch_translation(name)
name.split('.').reduce(locale) do |level, cur|
level[cur] or raise TranslationError, translate("errors.i18n.unknown_translation", :name => name)
level[cur] or raise TranslationError, "Translation for #{name} does not exist in locale #{path}"
end
end
end

View File

@@ -1,10 +1,5 @@
---
errors:
i18n:
unknown_translation: "Translation for :name does not exist in locale"
undefined_interpolation: "Undefined key :key for interpolation in translation :name"
template:
argument_hash_or_context: "Expect Hash or Liquid::Context as parameter"
syntax:
assign: "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"
capture: "Syntax Error in 'capture' - Valid syntax: capture [var]"

View File

@@ -123,7 +123,7 @@ module Liquid
when nil
Context.new(assigns, instance_assigns, registers, @rethrow_errors, @resource_limits)
else
raise ArgumentError, registers[:locale].translate("errors.template.argument_hash_or_context")
raise ArgumentError, "Expected Hash or Liquid::Context as parameter"
end
case args.last

View File

@@ -4,7 +4,7 @@ class I18nTest < Test::Unit::TestCase
include Liquid
def setup
@i18n = I18n.new fixture("en_locale.yml")
@i18n = I18n.new(fixture("en_locale.yml"))
end
def test_simple_translate_string