Topic: plural form problem

I found two problems.

  • I would like to translate MiaCMS to Polish language.
    Polish laguage requires plural 'Three forms, special case for one and some numbers ending in 2, 3, or 4'
    After saving language with this parameter, in pl_PL.xml, I have empty plural_form.
    It's only working with plural 'Two forms.......', but it's incorrect for polish.

  • In all *.pot files there are no plural forms.

Re: plural form problem

Hi tmrow, sorry for the late reply, we are looking into your issue and will try to reproduce and provide a fix.

Can you specify the exact MiaCMS version you are using? and if possible, attach the language file here (just zip/tar it)

Re: plural form problem

I'm using 4.8.1. I found that plural forms has gone in r 443. in r435 was.
I found that in 4.8.1 there are 22 plural strings. You can load it from http://www.bp.ecclesia.org.pl/plural.zip

Re: plural form problem

I have made a few modifications for correct operating languages modules. Line numbers are corresponding to last version of files.
----------------------------------------------------------------
/includes/phpgettext/phpgettext.class.php
After line 321 insert
$plural_exp = str_replace(": ", ": (", $plural_exp).str_repeat(")", substr_count($plural_exp, ":"));
----------------------------------------------------------------
/administrator/components/com_languages/actions/save.action.php
line  54
from:
$pluralform = mosGetParam($_POST,'plural_form');
To:
$pluralform = mosGetParam($_POST,'plural_form',null,_MOS_ALLOWHTML);

Line 107
From:
$pluralform = mosGetParam($_POST,'plural_form');
To:
$pluralform = mosGetParam($_POST,'plural_form',null,_MOS_ALLOWHTML);

Line 127
From:
$headers    = mosGetParam($_POST,'headers');
To:
$headers    = mosGetParam($_POST,'headers',null,_MOS_ALLOWHTML);

After line 162 insert:
if ($nplurals > 2){
    $messages[$matches[3]]['msgstr'][2] =  '';}
if ($nplurals > 3){
    $messages[$matches[3]]['msgstr'][3] =  '';}
------------------------------------------------------------------   
/administrator/components/com_languages/actions/apply.action.php
Line  24
From:
$headers    = mosGetParam($_POST,'headers');
To:
$headers    = mosGetParam($_POST,'headers',null,_MOS_ALLOWHTML);
--------------------------------------------------------------------
I have created new plural.pot file which contains all plural messages.
--------------------------------------------------------------------
/language/untranslated/plural.pot

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-11-17 03:18-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: administrator/components/com_categories/admin.categories.php:759
#, php-format
msgid "%d Category copied to %s"
msgid_plural "%d Categories copied to %s"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_checkin/admin.checkin.php:78
#: administrator/components/com_checkin/admin.checkin.php:85
#, php-format
msgid "Checked in <strong>%d</strong> item"
msgid_plural "Checked in <strong>%d</strong> items"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_content/admin.content.php:827
#, php-format
msgid "%d Item successfully Archived"
msgid_plural "%d Items successfully Archived"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_content/admin.content.php:829
#, php-format
msgid "%d Item successfully Published"
msgid_plural "%d Items successfully Published"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_content/admin.content.php:831
#, php-format
msgid "%d Item successfully Unpublished"
msgid_plural "%d Items successfully Unpublished"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_content/admin.content.php:911
#, php-format
msgid "%d Item sent to the Trash"
msgid_plural "%d Item sent to the Trash"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_content/admin.content.php:1043
#, php-format
msgid "%d Item successfully moved to Section: %s, Category: %s"
msgid_plural "%d Items successfully moved to Section: %s, Category: %s"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_content/admin.content.php:1170
#, php-format
msgid "%d Item successfully copied to Section: %s, Category: %s"
msgid_plural "%d Items successfully copied to Section: %s, Category: %s"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_massmail/admin.massmail.php:110
#, php-format
msgid "E-mail sent to %d user."
msgid_plural "E-mail sent to %d users."
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_menumanager/admin.menumanager.php:532
#, php-format
msgid "Copy of Menu `%s` created, consisting of %d item"
msgid_plural "Copy of Menu `%s` created, consisting of %d items"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_menus/admin.menus.php:619
#, php-format
msgid "%d Menu Item moved to %s"
msgid_plural "%d Menu Items moved to %s"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_menus/admin.menus.php:691
#, php-format
msgid "%d Menu Item Copied to %s"
msgid_plural "%d Menu Items Copied to %s"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_trash/admin.trash.php:185
#, php-format
msgid "%s Item successfully Deleted"
msgid_plural "%s Items successfully Deleted"
msgstr[0] ""
msgstr[1] ""

#: administrator/components/com_trash/admin.trash.php:259
#, php-format
msgid "%s Item successfully Restored"
msgid_plural "%s Items successfully Restored"
msgstr[0] ""
msgstr[1] ""

#: administrator/modules/mod_logged.php:67
msgid "Edit User"
msgid_plural "Edit Users"
msgstr[0] ""
msgstr[1] ""

#: components/com_content/content.html.php:121
#, php-format
msgid "%d item"
msgid_plural "%d item"
msgstr[0] ""
msgstr[1] ""

#: components/com_search/search.html.php:91
#, php-format
msgid "returned %d match"
msgid_plural "returned %d matches"
msgstr[0] ""
msgstr[1] ""

#: components/com_user/user.php:209
#, php-format
msgid "Checked in %d item"
msgid_plural "Checked in %d items"
msgstr[0] ""
msgstr[1] ""

#: modules/mod_whosonline.php:31
#, php-format
msgid "We have %d guest online"
msgid_plural "We have %d guests online"
msgstr[0] ""
msgstr[1] ""

#: modules/mod_whosonline.php:35
#, php-format
msgid "We have %d member online"
msgid_plural "We have %d members online"
msgstr[0] ""
msgstr[1] ""

#: modules/mod_whosonline.php:39
#, php-format
msgid "We have %d guest online and "
msgid_plural "We have %d guests online and "
msgstr[0] ""
msgstr[1] ""

#: modules/mod_whosonline.php:40
#, php-format
msgid " %d member online"
msgid_plural " %d members online"
msgstr[0] ""
msgstr[1] ""

Last edited by tmrow (2009-06-26 12:19:00)

Re: plural form problem

hi tmrow, sorry it took us some time before we were able to reply, I personally have been busy and so as the rest of the team.

I have regenerated all pot files and they should contain the plural strings now, they have been disregarded because I was not able to include Tn_ keyword in the xgettext command I used, this is now fixed. I hope it works now for you

as for the plurals issue, I have committed a couple of your recommendations and we appreciate your help.

The changes are now in the latest svn revision