c# - set CultureInfo to a language with country unknown -


i'm trying set cultureinfo of application depending on settingfile that's being given me (i can't change it's content).

in settingfile have access language name should display (no information country) example german, french, english.

i managed cultureinfo using

cultureinfo cultureinfo = cultureinfo.getcultures(culturetypes.allcultures)                               .where(c => c.englishname == languagename).firstordefault(); 

my problem i'm supposed :

thread.currentthread.currentculture = new cultureinfo({lang-country}); 

but have language (via cultureinfo.name), can't create culture info.

trying

thread.currentthread.currentculture = cultureinfo; 

did not work either.

i thought doing

new culltureinfo({cultureinfo.name+"-"+cultureinfo.name.toupper()}); 

but doesn't work example english ...

is there way set cultureinfo common country related language ?
know not perfect solution (for example common between en-uk , en-us ...) don't think can better, not knowing country of user.

this var en = cultureinfo.getcultures (culturetypes.allcultures).first(x=>x.name=="en"); give base cultureinfo language (en in example). if you'll examine "en-gb", "en-us" can see both have parent equal "en".


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -