Hello Oscar, If you need some expertise, I can be part of the working group.
The document is a good start but there are some controversial and incorrect parts: 1. The message argument description should not specify that it is the text to translate. In fact, it is an ID to find the translation for. The ID could be message itself or just an ID. In Yii 2 we're using message itself that is, as well, used as a fallback in case translation isn't there. In Java it's common to use dot-separated IDs instead of real messages. 2. "The text to translate (in singular)" for plurals should not mention that it's in the singular. Different implementations may use different strings as message IDs. 3. It's stated that Yii doesn't have a way to handle plurals but in fact, it has one of the most advanced message translation layers that includes plurals support: https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n#plural 4. The current interface is limiting usage in a bad way forcing you to concatenate the final message from many parts by not including an argument for passing parameters. It is extremely inconvenient to be limited to static messages without placeholders. 5. There could be multiple plurals in the message. Instead, I'd suggest a single method for the interface: public function translate($message, $parameters = [], $context = null); This way it covers regular messages: translate('Hello!') Plurals: translate('{n} cats', ['n' => 10]) Parameter replacing: translate('Hello, {username}! Thank you for participating in {eventname}.', ['username' => 'Oscar', 'eventname' => 'PHP-FIG meeting']) etc. On Sunday, March 31, 2019 at 12:42:02 PM UTC+3, Oscar Otero wrote: > > I did suggest something like that some time ago, but it did not gain > enough interest. > There’s my initial proposal: > https://gist.github.com/oscarotero/33e3af8741045c2a1a5a89310571cbdb > > I’d happy if anyone want to work on this spec. > > > El 31 mar 2019, a las 3:57, Navarr Barnier <[email protected] > <javascript:>> escribió: > > I feel like this would be a good idea, for managing the backend of getting > the translations. > > For formatting there's something native in PHP > > -- > You received this message because you are subscribed to the Google Groups > "PHP Framework Interoperability Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] <javascript:> > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/php-fig/1fdfacc8-d59b-4b7e-9040-ea936e4f3a4c%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/51d20706-007e-48fb-88e8-c89f67b98768%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
