locale

Android get device locale

走远了吗. 提交于 2019-12-17 07:15:18
问题 Upon installation of my Android program I check for device locale: String deviceLocale=Locale.getDefault().getLanguage(); If deviceLocale is inside my supported languages (english, french, german) I don't change locale. But for instance say that if I don't support device's language: for example spanish. I set current locale to English, because most of the people can understand English partly. Locale locale = new Locale("en"); Locale.setDefault(locale); Configuration config = new Configuration

Android get device locale

依然范特西╮ 提交于 2019-12-17 07:15:01
问题 Upon installation of my Android program I check for device locale: String deviceLocale=Locale.getDefault().getLanguage(); If deviceLocale is inside my supported languages (english, french, german) I don't change locale. But for instance say that if I don't support device's language: for example spanish. I set current locale to English, because most of the people can understand English partly. Locale locale = new Locale("en"); Locale.setDefault(locale); Configuration config = new Configuration

Change language settings (locale) for the device

时光毁灭记忆、已成空白 提交于 2019-12-17 06:36:43
问题 I know it's possible to have multiple languages in a single application through the res/string and depending on Locale. Here is a case (ANDROID) controling the user language Now how can I change the language in the phone ? Like I'd do by Menu > Settings > Language & Keyboard > Select locale > languages Is there some real code to access to these settings ? Or should I create intent for a shortcut to the language settings. Please post some code Edit : With Locale class developer.android.com

Simplest way to detect client locale in PHP

无人久伴 提交于 2019-12-17 06:13:08
问题 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 believe that the word "enrolment" has 2 Ls.... crazy yanks) , and perhaps to give a default option in a "Select your country" list. As such, using a Geolocation database is a tad over-the-top and I really don't want to muck about with installing new

Simplest way to detect client locale in PHP

∥☆過路亽.° 提交于 2019-12-17 06:12:07
问题 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 believe that the word "enrolment" has 2 Ls.... crazy yanks) , and perhaps to give a default option in a "Select your country" list. As such, using a Geolocation database is a tad over-the-top and I really don't want to muck about with installing new

Set locale to system default UTF-8

两盒软妹~` 提交于 2019-12-17 06:09:23
问题 When running R inside rApache, the locale is inherited from the Apache webserver, and therefore Sys.getlocale() is always equal to "C" . I would like my web application to use UTF8 , so I use: Sys.setlocale("LC_ALL", 'en_US.UTF-8') However this doesn't work on machines that do not have this locale available: 1: Setting LC_CTYPE failed, using "C" 2: Setting LC_COLLATE failed, using "C" 3: Setting LC_TIME failed, using "C" 4: Setting LC_MESSAGES failed, using "C" 5: Setting LC_MONETARY failed,

With a browser, how do I know which decimal separator does the operating system use?

守給你的承諾、 提交于 2019-12-17 04:58:20
问题 I'm developing a web application. I need to display some decimal data correctly so that it can be copied and pasted into a certain GUI application that is not under my control. The GUI application is locale sensitive and it accepts only the correct decimal separator which is set in the system. I can guess the decimal separator from Accept-Language and the guess will be correct in 95% cases, but sometimes it fails. Is there any way to do it on server side (preferably, so that I can collect

Android - WebView language changes abruptly on Android 7.0 and above

≡放荡痞女 提交于 2019-12-17 03:04:21
问题 I have a multilingual app with primary language English and secondary language Arabic. As described in the documentation, I have added android:supportsRtl="true" in the manifest. I have changed all xml properties with left and right attributes to start and end respectively. I have added Arabic language strings in strings-ar (and similarly for other resources). The above setup works properly. After changing the Locale to ar-AE , Arabic text & resources are correctly displayed in my Activities.

convert decimal mark

扶醉桌前 提交于 2019-12-17 02:37:10
问题 I have a CSV file with data reading that I want to read into Python. I get lists that contain strings like "2,5" . Now doing float("2,5") does not work, because it has the wrong decimal mark. How do I read this into Python as 2.5 ? 回答1: float("2,5".replace(',', '.')) will do in most cases If value is a large number and . has been used for thousands, you can: Replace all commas for points: value.replace(",", ".") Remove all but the last point: value.replace(".", "", value.count(".") -1) 回答2:

Android context.getResources.updateConfiguration() deprecated

守給你的承諾、 提交于 2019-12-16 20:17:52
问题 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 system locale? before this would be done by: Configuration config = getBaseContext().getResources().getConfiguration(); config.setLocale(locale); context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics()); 回答1: