-
Notifications
You must be signed in to change notification settings - Fork 8
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
Consider whether Infrastructure\Service\Translation\Translator should add quotes around placeholders #180
Comments
The counterexample is that in
In this case we would not want quotes (or separate
In other words, in Drupal, |
@effulgentsia, since this involves translatable UI strings, I think it would be a BC breaking change if made, right? I'm tagging it a stable blocker. |
@tedbow, you agreed to look through the Automatic Updates module to see if there's anywhere it's currently displaying Composer Stager string placeholders surrounded by composer-stager/src/Internal/Process/Service/Process.php Lines 101 to 111 in 5055aa2
So
Therefore, wrapping the
And if we wrap it on both ends--with double quotes in Composer Stager and
So the questions are:
|
Consider the following code:
When Drupal's translator is used, then when this message is displayed in the Drupal admin UI to an administrator whose preferred language is English, the message will be:
In other words, since Drupal is a web CMS, Drupal's translator returns HTML, with placeholder values formatted with
<em>
tags.Currently, Composer Stager's Translator just inserts placeholder values with no formatting. In other words, it outputs:
Composer Stager should not assume an HTML display of its messages, so it should not follow Drupal's example of wrapping placeholder values with
<em>
tags, but... perhaps it should wrap them with quotes, so as to output:That would mean prior to
Infrastructure\Service\Translation\Translator
callingreturn $this->symfonyTranslatorProxy->trans(...)
, it would modify $parameters to add quotes around all of them. More importantly, it would mean Composer Stager's Translator having some opinionated implementation, and not just be an un-opinionated wrapper/proxy aroundSymfony\Contracts\Translation\TranslatorTrait
.Is it appropriate and beneficial for Composer Stager's Translator to add the opinionated decision of adding quotes around placeholder values? Personally, I think yes, and that it would both improve the corresponding exception messages, and clarify that the scope of a translator includes not only translating to the desired language but also deciding how to format placeholder values.
The text was updated successfully, but these errors were encountered: