Re: Plural forms: argument selection.

On Sat, 2006-07-22 at 12:54 +0100, Djihed Afifi wrote:

> 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.

There are other language problems with "%d files", one of which being
in Russian (as I recall) "files" needs to spelt differently for numbers
from 1 to 5... sort of like ordinals (1st, 2nd, 3rd, 4th etc.) in

The solution is probably not to use clever tricks with printf and $n,
but to have a text substitution library that can be taught to do "the
right thing".  In some languages, the spelling of numerals may also
depend on the grammatical gender of the governed noun, e.g. for
ordinals in French and Italian.

Few programmers would write:
  The %dth filename doesn't match any file
because "the 1th filename" looks obviously silly in English.
You still come across people writing
  %d file(s) was/were not found.

In this case, 3 strings can be used:
  no files were found
  one file was found
  %d files were found

but this doesn't work for Russian.

A more powerful expression language might work, and then maybe
you could write a numbers-to-words function for your language...
maybe one that could also get the surrounding textual changes right.


Liam Quin - XML Activity Lead, W3C,
Pictures from old books:

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