mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #07654
[Bug 901051] Re: Allow correct translation of plurals
https://reviews.mahara.org/922
** Changed in: mahara
Status: Confirmed => In Progress
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
https://bugs.launchpad.net/bugs/901051
Title:
Allow correct translation of plurals
Status in Mahara ePortfolio:
In Progress
Bug description:
With the current language pack format, it's impossible to translate
many plurals correctly unless the language uses the same rules as
English. We need to let translations specify plurals via a function
over the number, as described in
http://www.gnu.org/s/hello/manual/gettext/Plural-forms.html
The following emails have more detail about how we propose to fix this
in Mahara:
---------------------------- Original Message ----------------------------
Subject: Re: Using PluralForms in Mahara strings + DWOO problem/question
From: "Richard Mansfield"
Date: Tue, September 13, 2011 12:16 pm
To: Gregor Anzelj, Francois Marier
--------------------------------------------------------------------------
Thanks very much for this Gregor, I've now had time to have a good look
at those links you sent, and done a bit of playing around on Mahara.
I'd like to propose that we change Mahara along the lines of this
commit:
https://github.com/richardmansfield/richardms-
mahara/commit/157c384b2860553ab78fad88f7a32b30d4af0ec2
And the following commit shows how the strings would look in the default
langpack:
https://github.com/richardmansfield/richardms-
mahara/commit/b0aba7671669ab996008a0c65cc11538dc529bda
It's all pretty much the same as your scheme, but just closer to the
gettext/PO format, using a php array to store the different plural forms
rather than special codes inside the string. So to use your example,
this string:
$string['notsosimpleplural'] = "%d
{{PLURAL:%d|sporocilo|sporocili|sporocila|sporocil}}";
would be specified like this in the php langpack:
$string['notsosimpleplural'] = array(
'%d sporocilo',
'%d sporocili',
'%d sporocila',
'%d sporocil',
);
and like this in our PO files:
#: lang/en.utf8/mahara.php notsosimpleplural
msgctxt "lang/en.utf8/mahara.php notsosimpleplural"
msgid "%d message"
msgid_plural "%d messages"
msgstr[0] "%d sporocilo"
msgstr[1] "%d sporocili"
msgstr[2] "%d sporocila"
msgstr[3] "%d sporocil"
Keeping our scheme similar to PO & gettext has the advantage that it'll
make the conversion of langpacks to/from PO a lot easier, and the other
advantage is that we won't need to rely on special characters like { and
| inside the translated strings themselves (these characters could
legitimately appear in strings too, and one day that might require us to
dream up some escaping rules).
The disadvantage I see, compared to your scheme, is that we're removing
the option to put multiple plural forms anywhere inside a string. For
example in the second patch above, I had to split a string up, because
"Created %s folders and %s files" contains two plurals. However, I
don't think PO can deal with that nicely (correct me if I'm wrong on
that). If we're expecting people to translate Mahara using standard PO
editing tools and Launchpad, I don't see that we've got much choice but
to limit ourselves to one plural per string.
What do you guys think?
On 29/08/11 19:49, Gregor Anzelj wrote:
> > Regarding plural forms and gettext/ .po files...
> >
> > I think these pages contain all the info needed:
> >
> > * http://www.gnu.org/s/hello/manual/gettext/Plural-forms.html
> > *
http://www.gnu.org/s/hello/manual/gettext/Translating-plural-forms.html#Translating-plural-forms
> >
> > But I think we need to be careful to cover all possible cases:
> >
> > * simple one, e.g.: $string['simpleplural'] =
> > "{{PLURAL:%d|view|views}}"; as well as
> > * not so simple one, e.g.: $string['notsosimpleplural'] = "%d
> > {{PLURAL:%d|message|messages}}";
> >
> > or in Slovenian:
> >
> > * simple one, e.g.: $string['simpleplural'] =
> > "{{PLURAL:%d|pogled|pogleda|pogledi|pogledov}}"; as well as
> > * not so simple one, e.g.: $string['notsosimpleplural'] = "%d
> > {{PLURAL:%d|sporocilo|sporocili|sporocila|sporocil}}";
> >
> > HTH,
> > Gregor
> > --
> > ----------
> > Gregor Anzelj, prof.
> > Gimnazija Ledina, Ljubljana
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/901051/+subscriptions
References