I've heard that many people had problems using the language localization features, plus you can only translate the interface (I can't translate messages from a messagebox as far as I know). So I just wanted to know what do you think about my approach to translate my winform app.
namespace Tris
{
class Translations
{
public string draws;
public string language;
public string help;
public string newgame;
public bool lang_en;
public bool lang_it;
public bool lang_ru;
namespace Tris
{
class TranslationStrings
{
public void engTranslation(Translations TS)
{
TS.draws = "Draws";
TS.language = "Language";
TS.help = "Help";
TS.newgame = "New Game";
TS.lang_en = true;
TS.lang_it = false;
TS.lang_ru = false;
public void rusTranslation(Translations TS)
{
TS.draws = "Ничья";
TS.language = "Язык";
TS.help = "Помощь";
TS.newgame = "Новая Игра";
TS.lang_en = false;
TS.lang_it = false;
TS.lang_ru = true;
When I need something I just call the right method:
case 2:
pic = Properties.Resources.end3;
if (lang_en)
{
strings.winTranslationsEng(TS);
phrase = loser + TS.win3;
End1 end3 = new End1(lang_en, lang_it, lang_ru, winner, loser, phrase, pic);
end3.ShowDialog();
}
if (lang_it)
{
strings.winTranslationsIta(TS);
phrase = loser + TS.win3;
End1 end3 = new End1(lang_en, lang_it, lang_ru, winner, loser, phrase, pic);
end3.ShowDialog();
}
if (lang_ru)
{
strings.winTranslationsRus(TS);
phrase = winner + TS.win1;
End1 end1 = new End1(lang_en, lang_it, lang_ru, winner, loser, phrase, pic);
end1.ShowDialog();
}
break;
Before all the code was like:
if(lang_en)
{
phrase="hi";
}
if(lang_it)
{
phrase="ciao";
}
etc
Now it's way better than before, but I'm not still satisfied. This way of managing translations makes me use a boolean, so I have to add a new "if else" on which translation method I want to pick for every new language I add.
Do you have any suggestions about how to implement a better translation system? Do you think mine is legit or inappropriate?
edit: The application should be in English, then I can press a button to use either the Italian or the Russian language