ruby-i18n / i18n

Internationalization (i18n) library for Ruby
MIT License
986 stars 411 forks source link

Raise when translated entry contains interpolations for reserved keywords and no substitutions provided #678

Closed fatkodima closed 11 months ago

fatkodima commented 11 months ago

Fixes https://github.com/rails/rails/issues/49879.

radar commented 11 months ago

Thank you very much :)

mjankowski commented 7 months ago

Opened this issue on i18n-tasks - https://github.com/glebm/i18n-tasks/issues/552 - linking here only because it's related to this feature and maybe others will stumble across same error and find that helpful. I don't think anything to do about it on the i18n side.

mjankowski commented 7 months ago

Actually -- curious on this ... should this check raise on an escaped interpolation variable?

My understanding here is that we want to discourage usage of the reserved keyword values, so raising makes sense because it will bring that issue to attention sooner. So a string like "This uses the %{default} reserved word" should raise immediately. But what about a string like "This uses the escaped %%{default} word" ... should that also raise, or is that safe to output as a literal string and the reserved word check should not raise for escaped values?