How do you format a fractional percentage with java.text.MessageFormat

I think the proper way to do it is the following: NumberFormat percentFormat = NumberFormat.getPercentInstance(); percentFormat.setMaximumFractionDigits(1); String result = percentFormat.format(0.125); It also takes internalization into account. For example on my machine with hungarian locale I got “12,5%” as expected. Initializing percentFormat as NumberFormat.getPercentInstance(Locale.US) gives “12.5%” of course.

ASP.NET – MVC 3: Localization

Then I found a post that warned about using the App_GlobalResouces and App_LocalResources. (Link) I found that post extremely useful. The method explained there is very clean. Here is a snippet of my newly created index view using that method: @using Resources.Index @{ ViewBag.Title = “Index”; } <h1>@Index.Title</h1> I don’t think there is a definitive … Read more

What is a good definition for language code and locale codes?

There are several systems for locale identifiers. Many of them are similar at the first glance, but not when you go deeper: Some examples (Serbian-Serbia with Latin Script, Japanese-Japan with radical sorting): UTS-35, ICU, Mac OS X, Flash: sr-Latn-RS, ja-JP@collation=radical Newer UTS-35, BCP 47 extension U: sr-Latn-RS, ja-JP-u-co-unihan Win 2000, XP: 0x81a, 0x10411 Vista, Win … Read more

How to use app_GlobalResource or app_LocalResource?

Local Resources: Local resource is specific to a single Web page and used for providing versions of a Web page in different languages. Local resources must be stored in App_LocalResources sub folder. Local resources must be named in format [.language / language and culture].resx. Ex: Default.aspx.resx- Base resource file. This is the default, or fallback, … Read more

Best practice for ASP.NET MVC resource files

You should avoid App_GlobalResources and App_LocalResources. Like Craig mentioned, there are problems with App_GlobalResources/App_LocalResources because you can’t access them outside of the ASP.NET runtime. A good example of how this would be problematic is when you’re unit testing your app. K. Scott Allen blogged about this a while ago. He does a good job of … Read more

.resx vs database vs custom solution for providing Localization/Globalization

Rick Strahl (An MS MVP) has a great tool kit for managing localization via the DB – offer the ability to update and modify on demand through a controlled environment and does much of the heavy lifting for you. Histoolkit offer the following features: Data Driven Localization Resource Provider Database driven Localization lets you store … Read more

Language change is working before uploading to Google Play Store but not after uploading to play store . Why?

The problem is that you’re using .aab file to publish app on play store . Which removes localization files based on the user’s phone settings when it’s been installing . To solve that you need to put this lines in your build.gradle file and try uploading again android { //… removed for brevity bundle { … Read more

Java string searching ignoring accents

Make use of java.text.Normalizer and a shot of regex to get rid of the diacritics. public static String removeDiacriticalMarks(String string) { return Normalizer.normalize(string, Form.NFD) .replaceAll(“\\p{InCombiningDiacriticalMarks}+”, “”); } Which you can use as follows: String value = “Joáo”; String comparisonMaterial = removeDiacriticalMarks(value); // Joao

How to override the django admin translation?

I’m providing an answer, even though @hedgie mostly answered their own question. I’ll add a bit of context and description of what’s happening. This answer is still applicable as of Django 3.0. Just as you can override a Django-provided admin template by duplicating the template’s name and directory structure within our own project, you can … Read more