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

Lists in Python -

android - can not access to progress bar in an other activity -

html - Not able to access next element of an array javascript -