locale

On the iPhone, what would be the locale identifier for forcing US english representations of numbers?

In particular I want to guarantee that the formatting of a number uses , (commmas) for separating digits regardless of the current locale of the device. NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init]; [numFormatter setLocal:@"??????"] ...

Locale-aware uppercase in Bash?

How to make locale aware uppercase operation? Standard tr '[:lower:]' '[:upper:]' trick doesn't work: =$ echo żółw | tr "[:lower:]" "[:upper:]" żółW (it should be ŻÓŁW) I'd rather avoid having to run Perl or anything such heavy-weight. ...

Valid Locale Names

How do you find valid locale names? I am currently using MAC OS X. But information about other platforms would also be useful. #include <fstream> #include <iostream> int main(int argc,char* argv[]) { try { std::wifstream data; data.imbue(std::locale("en_US.UTF-16")); data.open("Plop"); } catch...

UTF-16 codecvt facet

Extending from this questions about locales And described in this question: What I really wanted to do was install a codecvt facet into the locale that understands UTF-16 files. I could write my own. But I am not a UTF expert and as such I am sure I would get it nearly correct; but it would break at the most inconvenient time. So I was ...

Anyone had success using a specific locale for a PostgreSQL database so that text comparison is case-insensitive?

I'm developing an app in Rails on OS X using PostgreSQL 8.4. I need to setup the database for the app so that standard text queries are case-insensitive. For example: SELECT * FROM documents WHERE title = 'incredible document' should return the same result as: SELECT * FROM documents WHERE title = 'Incredible Document' Just...

Auto-detection of locales from WWW browser and testing with Cucumber

I test my application with Cucumber and it worked before I've added auto-detection of locales from WWW browser in application_controller.rb: before_filter :set_locale private def set_locale xxx = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if xxx.match /^(en|fr)$/ I18n.locale = xxx el...

How can I format date by locale in Java?

I need to format date to app that has many languages, what is best way to format date, because every country has different kind of date formatting, so is it possible to format date by locale? ...

Python scientific notation using D instead of E

Some results file produced by Fortran programs report double precision numbers (in scientific notation) using the letter D instead of E, for instance: 1.2345D+02 # instead of 1.2345E+02 I need to process huge amounts of this data using Python, and I just realized it cannot read the numbers in the D notation, for instance: >>> A = 1.0...

How do I use java.util.Locale as a key somewhere?

java.util.Locale is one of those classes where I wonder whether I'm too stupid or the guy who wrote it. Is Mark Davis around? As far as I can see, this class isn't supposed to be used. The internal cache in the class is private. The factory package private. equals() uses == to compare strings. This means that I can't compare instances o...

locale-independent strtod implementation

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 implementatio...

C++ - global setlocale works, the same locale passed to _vsnprintf_l doesn't

I have following C++ code sample: void SetVaArgs(const char* fmt, const va_list argList) { setlocale( LC_ALL, "C" ); // 1 m_FormatBufferLen = ::_vsnprintf(m_FormatBuffer, Logger::MAX_LOGMESSAGE_SIZE, fmt, argList); setlocale( LC_ALL, "" ); //2 m_FormatBufferLen = ::_vsnprintf(m_FormatBuffer, Logger::MAX_LOGMESSAGE_SIZE, ...

What is the best way to change the language files in Django

I want to change some of the strings in the language file for my language in Django. I can of course just change the .po file, but that seems unwise because if I update Django the file will be changed again. What is the best way to do this? I don't care if the solution is for the specific app I'm working on or for my entire Django inst...

String to wstring conversion on OS X

Hello, I'm trying to convert a C++ string to a wstring. I found the following code, that seems to deal with accents, which is what I'm looking for. std::wstring widen(const std::string& s) { std::vector<wchar_t> buffer(s.size()); std::locale loc("fr_FR"); std::use_facet< std::ctype<wchar_t> >(loc).widen(s.data(), s.data() + ...

(ANDROID) controling the user language

hi, I have a multi language app. I want to give the user the ability to control which language to use. that mean that even if he has the English Locale he could use a different language if he wants. How can I change the Locale language? (per app) Thanks.... ...

Delphi - undeclared identifier: LOCALE_SYSTEM_DEFAULT

Hi all, I'm trying to format a float (extended) by the system locale's default currency settings. I have found the key proponent to this solution to be the following line: GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, format_settings); and everywhere I look, they provide the solution exactly as shown (no class specifier before, li...

spring 3 mvc intercept all requests

Hi im wondering would it be possible to create global interceptor and set locale there. I have urlrewrite rules to rewrite /fr/* to /*?siteLang=fr I see examples how to set locale based on parameter but they all are the same and require me to use url mappings. Is it possible to do it globally so that locale interceptor gets called on e...

Change SQL decimal delimiter

Hello! I am trying to import data into my table using INPUT INTO The problem is my decimals is using , as a delimiter, and it expects .. So it won't work! How can i change this? Search and replace in the input file is not an option! I am using SQL Anywhere 10 ...

MPFR, printf, decimal places, locales, file i/o problem

A user of my program has reported problems reading a settings file written by my program. I looked at the settings file in question and instead of decimal points using the period "." it uses commas ",". I'm assuming this is to do with locales? The file i/o is using fprintf and mpfr_out_str for file output and getline combined with ato...

How do I remove the difference in locale between gui and commandline interfaces of same program?

The program saves a settings file as text which contains floating point numbers of type long double. The settings file can only be saved via the GUI (GTK2), while files can also be loaded via the command line and without bringing up the GUI. Unfortunately, a user reports that in the files he has saved, due to his locale setting, the num...

How do I retrieve the locale-specific date format string in Flex / ActionScript 3?

How do I retrieve the locale-specific date format string in Flex / ActionScript 3? I am unable to find a method to return the actual format string (that which specifies the date format) based on the current locale. I am asking this question because I was hoping to find a way to convert a String to a Date based on the current SHORT date...