c# - How to manually set language in ASP MVC without reconfiguring routing -
edit
the mistake in country code. albania's country code sq-al, , not al-al. full list of country codes: http://timtrott.co.uk/culture-codes/
i don't need have different routing different languages. need click of button toggle between 2 languages, albanian, , english.
what can't figure out: how change language? i'm not worried on how detect language needs selected, how change language.
i have these 2 resource files: resources.resx, resources.al-al.resx
always strings resources.resx used, how can change strings resources.al-al.resx used?
i tried this:
//i'm trying stuff read here in so, none worked far. resource.culture = cultureinfo.createspecificculture("al-al"); httpcontext.session["culture"] = "al-al"; thread.currentthread.currentculture = cultureinfo.createspecificculture("al-al"); return redirecttoaction("index", "home"); and in view have this:
@resource.culture @html.label(resource.customername, new { @class = "control-label"}) when first open view, first line empty, after selecting 1 of buttons change language, verify resource's culture being changed, text stays same.
edit:
i added web.config <globalization uiculture="al-al" culture="al-al"/>
custom folder hold resource files
instead of using culture code al-al had use sq-al. full list of culture codes:

Comments
Post a Comment