locale

Thymeleaf doesn't render variables within messages in some locales

倖福魔咒の 提交于 2019-12-20 07:16:28
问题 I have a text for a key in my messages.properties file with variables in it: some.key=You'll need to pay {0} {1} in order to continue. and I have it in both locales that my application supports: messages.properties for English, and messages_tr.properties for Turkish (the default Locale ). So this works when I render the page with Turkish locale: and I get: Some Turkish words 10 USD some other Turkish words. So, {0} {1} gets replaced with the amount and currency. But it doesn't when I render

JSpinner editor locale

谁都会走 提交于 2019-12-20 06:20:21
问题 I'm creating a JSpinner and setting a NumberEditor with a custom format. But no matter what I do the format uses "." instead of ",", not according to my locale (pt_BR). priceSpinner = new JSpinner(); priceSpinner.setEditor(new JSpinner.NumberEditor(priceSpinner, "0.00")); Is it possible to use "," instead of "." as a decimal separator? 回答1: By specifying a custom format pattern you are telling the JRE to ignore your locale and use that specific format. If you are simply after a spinner for

How to apply <cctype> functions on text files with different encoding in c++

拈花ヽ惹草 提交于 2019-12-20 04:32:44
问题 I would like to Split some files (around 1000) into words and remove numbers and punctuation. I will then process these tokenized words accordingly... However, the files are mostly in German language and are encoded in different types: ISO-8859-1 ISO Latin-1 ASCII UTF-8 The problem that I am facing is that I cannot find a correct way to apply Character Conversion functions such as tolower() and I also get some weird icons in the terminal when I use std::cout at Ubuntu linux . For example, in

UIDatePicker locale does nothing?

放肆的年华 提交于 2019-12-20 02:29:19
问题 I'm creating a UIDatePicker programmatically, and setting its locale with the following code: datePicker.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"es_ES"] autorelease]; The datepicker still appears in English (or whatever language I've set the phone to). Anyone have any idea why this does nothing, or how to fix it? 回答1: As answered here Can I localize a UIDatePicker?, the picker display depends on country settings, not on language settings. In your example you are changing the

Changing Locale but keep left-to-right and other phone orientations

不打扰是莪最后的温柔 提交于 2019-12-19 18:21:53
问题 I have an app that is available in two languages - English and Hebrew. I added Hebrew strings using the Translation Editor and I am changing the Locale according to the user selection. When changing the Locale, it sets the strings to Hebrew like I wanted, but its also changes the toolbar orientation to right-to-left for Hebrew and brings the title and back-button to the right. English Locale (Default): Hebrew Locale: Is there a way to keep the toolbar orientation like the English one? I want

Changing Locale but keep left-to-right and other phone orientations

≯℡__Kan透↙ 提交于 2019-12-19 18:21:43
问题 I have an app that is available in two languages - English and Hebrew. I added Hebrew strings using the Translation Editor and I am changing the Locale according to the user selection. When changing the Locale, it sets the strings to Hebrew like I wanted, but its also changes the toolbar orientation to right-to-left for Hebrew and brings the title and back-button to the right. English Locale (Default): Hebrew Locale: Is there a way to keep the toolbar orientation like the English one? I want

Locale-independent strtod implementation

£可爱£侵袭症+ 提交于 2019-12-19 16:49:47
问题 I have a library which needs to parse double numbers which always use a point '.' as decimal separator. Unfortunately for this case, strtod() respects the locale which might use a different separator and thus parsing can fail. I can't setlocale() - it isn't thread-safe. So I'm searching for a clean locale-independent strtod implementation now. I have found multiple implementations so far, but all of them look hacky or just like bad code. Can someone recommend a well-tested, working, clean

Why don’t word characters (\w) match right under the use locale pragma?

两盒软妹~` 提交于 2019-12-19 11:17:44
问题 When I use locale , some characters from my locale (et_EE.UTF-8) are not matched with \w and I don't see any reason there. In addition to ASCII, Estonian uses six more characters: õäöüšž In my test script below I use them in $string with three additional special characters ðŋц (which do not belong to the Estonian alphabet). use feature 'say'; use POSIX qw( locale_h ); { use utf8; my $string = "õäöüšž ðŋц"; binmode STDOUT, ":encoding(UTF-8)"; say "nothing"; say 'LOCALE: ', setlocale(LC_CTYPE),

Thymeleaf compare #locale expression object with string

霸气de小男生 提交于 2019-12-19 10:37:08
问题 I want to set a th:class attribute depending on the context locale using the expression object #locale. I have tried th:class="${#locale}=='en'?'active':''" th:class="${#locale=='en'}?'active':''" Both of them results in false, but whent I print it with th:text="${#locale}, I got the correct locale code (en,es). Any idea of how to compare the #locale object with a locale code? 回答1: Based on the answer posted by David_Garcia, I could resolve my issue this way: th:class="__${#locale}__=='en'?

How to Predict Failure of Google Text-to-Speech?

廉价感情. 提交于 2019-12-19 10:04:43
问题 On Android, when using a TextToSpeech instance that uses the Google text to speech engine, it seems as though the method isLanguageAvailable() is unreliable. I say this because there are many instances where this method will return "success" (0,1,or 2), but subsequent speak() commands only results in silence. The case I am testing is a Samsung S5 with API 23. It is in airplane mode (no network). I'm assuming that the reason is at least partly because there is no network and therefore it can