Index: test/backends/static_test.rb =================================================================== --- test/backends/static_test.rb (revision 16213) +++ test/backends/static_test.rb (working copy) @@ -91,9 +91,9 @@ currency = number_to_currency(10, :format => "%n %u", :unit => '€') assert_equal "10.00 €", currency end - - test "makes sure interpolation does not break even with False as string" do - assert_equal "translation missing: en, support, array, skip_last_comma", I18n.translate(:"support.array.skip_last_comma") + + test "makes sure false boolean values are returned as translated and not missing" do + assert_equal false, I18n.translate(:"support.array.skip_last_comma") end end Index: lib/globalize/backend/static.rb =================================================================== --- lib/globalize/backend/static.rb (revision 16213) +++ lib/globalize/backend/static.rb (working copy) @@ -11,16 +11,19 @@ def translate(locale, key, options = {}) result, default, fallback = nil, options.delete(:default), nil - I18n.fallbacks[locale].each do |fallback| + I18n.fallbacks[locale.to_sym].each do |fallback| begin - result = super(fallback, key, options) and break + result = super(fallback, key, options) # this super is going to activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb + break if !result.nil? rescue I18n::MissingTranslationData end end - result ||= default locale, default, options + result = default locale, default, options if result.nil? attrs = {:requested_locale => locale, :locale => fallback, :key => key, :options => options} - translation(result, attrs) || raise(I18n::MissingTranslationData.new(locale, key, options)) + translated_val = translation(result, attrs) + raise(I18n::MissingTranslationData.new(locale, key, options)) if translated_val.nil? + translated_val end protected @@ -28,13 +31,11 @@ alias :orig_interpolate :interpolate unless method_defined? :orig_interpolate def interpolate(locale, string, values = {}) result = orig_interpolate(locale, string, values) - translation = translation(string) - translation.nil? ? result : translation.replace(result) + [FalseClass, TrueClass, Fixnum, Symbol, NilClass].include?(result.class) ? result : (translation(string).replace result) # the original line failed because rails translation yml files sometimes have boolean values end def translation(result, meta = nil) - return unless result - + return if result.nil? case result when Numeric result @@ -50,6 +51,8 @@ result.map do |value| translation(value, meta) end + when FalseClass, TrueClass, Fixnum, Symbol, NilClass + result else result # raise "unexpected translation type: #{result.inspect}"