Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ICU message format and curly braces #37797

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

Closed
umulmrum opened this issue Aug 11, 2020 · 2 comments
Closed

ICU message format and curly braces #37797

umulmrum opened this issue Aug 11, 2020 · 2 comments

Comments

@umulmrum
Copy link
Contributor

umulmrum commented Aug 11, 2020

Symfony version(s) affected: Tested on 5.1.3, but most likely in previous versions.

Description
This issue was reported before in #36461 but was closed too early I think. The documentation says in https://symfony.com/doc/current/translation/message_format.html that in ICU format, placeholders should be enclosed in curly braces, and that those will be removed by the translator. But this isn't the case, the curly braces are still there in the resulting message.

How to reproduce
Follow the example in the linked doc.

Possible Solution
Either the docs are right, then this is a bug and the curly braces should be removed. Or the docs need to be adjusted.
edit: I just checked the example from the "Selecting Different Messages Based on a Condition" section. There the curly braces are indeed removed from e.g. female {{organizer_name} has invited you for her party!} (called the translator passing organizer_name, not {organizer_name} and no braces are output). So for consistency (and simplicity) reasons it would be great if curly braces were removed in all cases.

@wouterj
Copy link
Member

wouterj commented Aug 11, 2020

I don't really understand what this issue is trying to say. Curly braces aren't removed, they are just indicators of different "message scopes" (e.g. the verbatim scope, the variable scope, the action scope, etc). Just like {{ ... }} and {% ... %} in Twig.

@umulmrum
Copy link
Contributor Author

What I was trying to say was that I had the same issue as the commenter here: #36461 (comment)

But I just retried and to my surprise the problem vanished. I honestly don't know what changed in the meantime (maybe I used the messages domain before instead of messages+intl-icu - the docs are a bit short on how to use the Translation component without framework bundle).

Sorry for the false alert and thanks for taking time for answering.

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

No branches or pull requests

4 participants