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

[11.X] Fix 0 being treated as falsey when making translation replacements #53193

Closed

Conversation

mpstenson
Copy link

Was working with a json language string formatted as:

{
     "lg_cal_fdow": "0",
}

When I ran tinker and gave it the language tag __("lg_cal_fdow") the returned value was "lg_cal_fdow" instead of 0. This was occurring because the Elvis operator ?: considers 0 to be falsely. This fix checks for null directly.

@taylorotwell
Copy link
Member

I worry this could break applications that rely on this behavior for empty strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants