I have a string input of weekdays in German and need to get the next Localdate after today which corresponds to the given weekday string. If for example the input is Montag (Monday) I need the output as Localdate of 2022-05-16 which is the next Monday after today. If the input was in english I could do something like: Is
Tag: locale
Java program uses wrong locale when jpackaged
I am parsing strings representing German-style numbers (i.e., decimal comma and optional full stop for grouping thousands), e.g., “2.804,13”; this is just done using a DecimalFormat based on my desired Locale: This gives the desired output, e.g., when compiled and run from the command line: However, when I bundle it as a jpackage image (./gradlew jpackageImage using Gradle and the
MissingResourceException: Can’t find bundle for base name resources.controls.controls_res, locale en
I can’t understand what the problem is, why he swears and can’t find locale en. Is there a problem with paths or boundle names? The legacy project, written 15 years ago, used to be in Ant, now it was translated to Gradle, this error has appeared. It builds on Ant without problems. P.S. I marked the lines to which the
TextView Numbers shown in English in Persian font
I am loading a string which contains some number (all in Persian) into an android TextView. Everything was fine until I changed my custom font, numbers of text shown as English number. Expected : …
Why Java locales are not constants?
Java supports the Locales shown in this link. But I can’t figure out why only some countries such as France, Canada, China and United States and some languages such as Italian, Japanese and German have constants for their locales. Everytime a need a locale, I consult the table of supported locales and do the following, using Strings: Why only some
JDK Locale class handling of ISO language codes for Hebrew (he), Yiddish (yi) and Indonesian (id)
When instantiating a Locale object with either one of the following language codes: he, yi and id it doesn’t preserve their value. For example: What is causing this and is there any way to work around this? Answer The Locale class does not impose any checks on what you feed in it, but it swaps out certain language codes for
How to create Currency instance with non ISO 3166 country like en_UK?
In my app, I get the user’s default locale using Locale.getDefault() and then pass that to Currency.getInstance(Locale). It mostly works, but I have started getting reports from users which show the following IllegalArgumentException in the stack trace: Caused by: java.lang.IllegalArgumentException: Unsupported ISO 3166 country: en_UK at java.util.Currency.getInstance(Currency.java:81) at org. I expected Android to only return valid locales, but that is
How to get Locale from its String representation in Java?
Is there a neat way of getting a Locale instance from its “programmatic name” as returned by Locale’s toString() method? An obvious and ugly solution would be parsing the String and then constructing a new Locale instance according to that, but maybe there’s a better way / ready solution for that? The need is that I want to store some