Re: l10n architecture proposal available for comments

Axel Hecht <[email protected]> Mon, 05 Feb 2007 21:16:27 +0100
Newsgroups gmane.comp.mozilla.internationalization
Message-ID <[email protected]>
Igor Tandetnik wrote:
> Axel Hecht <[email protected]> wrote:
>> Rimas Kudelis wrote:
>>> Do you intend to support Grammatical cases [1] in any way? If yes,
>>> then how do you see it?..
>> Yes, it works pretty much like the gender example in
>> http://people.mozilla.com/~axel/l20n/js-l20n/sample-01.html.
>=20
> The example seems to show how to change the surrounding sentence to=20
> match the gender of a replacement word. The replacement determines the=20
> gender, and the sentence has to adapt.
>=20
> Case works the other way round: the structure of the sentence determine=
s=20
> the case a replacement word must take, and the spelling of the word=20
> changes depending on case it needs to take to fit into a given sentence=
.
>=20
> Often both grammatical categories (three actually - there's also number=
)=20
> work together and require changing both the sentence and replacement=20
> word for everything to agree.
>=20
> Consider also this situation in Russian:
>=20
> 1 file =3D 1 =C6=C1=CA=CC
> 4 files =3D 4 =C6=C1=CA=CC=C1
> 5 files =3D 5 =C6=C1=CA=CC=CF=D7
> 21 file =3D 21 =C6=C1=CA=CC
>=20
> The word "=C6=C1=CA=CC" (file) is in nominative singular in the first l=
ine,=20
> genitive singular in the second line (yes, singular, even though there=20
> are four of them), genitive plural in the third line, and nominative=20
> singular again in the last line.
>=20

That sounds like the standard plural forms as supported by gettext,=20
transforming the .2 notation in POs to real arrays and using an explicit=20
indexing.

The file would look similar to this:

<flockOfFiles[plural(N)]: ["${N}i =C6=C1=CA=CC", "${N}i =C6=C1=CA=CC=C1",=
 "${N}i =C6=C1=CA=CC=CF=D7"]>

In more complex forms, you could make this a hash of arrays or an array=20
of hashes.

The current examples don't demo that, because I didn't implement the=20
expression part just yet. A hacked up version of this, using js' eval is=20
at http://people.mozilla.com/~axel/scratchpad/, which used a not good,=20
but adapted file format, yielding to
<shopping:
    ['Please select number of items',
     'No items ordered',
     'You have ordered one item.',
     'You have ordered $(itemCount)d items.'
     ][plural(itemCount)]
 >

Axel