[Mediawiki-l] PLural Transformation for Upper Sorbian

Rotem Liss mail at rotemliss.com
Sat Aug 5 08:46:41 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Wolf wrote:
> Hi,
> 
> I'm preparing the LanguageHsb.php for Upper Sorbian and need a correctly
> working plural transformation in this file. I've already tested the
> solutions of other Slavic languages (Czech, Slovak, Polish, Russian,
> Slovenian, Croatian), but their requirements are some others.
> Upper Sorbian has following requirements:
> 
> 	Numeral		Form
> 	1		Singular
> 	2		Dual
> 	3, 4		Nominative plural
> 	0 and from 5	Genitive plural
> 
>  From the Slavic languages I tested, only Slovenian has still a dual. The
> tested solutions I modified don't work, they use the default form only.
> A differentiation doesn't happen.
> 
> I hope you can help me.
> 
> Thanks in advance,
> Michael Wolf
> 

If I understood the question, adding the function
LanguageHsb::convertPlural will do. I think this code should work:

    /**
     * Gets a number and uses the suited form of the word.
     *
     * @param integer the number of items
     * @param string the first form (singular)
     * @param string the second form (genetive plural ? 0 and from 5)
     * @param string the third form (dual ? 2)
     * @param string the fourth form (nominative plural ? 3 and 4)
     *
     * @return string of the suited form of word
     */
    public function convertPlural( $count, $w1, $w2, $w3, $w4 ) {
        if ( $count == '1' ) {
            return $w1;
        } elseif ( $count == '2' ) {
            return $w3;
        } elseif ( $count == '3' || $count == '4' ) {
            return $w4;
        } else {
            return $w2;
        }
    }

It will make it possible to specify four forms in {{plural:}}: first is
singular, second is genetive plural, third is dual, fourth is nominative
plural. You can add this code to the file.

Also, please look at the new structure of the language files.

- --
#define Name RotemLiss
#define Mail mail-AT-rotemliss-DOT-com
#define Site www.rotemliss.com

#define KeyFingerPrint 4AFD 8579 A449 4267 BED9 38E5 6EF8 5B1F EBDE 7AC0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE1FrxbvhbH+veesARAqQsAJ9OlQBa+G8iJ2OGgE6V5VlTCUoPaACgjmCQ
JR0c9qr/NKnqUu8SnQJtSrM=
=xlju
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list