Wrong plural formula for russian

Bug #1556772 reported by Ying Chun Guo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack i18n
Fix Released
High
Ying Chun Guo

Bug Description

Dear collegues,

i've checked current russian translation in horizon repository and find out that we have wrong plural formula in upstream.

https://github.com/openstack/horizon/blob/master/openstack_dashboard/locale/ru/LC_MESSAGES/django.po#L35-L37

There is only 3 plural forms in Russian.
And correct formula should be
nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);

Looks like some script is wrong.
Does anybody know how to fix it?

Kind regards,
Ilya Alekseyev

Copied by Daisy from Ilya Alekseyev's email: http://lists.openstack.org/pipermail/openstack-i18n/2016-March/001917.html

Tags: ru
Revision history for this message
Ying Chun Guo (daisy-ycguo) wrote :

Below are the steps we previously used.
We can follow the same steps.
I think the statistic data will not be affected in step 1 to 5.
But, if we delete master-old, the contribution data in master-old will be removed.
So my suggestion is to do the same steps, and keep master-old version (mark it as readonly)
till 6 month or 12 month later when the contribution data is not that important.

> 1. Create Russian translation files with only the correct header and the
> pluralities translation items.
> 2. Create a new version named as russian-fix
> 3. Upload the source files and the Russian translation files created in #1
> to the version russian-fix
> 4. Merge the stable version with version russian-fix
> 5. Rename stable version to stable-old, and rename russian-fix to stable.

Changed in openstack-i18n:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Ying Chun Guo (daisy-ycguo) wrote :

Hi, all

I have fixed the bug.
I documented the detail comments here, for future reference:

1. Create an empty version named as master-fix in Horizon project in Zanata

2. Install zanata-cli if you haven't.

3. Create the config file - zanata.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
  <url>https://translate.openstack.org:443/</url>
  <project>horizon</project>
  <project-version>master</project-version>
  <project-type>gettext</project-type>
  <src-dir>.</src-dir>
  <trans-dir>.</trans-dir>
  <rules>
    <rule pattern="./horizon/locale/*.pot">horizon/locale/{locale_with_underscore}/LC_MESSAGES/{filename}.po</rule>
    <rule pattern="./openstack_dashboard/locale/*.pot">openstack_dashboard/locale/{locale_with_underscore}/LC_MESSAGES/{filename}.po</rule>
  </rules>
  <excludes>.*/**</excludes>
</config>

4. Pull translations by:
zanata-cli pull --pull-type both -l ru

5. Correct the headers of Russian translation files, including
horizon/locale/ru/LC_MESSAGES/django.po
horizon/locale/ru/LC_MESSAGES/djangojs.po
openstack_dashboard/locale/ru/LC_MESSAGES/django.po
openstack_dashboard/locale/ru/LC_MESSAGES/djangojs.po

The correct header setting should be:
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

6. Generate the new Russian translation files with only pluralities translation items by following commands:

cp django.po django-tmp.po
grep -v msgstr.2. django-tmp.po > django.po
sed -i s/msgstr.3./msgstr[2]/ django.po
cp django.po django-tmp.po
sed -i s/'msgid_plural "'/'msgid_plural "AAABBB'/ django-tmp.po
msggrep --msgid -F -e 'AAABBB' django-tmp.po -o django.po
sed -i s/'msgid_plural "AAABBB'/'msgid_plural "'/ django.po
rm django-tmp.po

We need to process all the 4 Russian translation files and create the new version with only pluralities translation items.

7. Change the config file - zanata.xml, make sure to use master-fix version.
  <project-version>master-fix</project-version>

8. Upload the source file together with the new translation files into Zanata by:

zanata-cli push --push-type both --disable-ssl-cert --copy-trans false -l ru

9. Copy translations from master version into master-fix version.

10. Rename master version into master-old, and set it as ReadOnly.
Please don't delete master-old, because it has the translation contribution statistic data. We can delete it after 6 month, at least.

11. Rename master-fix version into master.

Regards
Daisy

Changed in openstack-i18n:
status: Confirmed → Fix Committed
Ian Y. Choi (ianychoi)
Changed in openstack-i18n:
status: Fix Committed → Fix Released
status: Fix Released → Fix Committed
Revision history for this message
Akihiro Motoki (amotoki) wrote :

Is there any reason we keep this bug as Fix Committed? What do we need to do before closing this as Fix Released?

Revision history for this message
Ilya Alekseyev (ilyaalekseyev) wrote :

This bug is fixed and in current master and in all stable branches presented right plural formula for Russian.May be better to set Fix Released status?

Revision history for this message
Ian Y. Choi (ianychoi) wrote :

One problem in Launchpad is that it is rather difficult to find this bug again for future reference.

For bug purposes, yep I agree that it is much better to close this bug as "Fix Released" so I have just changed the status.

I am not sure how to well document how to solve this bug in current I18n contributor guide, but I documented at least on Wiki: https://wiki.openstack.org/wiki/I18nTeam/Handling_Bugs . Maybe in future, we might need to re-organize how to make I18n contributor guide more structured.

Changed in openstack-i18n:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers