locale

PHP Accessing the user's country (locale)

拟墨画扇 提交于 2020-02-02 13:48:27
问题 Is there a superglobal reference to the user's country or is using the IP against a database of IP to Country lookups the best way to go? 回答1: i wish there were such thing as $_SERVER['HTTP_COUNTRY'] ... maybe in php99 ? ;) for the time being, http://php.net/manual/en/book.geoip.php is your best bet however, if you're only interested in user's language, there is $_SERVER["HTTP_ACCEPT_LANGUAGE"] 回答2: Here are some more options for ip to country lookups http://www.hostip.info/ http://pear.php

Start two Android emulators with different locale

耗尽温柔 提交于 2020-02-01 05:12:04
问题 Most of the idea is in the title, I just would like to know if it is possible to start 2 emulators at the same time with 2 different locale (to test the I18n of my app). If there was a way of doing it in Eclipse, that would be greater... Something like 回答1: If you click the Button for starting the emulator in Eclipse (the litlle mobile phone) Eclipse should open a dialog that lets you choose which android virtual device (AVD) you want to start. You can create a second AVD in this dialog and

Set locale for Symfony 2.5 application (force locale)

元气小坏坏 提交于 2020-01-26 03:12:08
问题 I would like to force locale for my Symfony 2.5 application to ru_RU.UTF-8 . I want this locale to be used for strftime() function. I have the following configuration in my app/config.yml : framework: default_locale: "ru_RU.UTF-8" I'm using the following code in one of my controllers to debug this: //setlocale(LC_TIME, 'ru_RU.UTF-8'); var_dump(setlocale(LC_TIME, 0)); var_dump(strftime('%B', time())); die(); When executed like this, it shows: string(1) "C" string(6) "August" . However, when

How to change the monaco editor's locale?

爷,独闯天下 提交于 2020-01-25 07:25:20
问题 I want to know how to change editor's locale? eg: change en-us to zh-cn This is for monaco-editor@0.17.1,vue@2.6.10 回答1: 安装monaco-editor-locales-plugin npm instal -D monaco-editor-locales-plugin weback配置 //引入插件 const MonacoLocalesPlugin = require('monaco-editor-locales-plugin'); new MonacoLocalesPlugin({ //设置支持的语言 languages: ["es","zh-cn"], //默认语言 defaultLanguage: "zh-cn", //打印不匹配的文本 logUnmatched: false, //自定义文本翻译 mapLanguages: {"zh-cn": {"Peek References": "查找引用", "Go to Symbol...": "跳到变量位置"

From string with locale to date on iphone sdk

柔情痞子 提交于 2020-01-25 04:39:28
问题 I trying to find a way to convert a string into a date with a given locale identifier. I have for example an italian date (locale: it_IT) I want to convert into a valid date object. NSDate *GLDateWithString(NSString *string, NSString *localeIdentifier) { [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]; [formatter setLocale

Spring ResourceBundleMessageSource Encoding for Czech MessageResource.getMessage()

你离开我真会死。 提交于 2020-01-24 23:38:30
问题 I have a converter which reader the properties from .properties file using ResourceBundleMessageSource for multiple locales e.g en_US,fr_FR,cs_CZ Below is the xml to read properties. <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>lang/beneficiaryproperty/beneficiary</value> <value>lang/labelsbundlesproperty/labelsbundle</value> </list> </property> </bean> And below is the code to read and write the

Ant Design Calendar: How to Change the Day of Week Format

旧时模样 提交于 2020-01-24 19:22:49
问题 I'm using the Ant Design Calendar Component in my project and I have it set up as follows: Currently the Day of Week format is dd . Eg. Su , Mo , Tu , etc. Is it possible to change the format via props to ddd . Eg. Sun , Mon , Tue , etc.? 回答1: There is no support for changing that directly on ant design component, but Ant Design under the hood is using moment which is using locale.weekdaysMin , so you can import moment and change them: import moment from 'moment' moment.updateLocale('en', {

Launch app with specific locale

依然范特西╮ 提交于 2020-01-24 03:07:08
问题 Changing the locale for a device is done in the settings, and can't be done by an app AFAIK. I know how to force my own app to a specific locale, described e.g. here: http://www.tutorialforandroid.com/2009/01/force-localize-application-on-android.html So now to my question. Can I force, programatically, the local of an activity that isn't mine? I can imagine 2 ways this could be possible: Specifying the locale in an Intent used to start the activity. Access and manipulate the configuration of

Java Locale Font question..?

安稳与你 提交于 2020-01-23 11:14:48
问题 [EDIT] this happend on OSX with Java 1.5! (but may also happen on Windows!) It seems japanese users of my Java Swing program cannot write japanese symbols in JTextFields. Actually they can write them but do not see them. They only see blocks which somehow indicates I think that the font does not support these symbols. I set my own font for various reasons ("Lucida Sans", Font.PLAIN, 12) - which I wouldn't like to change. My questions are: would the JTextFields show japanese Symbols without me

Get date format in Python in Windows

不羁的心 提交于 2020-01-23 05:27:48
问题 In a sample code given to me for my homework, this line appears: date_format = locale.nl_langinfo(locale.D_FMT) But in Windows that line returns the following error: File "C:\Users\Shadark\Dropbox\IHM\P3\p3_files\www\cgi-bin\todolist.py", line 11, in <module> date_format = locale.nl_langinfo(locale.D_FMT) AttributeError: 'module' object has no attribute 'nl_langinfo' I've read about using localeconv but I only read about it being used currency or numbers. Any idea on uses for the purpose of