-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translator] Adding support for intl message formatter and decoupling default formatter. #15068
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
Conversation
aitboudad
commented
Jun 22, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #6009, #10152, one item in #11742, #11948 |
License | MIT |
Doc PR | n/a |
af23fd0
to
0d1132c
Compare
ping @symfony/deciders |
*/ | ||
public function format($locale, $id, $number = null, array $arguments = array()) | ||
{ | ||
$pattern = ($number !== null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be on one line, without the parenthesis around the condition and null should be on the left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot can you explain why null should be on the left ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dupuchba in Symfony we use Yoda conditions (https://en.wikipedia.org/wiki/Yoda_conditions)
I see a big issue with this implementation: the symfony formatting and the Intl formatting are totally different, and your implementation expects to choose one of them only. But the whole bundle ecosystem relies on the Symfony formatting (including validation translations in Symfony itself). This means that the only way to use the intl formatter is to stop using any third-party translations (you have to provide them again in the intl format), which does not give us any chance to deprecate the old system in favor of intl formatting (which is indeed much more powerful than the simple transchoice format of Symfony). What I would like to see (if it is possible) is a way to use both formatters in parallels (some messages using the intl format, and other messages using the symfony format), to allow progressive migration. |
0b031d4
to
d3e208c
Compare
@stof well what do you think to add a converter that convet the lagacy message into intl format when the IntlMessageFormatter was chosen ? |
Well, if such conversion is possible, it would be a great news for the migration to the intl format. but the implementation needs to be careful to be able to load files providing both. However, if we want to switch to the IntlMessageFormatter (which seems a good idea to me), we would need to provide a stub implementation of the IntlMessageFormatter to avoid the hard dependency on intl just for that (and this stub implementation should probably be able to support rules for any locale, like our existing MessageSelector, not only for en, otherwise we would still rely on intl) |
d3e208c
to
973eac2
Compare
599dfcf
to
d6335b4
Compare
@stof I added |
d6335b4
to
42a69ec
Compare
210c7a9
to
4f20f58
Compare
… default formatter.
4f20f58
to
86189f6
Compare
86189f6
to
49dbc6a
Compare
@symfony/deciders is there anyone interested to provide a stub implementation of the IntlMessageFormatter ? |