Questions tagged [locale]

In computing, locale is a set of parameters that defines the user's language, country and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language identifier and a region identifier.

Examples of variable output controlled by a locale is whether a date is displayed as 25/12/2012 or 12/25/2012 or some other format, and whether a decimal number is displayed as 123,456.78 or 123.456,78

5203 questions
36
votes
5 answers

How to get current locale of my environment?

Had tried following code in Linux, but always return 'C' under different LANG settings. #include #include #include using namespace std; int main() { cout<<"locale 1: "<
Deqing
  • 14,098
  • 15
  • 84
  • 131
35
votes
4 answers

How to get application language and device language separately in android?

My device language is in English and my application language is in Italian.So how I get the device language and application language programmatically ?
mob_web_dev
  • 2,342
  • 1
  • 20
  • 42
35
votes
5 answers

How can I format date by locale in Java?

I need to format date to app that has many languages, what is best way to format date, because every country has different kind of date formatting, so is it possible to format date by locale?
newbie
  • 24,286
  • 80
  • 201
  • 301
35
votes
3 answers

Sort List of Strings with Localization

I want to sort below List of strings as per user locale List words = Arrays.asList( "Äbc", "äbc", "Àbc", "àbc", "Abc", "abc", "ABC" ); For different user locale sort output should be different as per there locale. How to sort…
Rahul Agrawal
  • 8,913
  • 18
  • 47
  • 59
34
votes
6 answers

How to get language (locale) currently Android app displays?

How to get know language (locale) currently Android app uses to display texts to user? I know I can use Locale.getDefault() to get default OS locale. But it may differ from locale used by app to display text and other resources, if this locale isn't…
Aleksejs Mjaliks
  • 8,647
  • 6
  • 38
  • 44
34
votes
4 answers

how to detect operating system language (locale) from java code

What is the correct way of knowing operating system language (locale) from java code? I have tried Locale.getDefault() System.getProperties("user.language") but they are not correct nothing actually displays the "System Locale" which is available…
Sudhir
  • 523
  • 2
  • 6
  • 15
33
votes
6 answers

Date and time formatting depending on locale

I'm new to both Java and Android development so this might be a stupid question, but I've been searching for days now and can't find a solution: I try to output a java.util.Date depending on the user's locale. Searching on StackOverflow lead me to…
ereOn
  • 53,676
  • 39
  • 161
  • 238
33
votes
3 answers

What std::locale names are available on common windows compilers?

The standard is pretty much silent on what constitutes a valid locale name; only that passing an invalid locale name results in std::runtime_error. What locale names are usable on common windows compilers such as MSVC, MinGW, and ICC?
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
33
votes
4 answers

How to get the current locale (API level 24)?

I was doing this way: context.getResources().getConfiguration().locale Configuration.locale is deprecated if target is 24. So I made this change: context.getResources().getConfiguration().getLocales().get(0) Now it says that it's only for…
user3290180
  • 4,260
  • 9
  • 42
  • 77
33
votes
12 answers

Simplest way to detect client locale in PHP

I would like to be able to detect what country a visitor is from on my website, using PHP. Please note that I'm not trying to use this as a security measure or for anything important, just changing the spelling of some words (Americans seems to…
nickf
  • 537,072
  • 198
  • 649
  • 721
32
votes
1 answer

cr_VariationsUtils: Failed reading seed file

I am getting this log when I start a fragment after selecting language for the first time, i.e changing Locale and also first time string resources are loaded based on selected language. E/cr_VariationsUtils: Failed reading seed file…
wasim.shariff
  • 607
  • 1
  • 7
  • 14
32
votes
14 answers

How to convert a String to another locale?

I need to convert Arabic/Persian Numbers to its English equal (for example convert "۲" to "2") How can I do this?
Ariyan
  • 14,760
  • 31
  • 112
  • 175
31
votes
5 answers

How to change the default language of Android Emulator?

How to change the language of the Emulator? By default I am getting Chinese while filling a form. Please help me to get out of this.
Jai Android
  • 2,131
  • 10
  • 38
  • 55
31
votes
6 answers

Adding/Removing the language entries in the "Settings" -> "Select Locale" from Android phone

My question: How can I add or remove the language entries in the "Settings" -> "Language & keyboard settings" -> "Select Locale"(or "Select Language") in the Android phone from the source code level? I'll provide more details on what I want and what…
yaobin
  • 2,436
  • 5
  • 33
  • 54
31
votes
4 answers

Java: Float Formatting depends on Locale

I live in Belgium. And generally, in mathematics, we write our decimals with a comma like this: 3,141592 And that is also the result when I format the float. System.out.println(String.format("%f", 3.141592)); So, the . is replaced by a , like so:…
Martijn Courteaux
  • 67,591
  • 47
  • 198
  • 287