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

Problem with translating plural forms #76

Closed
zaksmok opened this issue May 21, 2015 · 4 comments
Closed

Problem with translating plural forms #76

zaksmok opened this issue May 21, 2015 · 4 comments

Comments

@zaksmok
Copy link

zaksmok commented May 21, 2015

Hello. I've got .po file created with poEdit with translated plural form (http://pastebin.com/6YvDx6gY).

Using translation function "echo ('dragon');" works fine but plural translations like "echo n('%s apple', '%s apples', 1);" or "echo n__('%s apple', '%s apples', 2);" gives "%s jabłko" and "%s jabłek".

So translation is good but dynamic value %s is not set,

I cannot figure out what I'm doing wrong. Can you help me?

@mlocati
Copy link
Member

mlocati commented May 21, 2015

Try with n__('%s apple', '%s apples', 2, 2);: does it work?

@zaksmok
Copy link
Author

zaksmok commented May 21, 2015

yes it works. But why i have to double $value?

@mlocati
Copy link
Member

mlocati commented May 21, 2015

n__('%s apple', '%s apples', 2) gives you the correct plural translated string for 2 apples.
Further arguments (after the third), if specified, are used in a sprintf function to put these values to the translated string.

@zaksmok
Copy link
Author

zaksmok commented May 21, 2015

i see, thank you for response. Have a great day!

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

3 participants