-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Rails 4.2.1 breaks if there is a nil and a string in the default translations #19419
Comments
This behavior is documented here in section 4.1.2: http://guides.rubyonrails.org/i18n.html#looking-up-translations |
Yeah, I think I broke it in 90fcfea and I'll try to fix/test this case. |
Workaround for rails/rails#19419
After doing some bisecting, this error was introduced by 362557e. |
Workaround for rails/rails#19419
Strip nils out of default translations. Fixes #19419
Strip nils out of default translations. Fixes #19419
Strip nils out of default translations. Fixes #19419
Workaround for rails/rails#19419
Workaround for rails/rails#19419
Fix rails/rails#19419 for all field labels
I'm wondering why this issue was closed. Is it still considered a regression bug? Was it fixed in a separate PR? I have a problem that looks to be related to this. We had some code that uses class NestedArrayTest
include ActionView::Helpers::TranslationHelper
def translate(key, options = {})
default = super
super(key, options.merge(scope: "this.does.not.exist", default: [[]]))
end
alias_method :t, :translate
end
class SimpleArrayTest
include ActionView::Helpers::TranslationHelper
def translate(key, options = {})
default = super
super(key, options.merge(scope: "this.does.not.exist", default: []))
end
alias_method :t, :translate
end # pre-4.2.1
NestedArrayTest.new.translate("lol") #=> []
SimpleArrayTest.new.translate("lol") #=> translation missing <span>
# 4.2.1
NestedArrayTest.new.translate("lol") #=> translation missing <span>
SimpleArrayTest.new.translate("lol") #=> translation missing <span> |
@aprescott see #19421 |
Ah, thanks! It looks like my problem still exists. I'll open a PR/issue if it's still broken on |
In rails 4.2.0 I could do this:
and if
:"try_this"
and:"how_about.this"
are not found in the locale file, then"Finally this"
would be returned.In Rails 4.2.1 I get:
The text was updated successfully, but these errors were encountered: