locale

Java Locale issue in vendor Applet

I have a vendor Applet that is trying to use no longer supported locale settings. De compiled Code is as follows String s1 = System.getProperty("java.version"); String s2 = System.getProperty("user.language"); String s; if(s1.regionMatches(true, 0, "1.4", 0, 3)) s = System.getProperty("user.country"); else s...

Does the formatting of a date depend on both the user's locale and calendar system?

I feel this question is very general for all programmers on all languages. This is somewhat blurry. First, there are locales, which encapsulate cultural information and other stuff. I believe these locale objects also encapsulate information about date and time formatting, i.e. how to display a date, in Unicode Standard. Like so, for exa...

locale-dependent ordering for std::string

I am trying to compare std::strings in a locale-dependent manner. For ordinary C-style strings, I've found strcoll, which does exactly what I want, after doing std::setlocale #include <iostream> #include <locale> #include <cstring> bool cmp(const char* a, const char* b) { return strcoll(a, b) < 0; } int main() { const char* s...

Convert NSString with a number to appropriate phone number localization format

Hello everyone. NSString *phoneNumber = @"2310234432"; I would like to create a new string out of the above but format the phone number according to the current localization. Is there a "native" way I can do this or do I have to write my own methods to return it for every locale ? Thanx ...

How to format numbers according to locale in Haskell?

In Python I can use locale.format to pretty-print numbers according to locale setting: >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8") 'en_US.UTF-8' >>> locale.format("%.2f",1234567.89,grouping=True) '1,234,567.89' How can I do the same in Haskell? I see that there are localeconv and setlocale bindings, but is the...

Is there a way to get a timeZone with (only) a country code (valid ISO-3166 code) ?

Hi everybody, I'm trying to get a TimeZone for a user. For this I have a country code which is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.chemie.fu-berlin.de/diverse/doc/ISO%5F3166.html I think th...

Encoding problem undr Groovy

Hi! I am developing an application which should work under different languages (german, spanish, etc). The application uses an Oracle DB. I have CRUD business processes and I have the standard views (create, edit, show, list). No problems for creating, showing and listing any record containing special chars like ä,ö,ü, etc. But when I e...

How to set DB2 ODBC driver locale?

I want to import data from a DB2 database into MS Access via ODBC. The connection is set up and working but decimal values get converted due to some locale issue (German Windows). 234.75 ends up as 23475 in the Access table. I had the same issue with Oracle but was able to fix it by setting the ODBC drive to US locale. How can I do tha...

Special Characters in non english languages

How can I generate a text file containing all character codes in a specific locale for example 1029 Czech. I basically want to generate a list of every character that exists in their alphabet? ...

Has C#/.NET builtin conversion routines for length units?

Has C#/the .NET library builtin routines or constants for converting e. g. millimetres to inches? If so, where can I find them? (I just do not want to produce duplicate code again and again.) ...

Are there any updates of localization support in C++0x?

The more I work with C++ locale facets, more I understand --- they are broken. std::time_get -- is not symmetric with std::time_put (as it in C strftime/strptime) and does not allow easy parsing of times with AM/PM marks. I descovered recently that simple number formatting may produce illegal UTF-8 under certain locales (like ru_RU.UTF...

C# sort list of strings with specific scandinavian culture in mind

Hi, i have a list of country names. Now i want to sort them alphabeticly, with the users culture in mind. I have the 4 scandinavian cultures norway, sweden, danmark en finland. For sweden, the Ö (O with two dots if it's not printed correctly) must appear at the end, after the Z, but for danmark it's just the letter O, so it must appear...

Locale-aware Perl regular expressions (matching word boundaries)

I'm currently somewhat stuck getting a regular expression in Perl (taken from an earlier question of mine) to match word characters from a non-ASCII locale (i.e., German umlauts). I already tried various things such as setting the correct locale (using setlocale), converting data that I receive from MySQL to UTF8 (using decode_utf8), an...

Whi is nl_langinfo(CODESET) different from locale charmap?

This post originated from http://stackoverflow.com/questions/1492918/how-do-you-get-what-kind-of-encoding-your-system-uses-in-c-c I tried using nl_langinfo(CODESET) but I got ANSI_X3.4-1968 instead of UTF-8 (which is what I get when typing: locale charmap). Am I using nl_langinfo() wrong? How should I use it? ...

Grails how to change the current locale

Hi, How can I change the current locale ? I tried to put controller/action?lang=de but my locale is still en_US I tried to override the value using this piece of code: def key = "org.springframework.web.servlet.DispatcherServlet.LOCALE_RESOLVER" def localeResolver = request.getAttribute(key) localeResolver.setLocale(request, response...

Supporting limited number of currencies in Cocoa(Touch)

Early versions of our app will only support a limited number of currencies. If a user should try to use our app with an unsupported currencyCode then I'd like to set the currencyCode to one that is supported. I'm getting myself confused bouncing between NSNumberFormatters, currencyCodes, NSLocales, etc... Currently I test the NSNumberF...

.NET counterpart of Java's locale's variant: does it exist?

Are there localisation mechanisms available under .NET (out of the box) that support something like Java's locale's variant? Beside the language and country I would like to be able to have a variant, say, per users' domain. My users represent various domains and their vocabulary varies. I was trying something like "en-US-domain1", but to...

Facebook FQL user table `sex` field : how to return male/female even the user is using different locale?

Situation: my facebook application ( http://apps.facebook.com/mymagicmirror/ ) needed to detect user's gender, and then query opposite sex or male or female FQL: SELECT uid, name, pic, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user_id.') and sex='male' Problem: When the facebook user is using other locale, th...

python locale currency and negative numbers

Why? C:\path\>manage.py shell Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> locale.getlocale() ('Spanish_Colombia', '1252') >>> locale.currency( 1885, grouping=True ) '$ 1.885,00' >>> locale.currency...

locale.getlocale() problems on OSX

I need to get the system locale to do a number of things, ultimately I want to translate my app using gettext. I am going to distribute it on both Linux and OSX, but I ran into problems on OSX Snow Leopard: $ python Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" f...