locale

Changing the locale is modifying the text dimensions of my app

放肆的年华 提交于 2020-01-05 12:29:08
问题 I'm trying to change the language on my Android app and I'm using this code: String languageToLoad = "en"; Locale locale = new Locale(languageToLoad); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); I've created different values directories ( \values-fr , \values-it , etc.) where I put my string.xml files. Changing the language works

how to get the locale of a facebook user clicking on a localised object's link?

♀尐吖头ヾ 提交于 2020-01-05 10:08:25
问题 I'm about to implement open graph localised objects. I have configured the og:locale:alternate meta tags, and, when a Facebook crawler request comes in, the correct locale is returned. As a result, I have one object per product (like counter is not divided), and the texts are correctly displayed on the wall posts, according to the user's locale setting. If I look my own share, I see some Facebook URL parameters appended to the URL, but if someone shares my post, even these parameters are

PHP - Parse datetime with locale strings

百般思念 提交于 2020-01-05 03:36:07
问题 I want to parse datetimes like 'Ayer, 16:08' which is 'Yesterday, 16:08' in spanish. I have tried this $dateString = 'Ayer, 16:08'; setlocale(LC_ALL, 'es'); $time = strtotime($dateString); echo date('d-m-Y H:i', $time); but it echoes 01-01-1970 00:00 Nevertheless, if I do it with english strings it works just fine: $dateString = 'Yesterday, 16:08'; $time = strtotime($dateString); echo date('d-m-Y H:i', $time); Is it a problem with locale? Thanks 回答1: You'll need to translate it into English

Get list of languages in Qt5

陌路散爱 提交于 2020-01-04 13:43:32
问题 I want to get the list of ISO 639 languages, from QLocale . I can use this code to get all combinations of language/country. QList<QLocale> allLocales = QLocale::matchingLocales( QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); This is exactly what I need. I assume I can filter out the list manually, but does a better alternative exist? 回答1: You can do either that or do something not nearly as nice (see end of this post) and filter duplicate languages from the list manually, e

Getting SimpleDateFormat for specific timezone

五迷三道 提交于 2020-01-04 07:53:46
问题 I am having a hard time displaying time for a specific timezone. I have a TV Guide like app that gets all start times of the programs in Unix epoch time from the server and I want the times to be shown in the time it would be in the Netherlands wherever the app user is and from whatever android device. After a bit of researching I would think it would work like this: new SimpleDateFormat("HH:mm", new Locale("nl", "NL")).format(new Date(time*1000)); where time is a epoch time for example

How to disable character codes 178 (0xB2) (²) , 179 (0xB3) (³), and 185 (0xB9) (¹) as digits?

梦想的初衷 提交于 2020-01-04 02:40:32
问题 With SWI-Prolog when generating digits using code_type(X,digit). the result is the expected ASCII character codes and 178 (0xB2) ² 179 (0xB3) ³ 185 (0xB9) ¹ e.g. code_type(X,digit). X = 48 ; X = 49 ; X = 50 ; X = 51 ; X = 52 ; X = 53 ; X = 54 ; X = 55 ; X = 56 ; X = 57 ; X = 178 ; X = 179 ; X = 185 ; false. How can I disable or change the functionality so that characters other than 0-9 are not a digit? Obviously I can write a different routine, but I am wondering if there is not some option

mongodump failure 'locale::facet::_S_create_c_locale name not valid'

三世轮回 提交于 2020-01-03 19:34:09
问题 When I try to create a mongodb dump with $ mongodump -d mydb it fails terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted I have LC_ALL=en_US , Ubuntu 10.0.4, MongoDB 2.4.6 I suspect something is wrong with my locale, but can't find what exactly it is. 回答1: I run into the same issue today. It's not strictly MongoDB related. It's locale/language related. Somehow the language on your computer is not defined

Different representation of unicode code points in Japanese and chinese

冷暖自知 提交于 2020-01-03 18:42:14
问题 I am trying to display the glyph corresponding to unicode 0x95E8. This codepoint is basically of CJK block (chinese, Japanese, Korean). I am struggling to know if the glyph representation of this particular codepoint can be different for Japanese and Chinese. When I am displaying this U+95E8 in a JTextArea, i am able to see "门" character on linux/windows. But when I am trying to display the same codepoint in my "embedded device". the displayed character changes to. I want to know if this

C# Changing sytem locale

和自甴很熟 提交于 2020-01-03 10:30:27
问题 Need to change the system locale to a different country, I have tried SystemParametersInfo(), GetKeyboardLayout() which didn't help. How would I change the system locale in C# for a console application? 回答1: You can use SetLocalInfo. [DllImport("kernel32.dll")] static extern bool SetLocaleInfo(uint Locale, uint LCType, string lpLCData); 回答2: e.g., Thread.CurrentThread.CurrentCulture = new CultureInfo("es-AR"); // Espanol - Argentina Thread.CurrentThread.CurrentUICulture = new CultureInfo("es

Wrong Java resource bundle loaded

烈酒焚心 提交于 2020-01-03 10:18:10
问题 In my application, I'm using java resource bundle for the translation of its labels. I currently have two files: resources.properties with labels in English (default language) resources_fr.properties with labels in French Then, I load the bundle properties with the following command: ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME, locale); ... where locale is the user's locale. When I'm working with a French web browser, that's ok, I'm getting all my messages in French, as my locale is