Re: [PEPr] Comment on Internationalisation::Maketext

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: [PEPr] Comment on Internationalisation::Maketext
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-27097@lists.php.net to get a copy of this message
Hi Jean-Michel, first of all, let me point out, that there is nothing forcing you to use this module. Are you suggesting this module should not make it into PEAR, because it is not useful? Jean-Michel POURE wrote:
Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=44 MakeText allows you to write: $msg = "I found [quant,_1,child,children] behind [quant,_2,tree].";
[Your whole comment makes me think that this is roughly the point where you stopped reading the examples.] :-)
Are you trying to "code" human language using a computer language? Come on! There are thousands of languages. This only works with a few European languages, not all of them. For example, Hungarian is a completely different language, which sticks words together. But some languages have no verbs, others not adjectives, etc...
Yes, so, where is the problem with your examples? I mean, having no verbs or sticking words together does not imply that you have to compute anything, does it? Those are just problems for the translator, not the programmer. But there are in fact examples in the article linked from the proposal http://search.cpan.org/~sburke/Locale-Maketext/lib/Locale/Maketext/TPJ13.pod where grammatical correctness for given parameters (usually, this applies to quantifiers, as programmers we are mostly dealing with numbers after all[*]) is hard to achieve. Russian is an example which might be a nightmare to do, and yes, Hungarian is a difficult language whith respects to grammatical reflection too. But Maketext's extensibility makes it less painful to deal with these problems, because you can write individual functions for individual languages by simply extending the module to the language's needs. Just go read more of the examples linked from the proposal, most notably the one dealing with Hebrew, which has three forms of plurality: singular, dual and plural.
To my knowledge, writing a Gettext sentence for each case is the only solution.
So you are saying this is a better solution to the simple example you cited? if ($num_children == 1) {
    if ($num_trees == 1) {
        $msg = "I found %d child behind %d tree.";
    } else {
        $msg = "I found %d child behind %d trees.";
    }
} else {
    if ($num_trees == 1) {
        $msg = "I found %d children behind %d tree.";
    } else {
        $msg = "I found %d children behind %d trees.";
    }
} OK, now your translator will have to translate four messages, instead of one. Think about what happens if you have one more thing to quantify in your sentence. Surely, you can split the sentence into parts. And then you can explain to all of your translators, in long-winded words, how the snippets will belong to each other. Obviously, you can bet that at least one translator will come back to you saying the way you split up the sentence doesn't work in language X. Don't forget the Hebrew translater: "Jean-Michel, where are the messages for the Hebrew dual form?" I think many people would be happy not having to go down this road. And Maketext, which I have to point out has not been my own idea, is a neat try to overcome the problem of grammatical correctness in localized, parameter-dependent text messages. Hans [*] but there is an example dealing with grammatical differences related to gender in the proposal's documentation too.

« previous php.pear.dev (#27097) next »