Set Culture in an ASP.Net MVC app

I’m using this localization method and added a route parameter that sets the culture and language whenever a user visits example.com/xx-xx/ Example: routes.MapRoute(“DefaultLocalized”, “{language}-{culture}/{controller}/{action}/{id}”, new { controller = “Home”, action = “Index”, id = “”, language = “nl”, culture = “NL” }); I have a filter that does the actual culture/language setting: using System.Globalization; using … Read more

How to change language of app when user selects language?

It’s excerpt for the webpage: http://android.programmerguru.com/android-localization-at-runtime/ It’s simple to change the language of your app upon user selects it from list of languages. Have a method like below which accepts the locale as String (like ‘en’ for English, ‘hi’ for hindi), configure the locale for your App and refresh your current activity to reflect the … Read more

Localization in JSF, how to remember selected locale per session instead of per request/view

You need to store the selected locale in the session scope and set it in the viewroot in two places: once by UIViewRoot#setLocale() immediately after changing the locale (which changes the locale of the current viewroot and thus get reflected in the postback; this part is not necessary when you perform a redirect afterwards) and … Read more

What is the list of supported languages/locales on Android? [closed]

Updated list as of Android 5.1: af_ [Afrikaans] af_NA [Afrikaans (Namibia)] af_ZA [Afrikaans (South Africa)] agq_ [Aghem] agq_CM [Aghem (Cameroon)] ak_ [Akan] ak_GH [Akan (Ghana)] am_ [Amharic] am_ET [Amharic (Ethiopia)] ar_ [Arabic] ar_001 [Arabic (World)] ar_AE [Arabic (United Arab Emirates)] ar_BH [Arabic (Bahrain)] ar_DJ [Arabic (Djibouti)] ar_DZ [Arabic (Algeria)] ar_EG [Arabic (Egypt)] ar_EH [Arabic (Western … Read more

Internationalization in JSF, when to use message-bundle and resource-bundle?

<message-bundle> The <message-bundle> is to be used whenever you want to override JSF default warning/error messages which is been used by the JSF validation/conversion stuff. You can find keys of the default warning/error messages in chapter 2.5.2.4 of the JSF specification. For example, Messages_xx_XX.properties files in com.example.i18n package as below which overrides the default required=”true” … Read more

Exception messages in English?

This issue can be partially worked around. The Framework exception code loads the error messages from its resources, based on the current thread locale. In the case of some exceptions, this happens at the time the Message property is accessed. For those exceptions, you can obtain the full US English version of the message by … Read more

Ignoring accented letters in string comparison

EDIT 2012-01-20: Oh boy! The solution was so much simpler and has been in the framework nearly forever. As pointed out by knightpfhor : string.Compare(s1, s2, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace); Here’s a function that strips diacritics from a string: static string RemoveDiacritics(string text) { string formD = text.Normalize(NormalizationForm.FormD); StringBuilder sb = new StringBuilder(); foreach (char ch in … Read more