Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Documentation is confusing about use of {placeholders} in translations #19593

Open
@php4fan

Description

@php4fan

I was looking at the documentation about translations here:
https://symfony.com/doc/5.x/translation.html#basic-translation

and I was looking for the part about parameters, or should I say placeholders. What I mean with parameters/placeholders is when you have a phrasesomephrase whose translation is"Hello {username} and you call:

$translator->trans('somephrase', ['username' => 'John']) ;

ane the result is"Hello John".

I think those are called Placeholders.

So, the only place where the page above says something about that is here:
https://symfony.com/doc/5.x/translation.html#message-format

To manage these situations, Symfony follows theICU MessageFormat syntax by using PHP'sMessageFormatter class. Read more about this inHow to Translate Messages using the ICU MessageFormat.

So, I follow that link and it says:

In order to use the ICU Message Format, the message domain has to be suffixed with +intl-icu:

and then it explains, among other things, how placeholders work, besides pluralization and other stuff.

This seems to be very clear: in order to use placeholders, as well as pluralization and other features,the message domains has to be suffixed with+intl-icu

However, I have tried using basic translations with placeholders with the default domainmessageswithout any suffix, and placeholders work. I don't know about pluralization and other stuff.

So, the documentation wrongly suggests that, in order to be able to use placeholders, you need to suffix the domain names with that string, but that's not true.

I don't know if that's true for other features such as pluralization; if that's the case, then it's not clear.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp