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;
}
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;
}
Comment