I am working on a kiosk application that has a button to choose a language.
The button after that has a picture of the languages flag and it's name. Right now I am using a switch statement to set the image, but I would like to have it more generic so when adding languages I wouldn't have to change code everywhere. I am getting the image from my apps resources, and I would like to keep it that way.
The only way I can think of would be by retrieving the images from files and naming them according to the language string they are for. The language string is in this format "en-US". Also the language string is declared in a function before this one is called.
private void SetLanguageButton()
{
switch (language)
{
case "en-US":
buttonLanguage.Image = Properties.Resources.en_US;
break;
case "hu-HU":
buttonLanguage.Image = Properties.Resources.hu_HU;
break;
case "sk-SK":
buttonLanguage.Image = Properties.Resources.sk_SK;
break;
}
buttonLanguage.Text = resourceManager.GetString("languageName", cultureInfo);
}