Home Ask Login Register

Developers Planet

Your answer is one click away!

lol February 2016

managing MultiLanguage resources

I have created two resource files in my project GlobalRes.ge.resx and GlobalResources.en.resx

I receive language as an input parameters . I want to know how can I read my values based on language. for example if string lang = "en" then by globalres.welcome I should see WOLCOME but if I choose lang = "ge" then globalres.welcome should be willkommen (I have already created the welcome line in both files)


Travis February 2016

The Resource Designer will load the appropriate text based on the CurrentUICulture

System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
bCancel.Text = Resource.Cancel;

In .NET 4.5 and later you can use the following properties to set the DefaultThreadCurrentCulture & DefaultThreadCurrentUICulture culture.

CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
CultureInfo.DefaultThreadCurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");

Post Status

Asked in February 2016
Viewed 2,575 times
Voted 7
Answered 1 times


Leave an answer

Quote of the day: live life