ruby-i18n / i18n

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

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

Closed fatkodima closed 1 year ago

fatkodima commented 1 year ago

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

radar commented 1 year ago

Thank you very much :)

mjankowski commented 8 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 8 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?