locale

Get date format in Python in Windows

一世执手 提交于 2020-01-23 05:27:14
问题 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

read txt file in c++ (chinese)

╄→гoц情女王★ 提交于 2020-01-23 02:12:28
问题 I'm trying to develop function that check whether chinese word which user enters is in the txt file or not. The following is the code. But it is not working. I want to know what the problem is. Help me please. setlocale(LC_ALL, "Chinese-simplified"); locale::global(locale("Chinese_China")); SetConsoleOutputCP(936); SetConsoleCP(936); bool exist = FALSE; cout << "\n\n <Find the keyword whether it is in that image or not> \n "; cout << "Enter word to search for: "; wstring search; wcin >>

How to make grep [A-Z] independent of locale?

谁说胖子不能爱 提交于 2020-01-21 07:07:10
问题 I was doing some everyday grepping and suddenly discovered that something seemingly trivial does not work: $ echo T | grep [A-Z] No match. How come T is not within A-Z range? I changed the regex a tiny bit: $ echo T | grep [A-Y] A match! Whoa! How is T within A-Y but not within A-Z? Apparently this is because my environment is set to Estonian locale where Y is at the end of the alphabet but Z is somewhere in the middle: ABCDEFGHIJKLMNOPQRSŠZŽTUVWÕÄÖÜXY $ echo $LANG et_EE.UTF-8 This all came

How to make grep [A-Z] independent of locale?

◇◆丶佛笑我妖孽 提交于 2020-01-21 07:06:05
问题 I was doing some everyday grepping and suddenly discovered that something seemingly trivial does not work: $ echo T | grep [A-Z] No match. How come T is not within A-Z range? I changed the regex a tiny bit: $ echo T | grep [A-Y] A match! Whoa! How is T within A-Y but not within A-Z? Apparently this is because my environment is set to Estonian locale where Y is at the end of the alphabet but Z is somewhere in the middle: ABCDEFGHIJKLMNOPQRSŠZŽTUVWÕÄÖÜXY $ echo $LANG et_EE.UTF-8 This all came

how to get current locale in PHP

六月ゝ 毕业季﹏ 提交于 2020-01-15 06:19:12
问题 I would like to get the current system locale of a server (say windows 7 os). This is to ensure that different language setting uses different parts of code in PHP. However, I could not find any API that does this. Can anyone tell me the name of the function? 回答1: Having thought more about the problem and the particular setup I have, I came up with this solution, which seems to work. Note that I don't have control over what languages I need to support: there are translation files dropped into

Convert Japan's date format (2013年11月24日) to normal date format (2013-11-24)

落爺英雄遲暮 提交于 2020-01-15 05:26:14
问题 I have a date picker field on my JSP page. While selecting that field, the date is displayed in Japanese format ( 2013年11月24日 ) in my text field. Now, while reading that date field in my controller, I am getting this value 2013年11月24日 . How can I convert this date format into normal date format? 回答1: It seems the format you've given is the default date format of the Japanese locale, so you can use the build in facility: DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, new Locale(

python based Dockerfile throws locale.Error: unsupported locale setting

三世轮回 提交于 2020-01-13 19:17:27
问题 I have a problem with passing the host's (Centos7) locales to the python3 docker image. Only the following locales end up in the image, even though I used the suggestion described in the link below: C C.UTF-8 POSIX Why does locale.getpreferredencoding() return 'ANSI_X3.4-1968' instead of 'UTF-8'? My Dockerfile has: FROM python:3.7.5 ENV LC_ALL C.UTF-8 WORKDIR /data ADD ./requirements.txt /data/requirements.txt RUN pip install -r requirements.txt COPY . /data CMD [ "python3", "./test.py" ]

How do I set the locale for an ASP.NET 5 application?

北战南征 提交于 2020-01-13 16:27:54
问题 I’m trying to do a blanket override of the host locale for an ASP.NET 5 web application. Most solutions refer to the <globalization/> web.config element, but this is IIS-specific and doesn't seem to fit the new ASP.NET model. I tried: app.Use(next => context => { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-AU"); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-AU"); return next(context); }); This gets executed, but this doesn’t seem to have any

Currency symbol with another number format

元气小坏坏 提交于 2020-01-13 11:19:28
问题 I was wondering if there was an elegant way to set the currency format of a number in one way but keep the actual number formatting in another. It is Java. Essentially I am doing this NumberFormat format = NumberFormat.getCurrencyInstance(locale); This is largely fine except I am writing a system for UK based users and my users are upset that when showing (for example) euros the number is formatted as europeans would use it. So € 500,000 as a UK person would write it is displaying as € 500

gnome-terminal doesn't work maybe because of locale setting

倖福魔咒の 提交于 2020-01-13 11:03:30
问题 I installed Antergos (easy version of Arch) with the Japanese environment. But I wanted to chaned the language to English, so I reffer the wiki article then run some commands after uncomment #en_US.UTF-8 UTF-8 in /etc/locale.gen and edit /etc/locale.conf into following: LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC