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

$.i18n.Tr should not output fallback strings in production mode #12579

Closed
silverwind opened this issue Aug 23, 2020 · 4 comments
Closed

$.i18n.Tr should not output fallback strings in production mode #12579

silverwind opened this issue Aug 23, 2020 · 4 comments

Comments

@silverwind
Copy link
Member

silverwind commented Aug 23, 2020

Extracted from #12564

If an invalid translation key is passed, the function will render strings like signing.wont_sign.%!s(<nil>) into HTML which is ugly. We should only do that when gitea is in development mode, otherwise output empty string only.

@wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf
Copy link
Contributor

I believe #12581 solves this in a way..

@silverwind
Copy link
Member Author

The PR solves that one case but similar cases can pop up somewhere else anytime.

@wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf
Copy link
Contributor

The PR solves that one case but similar cases can pop up somewhere else anytime.

That's true.
Sorry, my bad 🙈

@wxiaoguang
Copy link
Contributor

The fallback string should always be outputed, otherwise users would see nothing and know nothing, they would report issues like "I see empty UI", which is worse than reporting the invalid translation key.

And the i18n module has been refactored recently.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants