PDA

View Full Version : Sentences with numbers



oder2
30.09.2007, 12:24
I would like the developers of DAEMON Tools to be posted on the fact that in many Slavic languages (e.g. Ukrainian, Russian, Polish) words change their endings with respect to the numbers they are related to. Unlike English or German (I hardly remember anything from course of German in school but it seems to me in German there are just two endings like in English), Slavic languages have three possible endings for words and more complex rules.

For example, in Ukrainian "<N> devices" would be:
0 пристроїв
1 пристрій
2..4 пристрої
5..20 пристроїв
21 пристрій
22..24 пристрої
25..30 пристроїв
31 пристрій
32..34 пристрої
and so on.

Translation "Зчитано %d сесiя (-iї, -iй), %d дорiжка (-ки, -ок)" for English "Grabbed %d session(s), %d track(s)" does not look nice at all. So, I would suggest adding three copies for strings with numbers and choose among them programmatically depending on actual values in future releases. This way translators would be able to provide correct endings for words in sentences.

The algorythm is the following:
enum EENDINGKIND
{
EK_ENDING_GENERAL,
EK_ENDING_ONE,
EK_ENDING_FEW,
};
EENDINGKIND GetEndingKindFromNumber(unsigned nValue)
{
EENDINGKIND ekResult;
do
{
unsigned nTens = (nValue % 100) / 10;
if (nTens != 1)
{
unsigned nOnes = nValue % 10;
if (nOnes == 1)
{
ekResult = EK_ENDING_ONE;
break;
}
if (nOnes - 2U < 5U - 2U) // >= 2 && < 5
{
ekResult = EK_ENDING_FEW;
break;
}
}
ekResult = EK_ENDING_GENERAL;
}
while (false);
return ekResult;
}

Development
04.10.2007, 13:05
Why not simply translate it then so:
"Number of sessions grabbed: %d" etc.
I think we really cannot satisfy this way all languages if we take into account every language feature. There must be compromise.

SUPPORT4
04.10.2007, 13:26
Thank you for the code, but there is much easier way to solve the problem.
Instead of:
0 пристроїв
1 пристрій
2..4 пристрої
5..20 пристроїв
21 пристрій
22..24 пристрої
25..30 пристроїв
31 пристрій
32..34 пристрої

You should translate the strings as
пристроїв - N

GUI translation doesn't mean all the words should be translated directly. :) There are many on-line and off-line dictionaries to provide such translations. The art of translation is to save and transmit meaning of sentences and words with constructions of the other language :)

oder2
04.10.2007, 15:25
You should translate the strings as
[B]пристроїв - N

This is what I have already done for the two strings I mentioned. But such transformations make sentences to sound weird and unnatural.
When Windows was implemented why did Microsoft develop variable width fonts even though they could easily use fixed width ones as in DOS? Because variable width fonts look better.
The perfection - that is the feature that distinguishes the best product on market from all the rest products which just deserve for being called "good".