mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Remove superplus translations
This commit is contained in:
+2
-2
@@ -25,14 +25,14 @@ module Liquid
|
|||||||
private
|
private
|
||||||
def interpolate(name, vars)
|
def interpolate(name, vars)
|
||||||
name.gsub(/%{(\w+)}/) {
|
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]}"
|
"#{vars[$1.to_sym]}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def deep_fetch_translation(name)
|
def deep_fetch_translation(name)
|
||||||
name.split('.').reduce(locale) do |level, cur|
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
---
|
---
|
||||||
errors:
|
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:
|
syntax:
|
||||||
assign: "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"
|
assign: "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"
|
||||||
capture: "Syntax Error in 'capture' - Valid syntax: capture [var]"
|
capture: "Syntax Error in 'capture' - Valid syntax: capture [var]"
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ module Liquid
|
|||||||
when nil
|
when nil
|
||||||
Context.new(assigns, instance_assigns, registers, @rethrow_errors, @resource_limits)
|
Context.new(assigns, instance_assigns, registers, @rethrow_errors, @resource_limits)
|
||||||
else
|
else
|
||||||
raise ArgumentError, registers[:locale].translate("errors.template.argument_hash_or_context")
|
raise ArgumentError, "Expected Hash or Liquid::Context as parameter"
|
||||||
end
|
end
|
||||||
|
|
||||||
case args.last
|
case args.last
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class I18nTest < Test::Unit::TestCase
|
|||||||
include Liquid
|
include Liquid
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@i18n = I18n.new fixture("en_locale.yml")
|
@i18n = I18n.new(fixture("en_locale.yml"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_simple_translate_string
|
def test_simple_translate_string
|
||||||
|
|||||||
Reference in New Issue
Block a user