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

[BUG] Breaking change in v1.13.0, strings are now being returned frozen #658

Open
jcw- opened this issue May 19, 2023 · 3 comments
Open

Comments

@jcw-
Copy link

jcw- commented May 19, 2023

What I tried to do

Invoked I18n.t

What I expected to happen

An unfrozen string to be returned (like in v1.12.0)

What actually happened

A frozen string was returned

Versions of i18n, rails, and anything else you think is necessary

i18n: v1.13.0
Rails: 6.0.6.1
Translations: In a yml file

The issue is the conditional return statement introduced in this commit: be2f3a0

The prior version would always return the result of gsub, which has the effect of "unfreezing" a frozen string. By adding a code path where the original string can be returned, the frozen string loaded from the yaml can now be returned.

image

Workaround: For now, we will version pin to the prior version, v1.12.0

@bboerkoel
Copy link

If you use gettext_i18n_rails you can update that to version 1.10.1+, then it's fixed by: grosser/gettext_i18n_rails#196

Easiest way to fix this for v1.13.0 might be to add a .dup since it doesn't copy the attributes. Or more explicitely withclone(freeze: false)

interpolated ? interpolated_string : string.dup

@mfechner
Copy link

mfechner commented Jun 2, 2023

Thanks, I tried this fix and it solves a problem with gitlab which stops working on some pages if i18n 1.13.0 is installed.

@kbrock
Copy link
Contributor

kbrock commented Jun 2, 2023

alternatively, can you just always return interpolated_string?

Can you provide a test to reproduce?

(I'm not a committer, so feel free to ignore my suggestions)

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jun 6, 2023
With version v1.13.0 code was changed that returns a frozen string.
This breaks e.g. gitlab-ce on some pages.
Geoffrey Mainland (mainland@apeiron.net) pointed to the issue
logged upstream:
ruby-i18n/i18n#658

PR:		271420
PR:		271356
Approved by:	sunpoet (maintainer)
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

No branches or pull requests

4 participants