mirror of
https://github.com/kemko/liquid.git
synced 2026-01-10 20:15:44 +03:00
Remove superplus translations
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user