From ad184fbfc9f77680a978900c331ad1f739011f6c Mon Sep 17 00:00:00 2001 From: Simon Eskildsen Date: Fri, 30 Aug 2013 12:31:17 -0400 Subject: [PATCH] Remove superplus translations --- lib/liquid/i18n.rb | 4 ++-- lib/liquid/locales/en.yml | 5 ----- lib/liquid/template.rb | 2 +- test/liquid/i18n_test.rb | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/liquid/i18n.rb b/lib/liquid/i18n.rb index 0404c01..3ae5445 100644 --- a/lib/liquid/i18n.rb +++ b/lib/liquid/i18n.rb @@ -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 diff --git a/lib/liquid/locales/en.yml b/lib/liquid/locales/en.yml index f2c5419..a6ce935 100644 --- a/lib/liquid/locales/en.yml +++ b/lib/liquid/locales/en.yml @@ -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]" diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb index a596bf8..1f2bfd1 100644 --- a/lib/liquid/template.rb +++ b/lib/liquid/template.rb @@ -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 diff --git a/test/liquid/i18n_test.rb b/test/liquid/i18n_test.rb index 23f6fdc..1042ac0 100644 --- a/test/liquid/i18n_test.rb +++ b/test/liquid/i18n_test.rb @@ -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