locale

stod does not work correctly with boost::locale

自作多情 提交于 2019-12-19 09:05:37
问题 I am trying to use boost::locale and std::stod together in a german locale where a comma is the decimal separator. Consider this code: boost::locale::generator gen; std::locale loc(""); // (1) //std::locale loc = gen(""); // (2) std::locale::global(loc); std::cout.imbue(loc); std::string s = "1,1"; //float string in german locale! double d1 = std::stod(s); std::cout << "d1: " << d1 << std::endl; double d2 = 2.2; std::cout << "d2: " << d2 << std::endl; std::locale loc("") creates the correct

setlocale to fr-FR in PHP and number formatting

a 夏天 提交于 2019-12-19 08:53:51
问题 I am trying to create a French version of one of my sites. I have set setlocale(LC_ALL, 'fr_FR'); at the top of my page, and using strftime I am displaying dates correctly in the French style. However I am having some problems with a number. Part of the page uses data I am getting from a Web Service. I am assigning a returned value to a var like this: $overallRating = $returnArray['Overall']; I am then using the following code later to format it to 1 decimal place number_format($overallRating

setlocale to fr-FR in PHP and number formatting

£可爱£侵袭症+ 提交于 2019-12-19 08:53:45
问题 I am trying to create a French version of one of my sites. I have set setlocale(LC_ALL, 'fr_FR'); at the top of my page, and using strftime I am displaying dates correctly in the French style. However I am having some problems with a number. Part of the page uses data I am getting from a Web Service. I am assigning a returned value to a var like this: $overallRating = $returnArray['Overall']; I am then using the following code later to format it to 1 decimal place number_format($overallRating

Use Different Locale for @NumberFormat in Spring

谁都会走 提交于 2019-12-19 08:15:12
问题 I am working on a Spring 3 project and I need to format a Long field for Turkish currency. The default Locale of the application is en_US . I used the @NumberFormat annotation as below: @NumberFormat(style=NumberFormat.Style.CURRENCY) public Long getBudgetLimit() { return budgetLimit; } The annotation works and formats the form field in English locale. However I need to use Turkish locale for this field. Is there a way to set the locale of a single field or a page different than the

Is SQLite on Android built with the ICU tokenizer enabled for FTS?

血红的双手。 提交于 2019-12-19 06:39:16
问题 Like the title says: can we use ...USING fts3(tokenizer icu th_TH, ...) . If we can, does anyone know what locales are suported, and whether it varies by platform version? 回答1: No, only tokenizer=porter When I specify tokenizer=icu, I get "android.database.sqlite.SQLiteException: unknown tokenizer: icu" Also, this link hints that if Android didn't compile it in by default, it will not be available http://sqlite.phxsoftware.com/forums/t/2349.aspx 回答2: For API Level 21 or up, I tested and found

PHP money_format

馋奶兔 提交于 2019-12-19 05:47:44
问题 I'm using on money_format with the first parameter being '%n' to include the dollar sign, and I have the locale set to en_US but it still doesn't include it. Why? 回答1: From the PHP.net comment: If money_format doesn't seem to be working properly, make sure you are defining a valid locale. For example, on Debian, 'en_US' is not a valid locale - you need 'en_US.UTF-8' or 'en_US.ISO-8559-1'. This was frustrating me for a while. Debian has a list of valid locales at /usr/share/i18n/SUPPORTED;

If you have the ISO country code `US`, `FR`, how do you get the Locale code (`Locale.US`, `Locale.FRANCE`)?

£可爱£侵袭症+ 提交于 2019-12-19 05:14:30
问题 If you have the country code US , FR (ISO-3166-1 alpha-2 country code), how do you get the Locale code ( Locale.US , Locale.FRANCE ) to do something like this: System.out.println(DecimalFormat.getCurrencyInstance(Locale.US).format(12.34)); System.out.println(DecimalFormat.getCurrencyInstance(Locale.FRANCE).format(12.34)); $12.34 12,34 € 回答1: You can't, because a Locale is used to hold a language, not a country. It can hold a language for a specific country, and for a specific variant in this

how to get client's time zone in java from HttpServletRequest? [duplicate]

孤街浪徒 提交于 2019-12-19 05:12:40
问题 This question already has answers here : How to detect the timezone of a client? (4 answers) Closed last year . When server and client are in different time zones, can i get client's time zone in java using HttpServletRequest? I am trying to create an instance of 'Calender' using client's 'Locale' like this, Calendar calendar = Calendar.getInstance(request.getLocale()); TimeZone clientTimeZone = calendar.getTimeZone(); But this is giving me Server's time zone only. Is this method wrong? Is

how to show different language characters in git log?

巧了我就是萌 提交于 2019-12-19 04:01:19
问题 Here is what I am seeing now in my git log: commit d0ed97d243eaf905b03244a4d1ba6af26213e4ad Author: some guy <someone@somesite.com> Date: Mon Jun 3 11:22:06 2013 +0900 <E3><83><98><E3><83><83><E3><83><80><E3><81><AE><E3><83><A6><E3><83><BC><E3><82><B6><E3><82><A2><E3><82><A4><E3><82><B3><E3><83><B3><E8><A1><A8><E7><A4><BA> the commit is made by some Japanese characters. I've already changed my LANG env to ja_JP.UTF-8, en_US.UTF-8, ja_JP.eucJP: $ export LANG=ja_JP.UTF-8 but nothing worked.

Activity is blinking after locale change in Android 4.1+

偶尔善良 提交于 2019-12-19 03:37:31
问题 I have implemented custom locale selection about a year ago but after 4.1 release users start to complain on constant activity blinking. Here is code I'm using (compiled from different SO answers): public final class TestApplication extends Application { private Locale desiredLocale = new Locale("ru-RU"); @Override public void onCreate() { super.onCreate(); updateLocale(new Configuration()); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged