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
3
votes
1 answer

Retrieving code points using Boost.Locale library

From a given Unicode string I wanted to retrieve the list of code points that make up the string. To do so I copied the following example from Boost's character iteration example : #include using namespace…
Tushar Goswami
  • 753
  • 1
  • 8
  • 19
3
votes
1 answer

Where can in find the locale objects for d3.js for different countries

this url (https://github.com/mbostock/d3/wiki/Localization) shows two examples for locales en_US: { "decimal": ".", "thousands": ",", "grouping": [3], "currency": ["$", ""], "dateTime": "%a %b %e %X %Y", "date":…
allel
  • 855
  • 1
  • 12
  • 22
3
votes
1 answer

JavaScript: toLocaleString() testing with jasmine

I have an issue where Jasmine.js (2.4.1) is not able to test the output of toLocaleString. Given the code on jsfiddle; https://jsfiddle.net/2utf6mb3/ var options = { style: "currency", currency: "CHF" }; var number = 1000000; var result =…
Ed Michel
  • 898
  • 1
  • 11
  • 23
3
votes
3 answers

read txt file in c++ (chinese)

I'm trying to develop function that check whether chinese word which user enters is in the txt file or not. The following is the code. But it is not working. I want to know what the problem is. Help me please. setlocale(LC_ALL,…
mi ka
  • 43
  • 1
  • 6
3
votes
1 answer

Lua convert string to number - locale dependent

Just noticed that tostring() and tonumber() in Lua is locale dependent. Any idea of how to convert a string to a number without using tonumber()? Thanks. e.g. convert string "-58.5" to -58.5 Also when I tried to pass a number with dot to a function,…
mile
  • 402
  • 1
  • 6
  • 15
3
votes
2 answers

Is Qt forcing the system locale?

The following example seems to show a bug in Qt. Or am i mistaken ? std::cout << atof("0.456") << std::endl; // OK prints 0.456 QApplication app (argc, argv); //QLocale::setDefault(QLocale::C); // No effect at all. std::cout << atof("0.456") <<…
Mathieu Westphal
  • 2,544
  • 1
  • 19
  • 33
3
votes
3 answers

How to get System Language?

In application supporting multiple languages using Locale.setDefault(newLocale); we are changing the language but there is no way to change language to device default language. What is the best way to find device default language in settings…
Vishal Pawar
  • 4,324
  • 4
  • 28
  • 54
3
votes
1 answer

Is Java showing ISO 639-2 languages incorrectly in case of Finnish?

Why Java is showing ISO 639-2 language codes incorrectly in case of Finnish language? With ISO 639 codes it gives the correct language name in Finnish. public static void main(String[] args) { Locale fi = new Locale("fi"); Locale fin = new…
Mar Foo
  • 33
  • 7
3
votes
2 answers

Refresh all active activities (current and back stack) after changing locale programmatically

I want to provide my users an in-app (NOT DEVICE-WIDE) locale (language) change. Thats why I setup the following code which triggers when the user clicks on a specific language: private void setLocale(Locale locale) { …
spyfx
  • 1,311
  • 4
  • 14
  • 24
3
votes
0 answers

Where to set locale in python while using django?

My django app uses mixture of python's native datetime.datetime.strftime and django's date: filters. Now, I can change the locale very easily in django using settings.py, but not so easily with python, because I would need to invoke…
Vineet Menon
  • 728
  • 2
  • 9
  • 25
3
votes
1 answer

What is alphabetical ordering for sort utility?

I call myself as POSIX shell wizard. But today I have shat into my pants. So here is nothing strange: bash# printf 'v10\nv1.' | sort v1. v10 because . has code 0x2e and 0 has code 0x30. But how about this: bash# printf 'v101\nv1.1' |…
gavenkoa
  • 45,285
  • 19
  • 251
  • 303
3
votes
2 answers

Get Country code

I can get the country code in ISO-form using TelephonyManager::getNetworkCountryIso(), as it returns US for USA and such, but how can I get the numeric country dialing code? I can't seem to find any functions provides me with the data I'm looking…
ARDaniyal
  • 159
  • 3
  • 10
3
votes
2 answers

Python: date formatted with %x (locale) is not as expected

I have a datetime object, for which I want to create a date string according to the OS locale settings (as specified e.g. in Windows'7 region and language settings). Following Python's datetime formatting documentation, I used the %x format code…
Rabarberski
  • 23,854
  • 21
  • 74
  • 96
3
votes
1 answer

How to create a custom collator?

I am using the following code to use as function to sort a list of strings: bool stringLessThan(const string& str1, const string& str2) { const collate& col = use_facet >(locale()); // Use the global locale string…
ViniciusArruda
  • 970
  • 12
  • 27
3
votes
1 answer

Android: get device's current language and region(country)

What is the best way to get the current region of the device? Assume user is in Germany and using Italian as the device's language. If I use Locale.getDefault() then country and language are mapped to each other, i.e. the language is it and country…
Ravjit Singh
  • 798
  • 5
  • 17