Comment 2 for bug 1556772

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="">
    <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>

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

5. Correct the headers of Russian translation files, including

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.

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.