I am writing an app where the textblocks can display comments in different languages. I am attempting to use "Culture" which I really don't understand.
I have followed a few videos but still get then same error message:
Here are the namespace I have added:
using System.Reflection;
using System.Globalization;
using System.Resources;
I am just testing the concept out before adding the switch statement:
CultureInfo cult = CultureInfo.CreateSpecificCulture("en");
Assembly lingua = Assembly.Load("Bailing Calculator");
ResourceManager rm = new ResourceManager("Bailing Calculator.Resources.Res", lingua);
tbkPHDiameter.Text = rm.GetString("phDia", cult);
Am I simply not giving the correct path to the ResourceManager? Thanks for the ensuing onslaught of education!
Update your code to be seems like:
CultureInfo cult = CultureInfo.CreateSpecificCulture("en-US");
Assembly lingua = Assembly.Load("Bailing Calculator");
ResourceManager rm = new ResourceManager(string.Format("Bailing_Calculator.Resources.{0}",cult.Name), lingua);
tbkPHDiameter.Text = rm.GetString("phDia");
and update the Resource File name to be your target Culture name: so the file name becomes looks like: en-US
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.