Skip to content

Commit

Permalink
Merge branch 'master' of github.com:svenfuchs/i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Feb 27, 2011
2 parents 21d251b + 1c53c5d commit 1b3e434
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ vendor/**/*
*.swp
pkg
.bundle
.rvmrc
2 changes: 1 addition & 1 deletion lib/i18n/backend/fallbacks.rb
Expand Up @@ -54,7 +54,7 @@ def translate(locale, key, options = {})
end

def extract_string_or_lambda_default!(options)
defaults = Array(options[:default])
defaults = [options[:default]].flatten
if index = find_first_string_or_lambda_default(defaults)
options[:default] = defaults[0, index]
defaults[index]
Expand Down
4 changes: 4 additions & 0 deletions test/backend/fallbacks_test.rb
Expand Up @@ -65,6 +65,10 @@ def setup
assert_raise(I18n::MissingTranslationData) { I18n.t(:faa, :locale => :en, :raise => true) }
assert_raise(I18n::MissingTranslationData) { I18n.t(:faa, :locale => :de, :raise => true) }
end

test "should ensure that default is not splitted on new line char" do
assert_equal "Default \n Bar", I18n.t(:missing_bar, :default => "Default \n Bar")
end
end

class I18nBackendFallbacksLocalizeTest < Test::Unit::TestCase
Expand Down

0 comments on commit 1b3e434

Please sign in to comment.