I create a resx file called Resource.fr-FR with the below entry for France
**
Name Value
Greeting Bonjour
**
I then execute the code on page load with the culture set as fr-FR
lblvalue.Text = (string)GetGlobalResourceObject("Resource", "Greeting");
but it always defaults to the English (default Hello text).
I then tried
var FrenchCulture= new System.Globalization.CultureInfo("fr-FR");
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = FrenchCulture;
System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = FrenchCulture;
lblvalue.Text = (string)GetGlobalResourceObject("Resource", "Greeting", FrenchCulture);
but this time i get
No overload for method 'GetGlobalResourceObject' takes 3 arguments
Where am i going wrong?
You need to change Current Culture of the current Thread rather than Default Culture of the Default Thread.-
var FrenchCulture= new System.Globalization.CultureInfo("fr-FR");
Thread.CurrentThread.CurrentCulture = FrenchCulture;
Thread.CurrentThread.CurrentUICulture = FrenchCulture;