I have images that I would like to show within a CustomMessageBox
, that have text within them, based upon the user's current language settings on their device. I do not want to make the mistake of showing a user an image with a language they would not understand or recognize. I realized that there are two options within System.Globalization
, CurrentCulture
and CurrentUICulture
. I want to be sure that I am showing the correct image to the user depending on what they would expect to see. I'm not sure which to use, and the specific differences. I know a user can have a culture set, and a different UI culture set.
C#
//string resourceLanguage = System.Globalization.CultureInfo.CurrentCulture.ToString();
string resourceLanguage = System.Globalization.CultureInfo.CurrentUICulture.ToString();
string imagePath = "Assets/Screenshots/" + resourceLanguage + "/" + Constants.inAppScreenshot + ".png";
CustomMessageBoxContent cmbc = new CustomMessageBoxContent(); //a custom class I defined to handle the image
CustomMessageBox messageBox = new CustomMessageBox()
{
Caption = "\n" + AppResources.App_Caption,
Message = "\n" + AppResources.App_Message + "\n",
LeftButtonContent = AppResources.App_OK,
Content = cmbc.CreateImage(imagePath),
FlowDirection = App.flow
};
...
You can read this http://forums.asp.net/post/1080435.aspx
In short, the
CurrentCulture
has to do with the formatting of the currency and date. While theCurrentUICulture
has to do with the ResourceManager that the programs use.People may change both of these for many reasons, maybe they want the date format in French but the applications of Windows in english. Or they want to play a game that can only be run in Japanese and they have Spanish date format.
The best option will be to choose the
CurrentUICulture
because sometimes computers came with default date format in a language diferent from the users country.