Claude Paroz reported on the gnome-i18n mailing list today about the msgfmt errors that were showing up on the damned lies page against some files in a few languages. Bengali_India also has a few red medallions and the problem was baffling me since msgfmt checks on the files locally were not showing any errors. It was only after submitting them to the Gnome svn that the msgfmt error messages were showing up. After discussions on the gnome-i18n mailing list and irc conversations, the following seems the correct solution for plural form related errors for languages that do not have any plural forms.
Open .po file in a text editor (like gedit) and insert the following line in the header section:
“Plural-Forms: nplurals=1; plural=0;\n”
Once you encounter a string with a plural form there are two ways to go about it.
1. If both the strings contain a variable (like %d) indicating a number, then the translation can be done as per the language requirements for handling single and plural numbers. e.g.
msgid “%d file has been modified”
msgstr_plural “%d files have been modified”
msgstr [0] “”
msgstr [1] “”
In this case, after translation the string should look like the following in a text editor:
msgid “%d file has been modified”
msgid_plural “%d files have been modified”
msgstr [0] “%d-টি ফাইল পরিবর্তন করা হয়েছ “
Note: The %d has been retained in the msgstr.
2. The second way is the more important of the two and requires caution. If the singular version string does not have a variable, but the plural string contains a variable, then the translation of only the plural string has to be done. e.g.
msgid “one file has been modified”
msgstr_plural “%d files have been modified”
msgstr [0] “”
msgstr [1] “”
In this case, after translation the string should look like the following in a text editor:
msgid “one file has been modified”
msgstr_plural “%d files have been modified”
msgstr [0] “%d-টি ফাইল পরিবর্তন করা হয়েছ “
Note: The %d has to be present in the msgstr and will take the relevant number of “files modified” when the program encounters such a situation.
Also note, in both cases above the msgstr [1] “” has to be manually removed from the strings.
As a final check, please do ensure that the following command does not throw any errors:
msgfmt -vc -o /dev/null (filename.po)
For more information about plural-forms this document is extremely helpful.
Plural forms for Bengali
From what I understand, the equation for Bengali would be
“Plural-Forms: nplurals=2; plural=(n != 1);\n”
So, the translation would be
msgid “%d file has been modified”
msgid_plural “%d files have been modified”
msgstr [0] “%d ফাইল-টি পরিবর্তন করা হয়েছে “
msgstr [1] “%d-টি ফাইল পরিবর্তন করা হয়েছে “
Re: Plural forms for Bengali
Nope. The plural form would be “nplurals=1; plural=0;”.
In the e.g. the %d would be used for a particular number: 0 1 2 3 ….
So per your suggestion of,
msgstr [0] “%d ফাইল-টি পরিবর্তন করা হয়েছে “
msgstr [1] “%d-টি ফাইল পরিবর্তন করা হয়েছে “
would read:
msgstr [0] “1 ফাইল-টি পরিবর্তন করা হয়েছে “
msgstr [1] “10-টি ফাইল পরিবর্তন করা হয়েছে “
which is not correct at all, since the %d will have to be retained to ensure that numbers are correctly represented.
with only the following line present as per the e.g. that I have put on the post,
msgstr [0] “%d-টি ফাইল পরিবর্তন করা হয়েছে “
The message would read
“1-টি ফাইল পরিবর্তন করা হয়েছে “
“10-টি ফাইল পরিবর্তন করা হয়েছে “
“50-টি ফাইল পরিবর্তন করা হয়েছে “
and so on.
and please do leave your name/nick the next time. Thanks