Plural forms: argument selection.



Hi,

This message has been posted at gnome-i18n a few days ago. I suppose I
might reach developers better by posting it here.

Original :
Trying to reach a better and more grammatically correct plural form
for Arabic, we bumped into this issue, we thought we should know what
developers think about this before making a decision. I know that you
guys are not arabic savvy, but I'll try to make it as simple as
possible.

Suppose the string:
"There are %d files in directory %s".

In arabic, for some plural forms, it would make more sense to omit %d
and express it by words. By saying "more sense", I mean it would stand
up as particularly inappropriate and inaccurate to include the number.
Putting the number in parenthesis would be less than elegant.

I'm not sure whether all string manipulation is done in a manner
similar to printf, however, according to this:
http://www.opengroup.org/onlinepubs/000095399/functions/printf.html

Arguments can be shuffled around or omitted all together, so, in our
example, we can say

printf("There are %d files in directory %s", 15, "dir");

When the number is OK to be printed.

However, in the example of plural form (n=1), the traditional way
would have have us write something similar to:

printf("There is %d file in directory %s", 1, "dir");

The output in arabic will be akin to saying in English: "there is 1 a
file in directory dir". (I hope you understand)

But:
printf("There (text replacement) in directory %2$s", 1, "dir");

Would be more correct. This issue comes up in 3 plural forms overall.

According to a test I've just done with ascii chars that would work,
try this at the cmd:

echo 'int main() { printf("%2$d \n", 1, 2);}' > test.c ; gcc -w test.c
-o output ; ./output

As I said, I'm not sure whether will this work in all environments, I
don't know what the implications will be for trying such a thing. It
could possibly lead to segmentation faults if not supported or it
could simply write incorrect characters. There is also the security
issue of string buffers.

Please let us know what you think, questions are welcome.

Djihed

(of Arabeyes.org)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]