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
809
votes
48 answers

How to fix a locale setting warning from Perl

When I run perl, I get the warning: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl:…
xain
  • 13,159
  • 17
  • 75
  • 119
402
votes
21 answers

Python locale error: unsupported locale setting

Why do I get the following error when doing this in python: >>> import locale >>> print str( locale.getlocale() ) (None, None) >>> locale.setlocale(locale.LC_ALL, 'de_DE') Traceback (most recent call last): File "", line 1, in
toom
  • 12,864
  • 27
  • 89
  • 128
374
votes
10 answers

Android get current Locale, not default

How do I get the user's current Locale in Android? I can get the default one, but this may not be the current one correct? Basically I want the two letter language code from the current locale. Not the default one. There is no Locale.current()
CQM
  • 42,592
  • 75
  • 224
  • 366
351
votes
10 answers

List of All Locales and Their Short Codes?

I'm looking for a list of all locales and their short codes for a PHP application I am writing. Is there much variation in this data between platforms? Also, if I am developing an international application, can I just support one version of English…
Kirk Ouimet
  • 27,280
  • 43
  • 127
  • 177
207
votes
6 answers

Changing Locale within the app itself

My users can change the Locale within the app (they may want to keep their phone settings in English but read the content of my app in French, Dutch or any other language ...) Why is this working perfectly fine in 1.5/1.6 but NOT in 2.0 anymore…
Hubert
  • 16,012
  • 18
  • 45
  • 51
184
votes
9 answers

How to change the locale in chrome browser

I want to change Accept-language request header to anything I wanted in chrome, is there any extension or plugin where I can do it. I want to be able to change locale and language both. Main requirement is changing the locale.
user1614862
  • 3,701
  • 7
  • 29
  • 46
174
votes
4 answers

What is the best way to deal with the NSDateFormatter locale "feature"?

It seems that NSDateFormatter has a "feature" that bites you unexpectedly: If you do a simple "fixed" format operation such as: NSDateFormatter* fmt = [[NSDateFormatter alloc] init]; [fmt setDateFormat:@"yyyyMMddHHmmss"]; NSString* dateStr = [fmt…
Hot Licks
  • 47,103
  • 17
  • 93
  • 151
174
votes
17 answers

Set Locale programmatically

My app supports 3 (soon 4) languages. Since several locales are quite similar I'd like to give the user the option to change locale in my application, for instance an Italian person might prefer Spanish over English. Is there a way for the user to…
Roland
  • 5,328
  • 10
  • 37
  • 55
144
votes
8 answers

How does one change the language of the command line interface of Git?

I’d like to change the language of git (to English) in my Linux installation without changing the language for other programs and couldn’t find the settings. How to do it?
user905686
  • 4,491
  • 8
  • 39
  • 60
140
votes
13 answers

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…
Joonas Pulakka
  • 36,252
  • 29
  • 106
  • 169
124
votes
8 answers

Android context.getResources.updateConfiguration() deprecated

Just recently context.getResources().updateConfiguration() has been deprecated in Android API 25 and it is advised to use context.createConfigurationContext() instead. Does anyone know how createConfigurationContext can be used to override android…
Bassel Mourjan
  • 3,604
  • 3
  • 26
  • 37
112
votes
13 answers

How can I convert an Integer to localized month name in Java?

I get an integer and I need to convert to a month names in various locales: Example for locale en-us: 1 -> January 2 -> February Example for locale es-mx: 1 -> Enero 2 -> Febrero
atomsfat
  • 2,863
  • 6
  • 34
  • 36
104
votes
25 answers

How to format a number using comma as thousands separator in C?

In C, how can I format a large number from e.g. 1123456789 to 1,123,456,789? I tried using printf("%'10d\n", 1123456789), but that doesn't work. Could you advise anything? The simpler the solution the better.
goe
  • 5,207
  • 14
  • 45
  • 49
103
votes
6 answers

MongoDB mongorestore failure: locale::facet::_S_create_c_locale name not valid

I created a dump with mongodump on computer A (ubuntu 12.04 server). I moved it to computer B (ubuntu 12.04 server) and typed: mongorestore -db db_name --drop db_dump_path It failed and it reported: connected to: 127.0.0.1 terminate called…
Luca Anceschi
  • 2,257
  • 3
  • 19
  • 24
101
votes
7 answers

'git log' output encoding issues in Windows 10 CLI terminal

Problem How can I make git log command output properly displayed in the Windows CLI terminal? Example As you can see, I can type diacritical characters properly, but on git log, the output is somehow escaped. According to the UTF-8 encoding table,…
1
2 3
99 100