locale

Setting Arabic numbering system locale doesn't show Arabic numbers

喜夏-厌秋 提交于 2019-12-17 20:19:10
问题 I read this article: JDK 8 and JRE 8 Supported Locales, it stated that: Numbering systems can be specified by a language tag with a numbering system ID ╔═════════════════════╦══════════════════════╦══════════════════╗ ║ Numbering System ID ║ Numbering System ║ Digit Zero Value ║ ╠═════════════════════╬══════════════════════╬══════════════════╣ ║ arab ║ Arabic-Indic Digits ║ \u0660 ║ ╚═════════════════════╩══════════════════════╩══════════════════╝ Now, to demonstrate this, I wrote the

Android: Change language programmatically

痴心易碎 提交于 2019-12-17 19:31:45
问题 I have 3 buttons to change language. So I need to make method, where I could set listeners to buttons which could change language everytime they are pressed. I tried this https://stackoverflow.com/a/2900144/1088229 but this way it changes locale only once and seems that this doesn't work any more (if i click again, it doesn't even respond). So I added changeLanguageListener() in end of listener, so listener is refreshed. So is it ok, how i solved it or there is another way? private void

Various country's “currency decimal places width” in the iPhone-SDK

微笑、不失礼 提交于 2019-12-17 18:23:34
问题 I read about NSLocaleCurrencySymbol, but where would I find the variable used to determine the "number of decimal places" used in a country's currency? I.E. In the USA, it's common to see dollar amounts written with 2 decimal places: $1.23 What about many other countries? 回答1: There are a number of other countries that display a different number of decimal places. 2 is the majority, 0 (no cents in their currency, e.g., Japan) is the largest minority, 3 is used in just a few. No other number

Setting application locale to pt_BR programmatically

拟墨画扇 提交于 2019-12-17 16:44:22
问题 I have an application that has support for the Portuguese language, both for Portugal and Brazil regions. I have created a values-pt (containing the Portugal translation) and values-pt-rBR (containing the Brazilian translation). I then tried changing the application language to Potuguese (Portugal) and the application language changes correctly. When I set it to Portuguese (Brazilian) it does not. I tried changing the phone default language to Portuguese (Brazilian) and it still does not work

Determine user's “Temperature Unit” setting on iOS 10 (Celsius / Fahrenheit)

孤者浪人 提交于 2019-12-17 16:28:22
问题 iOS 10 adds the ability for the user to set their "Temperature Unit" choice under Settings > General > Language & Region > Temperature Unit. How can my app programmatically determine this setting so it can display the right temperature unit? I poured through NSLocale.h and didn't see anything relevant. (Before iOS 10, it was sufficient to test if the locale used metric and assume that metric users want to use Celsius. This is no longer the case.) 回答1: There is this article by Alexandre

Locale and specific date format with Moment.js

若如初见. 提交于 2019-12-17 16:01:53
问题 I am using Moment.js in my project and formatting dates as follows: var locale = window.navigator.userLanguage || window.navigator.language; moment.locale(locale); someDate.format("L"); It works good but sometimes I need show a date without year. I can't use something like someDate.format("MM/DD") because in some languages it should be someDate.format("DD/MM") . I need something think like L,LL,LLL but without year. What can I do? LTS : 'h:mm:ss A', LT : 'h:mm A', L : 'MM/DD/YYYY', LL : 'MMMM

Android: How to get string in specific locale WITHOUT changing the current locale

廉价感情. 提交于 2019-12-17 15:53:29
问题 Use Case: Logging error messages as displayed to the user. However you don't want to have messages in your log that depend on the locale of the user's device. On the other hand you don't want to change the locale of the user's device just for your (technical) logging. Can this be achieved? I found a couple of potential solutions here on stackoverflow: how to get string from different locales in Android? Can I access to resources from different locale android? android - Get string from default

How to tokenize (words) classifying punctuation as space

耗尽温柔 提交于 2019-12-17 13:25:31
问题 Based on this question which was closed rather quickly: Trying to create a program to read a users input then break the array into seperate words are my pointers all valid? Rather than closing I think some extra work could have gone into helping the OP to clarify the question. The Question: I want to tokenize user input and store the tokens into an array of words. I want to use punctuation (.,-) as delimiter and thus removed it from the token stream. In C I would use strtok() to break an

Force locale for Android flavor with resConfig

余生长醉 提交于 2019-12-17 10:39:12
问题 I am trying to use the resConfig and resConfigs from the Android Build system. Android Studio version 1.2.2 Gradle build version 1.2.3 OSX 10.10.3 I was having problem with these 2 options with my project so I started a new blank project with android studio. I attached my build.gradle where I only added resConfigs "en", "fr" under android { defaultConfig { ... resConfigs "en", "fr" ... } } And defined 2 basic flavors productFlavors { fr { resConfig "fr" } en { resConfig "en" } } I then

Sort List of Strings with Localization

99封情书 提交于 2019-12-17 07:23:47
问题 I want to sort below List of strings as per user locale List<String> 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 above list as per user locale ? I tried Collections.sort(words , String.CASE_INSENSITIVE_ORDER); But this is not working for localization, so how to pass locale parameter to Collections.sort() or is there any other efficient way ? 回答1: You can use a sort with a