0

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

            ...
4

1 回答 1

1

您可以阅读此http://forums.asp.net/post/1080435.aspx

简而言之,这CurrentCulture与货币和日期的格式有关。虽然CurrentUICulture这与程序使用的 ResourceManager 有关。

人们可能出于多种原因更改这两种格式,也许他们想要法语的日期格式,而希望使用英语的 Windows 应用程序。或者他们想玩一个只能用日语运行的游戏,并且他们有西班牙日期格式。

最好的选择是选择 ,CurrentUICulture因为有时计算机的默认日期格式与用户所在国家/地区的语言不同。

于 2014-08-07T17:23:12.190 回答