Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default: nil with fallbacks #387

Merged
merged 1 commit into from Oct 10, 2017

Conversation

@daniel-rikowski
Copy link

@daniel-rikowski daniel-rikowski commented Oct 10, 2017

Fixes #386

Daniel Rikowski
@radar
radar approved these changes Oct 10, 2017
Copy link
Collaborator

@radar radar left a comment

Looks great to me. Thanks for fixing this bug and cleaning up the code.

@radar radar added this to the 0.9.0 milestone Oct 10, 2017
@radar radar merged commit 2ae3b70 into ruby-i18n:master Oct 10, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@radar
Copy link
Collaborator

@radar radar commented Oct 10, 2017

This will go out in the 0.9.0 release, probably next week or week after.

@rafaelfranca
Copy link
Contributor

@rafaelfranca rafaelfranca commented Oct 26, 2017

This change introduce a regression. Here is the regression test:

diff --git a/test/backend/fallbacks_test.rb b/test/backend/fallbacks_test.rb
index 23e4713..a220c03 100644
--- a/test/backend/fallbacks_test.rb
+++ b/test/backend/fallbacks_test.rb
@@ -64,6 +64,10 @@ class I18nBackendFallbacksTranslateTest < I18n::TestCase
     assert_nil I18n.t(:missing_bar, :locale => :'de-DE', :default => nil)
   end
 
+  test "returns the translation missing message if the default is also missing" do
+    assert_equal 'translation missing: de-DE.missing_bar', I18n.t(:missing_bar, :locale => :'de-DE', :default => [:missing_baz])
+  end
+
   test "returns the :'de-DE' default :baz translation for a missing :'de-DE' when defaults contains Symbol" do
     assert_equal 'Baz in :de-DE', I18n.t(:missing_foo, :locale => :'de-DE', :default => [:baz, "Default Bar"])
   end
@rafaelfranca
Copy link
Contributor

@rafaelfranca rafaelfranca commented Oct 26, 2017

Failure message:

  1) Failure:
I18nBackendFallbacksTranslateTest#test_returns_the_translation_missing_message_if_the_default_is_also_missing [/Users/rafaelfranca/src/github/i18n/test/backend/fallbacks_test.rb:68]:
--- expected
+++ actual
@@ -1 +1 @@
-"translation missing: de-DE.missing_bar"
+"translation missing: de-DE.no key"
@rafaelfranca
Copy link
Contributor

@rafaelfranca rafaelfranca commented Oct 26, 2017

#389 should fix that regression.

radar added a commit to rafaelfranca/i18n that referenced this pull request Nov 2, 2017
When either the key and the all the defaults have missing translation we
should be showing the original key in the translation missing message.

Before this commit we were showing a translation missing error in the
"no key" key.

This commit fixes a regression introduced in ruby-i18n#387.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants