I'm running into a problem with the __
function, and I'm not sure whether it's a bug in Cake (3.2.8), Aura\Intl, or my code. I've tried the same thing in Cake 1.3, and it works as I expect it to, but it's possible that my expectations are simply that way because that's how it worked in 1.3. :-)
When I am building my menus, I use things like __('Teams')
, but I also have pages that use things like __n('Team', 'Teams', count($player->teams))
. The i18n shell extracts these into the default.pot separately, so when I translate it to French, it's like this:
msgid "Teams"
msgstr "Équipe"
msgid "Team"
msgid_plural "Teams"
msgstr[0] "Équipe"
msgstr[1] "Équipes"
If I call __('Team')
, I correctly get 'Équipe' returned, and if I call __n('Team', 'Teams', $x)
, I correctly get 'Équipe' or 'Équipes' returned, depending on the value of $x
. But if I call __('Teams')
I get back
Array
(
[0] => Équipe
[1] => Équipes
)
This is the case even if I eliminate the msgid "Teams"
section, leaving only the plural definition.
In Cake 1.3, __('Teams')
would simply return 'Équipes'. (Don't know what it might do in 2.x, as I skipped over that entirely.) So, whose bug is this?