locale

How do locales work in Linux / POSIX and what transformations are applied?

﹥>﹥吖頭↗ 提交于 2019-12-29 05:20:43
问题 I'm working with huge files of (I hope) UTF-8 text. I can reproduce it using Ubuntu 13.10 (3.11.0-14-generic) and 12.04. While investigating a bug I've encountered strange behavoir $ export LC_ALL=en_US.UTF-8 $ sort part-r-00000 | uniq -d ɥ ɨ ɞ ɧ 251 ɨ ɡ ɞ ɭ ɯ 291 ɢ ɫ ɬ ɜ 301 ɪ ɳ 475 ʈ ʂ 565 $ export LC_ALL=C $ sort part-r-00000 | uniq -d $ # no duplicates found The duplicates also appear when running a custom C++ program that reads the file using std::stringstream - it fails due to

Is it possible to configure unified format of date format for whole struts webapp?

别等时光非礼了梦想. 提交于 2019-12-29 02:01:05
问题 In any case id get exception Could not parse date . There is unified company standard of date format - 'dd/MM/yyyy' There are computers with different system locales. I am using jQueryUI for datepicker ( it is standard for widgets and already settled css styles to match application theme). At the beginning, i didn't found better solution then manually convert date string to date object using SimpleDateFormat object. Now i have converter class but still need to configure every Action that has

List of available collators in PHP?

a 夏天 提交于 2019-12-28 16:06:06
问题 I am considering using collators in PHP (I am no expert in PHP). Is there a way to know/list all collators available in PHP? I am looking for something similar to Java's Collator.getAvailableLocales(). Thanks. 回答1: I think the Collator is using the locale information from the CLDR repository. I compiled a list from it's current trunk: af af_NA af_ZA ar ar_001 ar_AE ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA ar_SD ar_SY ar_TN ar_YE as as_IN az az_Latn az_Latn_AZ be

Is there a way to get a timeZone with (only) a country code (valid ISO-3166 code)?

橙三吉。 提交于 2019-12-28 15:20:52
问题 I'm trying to get a TimeZone for a user. For this I have a country code which is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html I think the response is "no because it's a manytomany relationship... there can be many timezone for a country like USA ...". That's the problem... I've tryied something like: //CountryEnum

Reliable method to get the country the user is in?

落花浮王杯 提交于 2019-12-28 05:22:45
问题 I usually get the country from the device's language. It works but now I have to recognize Brazil. And most of the devices only have portuguese (pt_PT), and no portuguese (Brazil) option. I checked this thread: Where am I? - Get country The methods String locale = context.getResources().getConfiguration().locale.getCountry(); String locale = context.getResources().getConfiguration().locale.getDisplayCountry(); Are still language-only, doesn't help. There's also the suggestion with the sim

Reliable method to get the country the user is in?

被刻印的时光 ゝ 提交于 2019-12-28 05:22:06
问题 I usually get the country from the device's language. It works but now I have to recognize Brazil. And most of the devices only have portuguese (pt_PT), and no portuguese (Brazil) option. I checked this thread: Where am I? - Get country The methods String locale = context.getResources().getConfiguration().locale.getCountry(); String locale = context.getResources().getConfiguration().locale.getDisplayCountry(); Are still language-only, doesn't help. There's also the suggestion with the sim

JSF 2.0 set locale throughout session from browser and programmatically [duplicate]

孤者浪人 提交于 2019-12-27 12:22:24
问题 This question already has answers here : Localization in JSF, how to remember selected locale per session instead of per request/view (5 answers) Closed 4 years ago . How do I detect the locale for an application based on the initial browser request and use it throughout the browsing session untill the user specifically changes the locale and how do you force this new locale through the remaining session? 回答1: Create a session scoped managed bean like follows: @ManagedBean @SessionScoped

JSF 2.0 set locale throughout session from browser and programmatically [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-27 12:21:54
问题 This question already has answers here : Localization in JSF, how to remember selected locale per session instead of per request/view (5 answers) Closed 4 years ago . How do I detect the locale for an application based on the initial browser request and use it throughout the browsing session untill the user specifically changes the locale and how do you force this new locale through the remaining session? 回答1: Create a session scoped managed bean like follows: @ManagedBean @SessionScoped

Add 'decimal-mark' thousands separators to a number

谁说我不能喝 提交于 2019-12-27 11:44:21
问题 How do I format 1000000 to 1.000.000 in Python? where the '.' is the decimal-mark thousands separator. 回答1: If you want to add a thousands separator, you can write: >>> '{0:,}'.format(1000000) '1,000,000' But it only works in Python 2.7 and higher. See format string syntax. In older versions, you can use locale.format(): >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'en_AU.utf8' >>> locale.format('%d', 1000000, 1) '1,000,000' the added benefit of using locale.format() is that it

Create a “converter” class to get metric measurements

核能气质少年 提交于 2019-12-25 20:04:09
问题 I am developing an app to get user information like weight and height. In according to Locale, the app show two or three EditText: three (pounds, feet, inches) if the Locale is US two (kilograms, centimeters) in the other cases (France, Italy, Spain, etc) In both cases, I can get an int value or a String value from each EditText. I would like to create a Java class that allows me to switch from imperial to metric system (or vice versa) via the two (or three) values. 回答1: You have 2 basic ways