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
Fix plural rule issue with site interface translation #2345
Conversation
I'm not able to reproduce that error. Could you describe every step to get it? |
Thanks. Here is my screen record. |
I did the exact same steps and everything is fine for me. From what I can see, it seems that the system is trying to merge language files with different plural definitions. "Plural-Forms: nplurals=1; plural=0;\n" Could you check that both the PS: if you have only the .mo files, you can decompile them with msgunfmt: msgunfmt --output-file=messages.po messages.mo |
Uploaded generated po/mo files. https://www.dropbox.com/sh/do65wh9rcze9usx/AADlzkh8d0qyM3337Gt95ytZa?dl=0 |
Those files were in the /application/languages/site folder? |
If those files were in the /application/languages/site folder, it seems that they have been generated with a very old version of the composer libraries. Could you try to call |
I've tried to run |
Yes. I downloaded it from Transifex and compiled to .mo. It starts with the correct headers: msgid ""
msgstr ""
...
"Plural-Forms: nplurals=1; plural=0;\n" And also the msgid ""
msgstr ""
...
"Plural-Forms: nplurals=1; plural=0;\n" |
I read your files more in depth, and I noticed that there's an error in the .po files: msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2015-04-28T19:41:25+09:00\n"
"PO-Revision-Date: 2015-04-28T19:41:25+09:00\n"
"Language: ja_JP\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: application/blocks/custom_content_example/controller.php:21
msgid ""
msgstr ""
#: application/blocks/custom_content_example/controller.php:26
msgid "Custom Content Example"
msgstr ""
As you can see, we have two empty strings ( |
I'm so sorry. The error resolved with removing empty string in custom_content_example. I close this issue. Thank you for your kindness support and this great feature, @mlocati ! |
Thank you, Takuro 😉 BTW, I'd like to be sure that others won't incur in this same problem. echo t(''); |
Yes. I had |
php-gettext/Gettext#72 should fix such problems. |
#2349 fixes such problems (thanks to @oscarotero for his fast response 😉) |
Super fast! Thanks! 🎉 |
It happens again with 8.2.1 |
What's the version of gettext/gettext that you are using? (You should be able to see it in your composer.lock file) |
Thank you
|
Could you share the .po file that breaks the execution? |
|
It's wrong: for Japanese there should be just 1 plural form... |
"Save to File" button on Translate Site Interface page. Thanks again... |
Could you share the contents of the SiteLocales database table? |
The 3 columns defining the plural rule is wrong: You should have
How did you add the Jaoanese locale to the website? |
So far I know, installed by CLI with --site-locale=ja_JP. |
@biplobice Nope, but we found the reason. Let's test clean installation and check the SiteLocales table. @mlocati Thanks a lot! |
So, the reason is-
|
When I saved site translations to file, I got a Exception. The message is "Plural rule of merging text domain is not compatible with the current one". I can reproduce this issue when I have a Japanese section in my sitemap. I have also tested with two languages, English and Italian, but there is no problem.
Finally, I found this addition magically solves the issue, but I can't understand why.