Skip to content
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

Different behavior between gettext and PHP implementation for unknown plural translations #148

Closed
ArthurHoaro opened this issue May 19, 2017 · 1 comment

Comments

@ArthurHoaro
Copy link
Contributor

Note: this is a very minor issue you might not want to fix, but I wanted to report it since I came across it during my wrapper unit tests.

Issue: if the translation is unknown PHP's built-in gettext function will use English plural rules (fallback language) while Translator (translations loaded from PO file) will use the destination language plural rules.

Example:

English > French
French doesn't pluralize zero, while English does.

sandwich is an unknown key but a French translation is loaded

// with GettextTranslator
n__('sandwich', 'sandwiches', 0); // => sandwiches
// with Translator
n__('sandwich', 'sandwiches', 0); // => sandwich
@oscarotero
Copy link
Member

It's interesting. I think we should unify the behaviours between two implementations, so GettextTranslator should be changed to mimic the native gettext.
I don't have enought time these days to face this. Do you want to work in a pull request?

ArthurHoaro added a commit to ArthurHoaro/Gettext that referenced this issue May 20, 2017
If the translation key is unknown, we use the English plural rules, as it is done in PHP gettext extension

Fixes php-gettext#148
oscarotero pushed a commit that referenced this issue May 20, 2017
If the translation key is unknown, we use the English plural rules, as it is done in PHP gettext extension

Fixes #148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants