locale

Locales as part of the URL in Spring MVC

Hello! I'm now looking for a framework for multilingual web-applications. At the moment it seems to me that the best choice is Spring MVC. But I faced the fact that all the guidelines for developers suggests to switch languages using LocaleChangeInterceptor in such way: http://www.somesite.com/action/?locale=en Unfortunately, there ar...

setlocale() is not affecting ConvertBSTRToString() but system-wide setting does?

Given: ASP.Net application which uses a legacy COM library legacy COM library which is built without Unicode (MBCS) Windows 2008 dev server on which it all runs Needed: support web app users in different locales Test: 1) I set the system locale on the server to Russian and tested Russian inputs. .NET treats them as UTF16, passes o...

Java DecimalFormat problem

I would like to format numbers of type double with a German locale in Java. However something goes wrong since the output of the following code is : 0.0 package main; import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; public class Test { private static String d...

Format date based on locale in python

I have a date output like >>> import time >>> print time.strftime("%d %B") 19 July Is there a way to format the date based on the locale, but still have control of what is shown (in some cases I don't want the year). For example, on a en_US machine, I want it to output: July 19'th ...

ReloadableResourceBundleMessageSource unable to find message when default locale is "en"

Why is the spring "ReloadableResourceBundleMessageSource" unable to find the proper message associated with a code when Locale.getDefault() returns en, but able to find the proper message when it returns en_US Default Locale: en_US key: CODE_1, Locale: Locale.US = Hit key: CODE_1, Locale: Locale.CANADA = Hit key: CODE_1...

How can I map non-English Windows timezone names to Olsen names in Python?

If I call win32timezone.TimeZoneInfo.local().timeZoneName, it gives me the time zone name in the current locale (for example, on a Japanese machine, it returns u"東京 (標準時)"). I would like to map this name to an Olsen database timezone name for use with pytz. CLDR windowZones.xml helps me to map English names, but can't handle the Japanes...

MissingResourceException - Can't find bundle for base name

I know that there are a lot of questions and answers exactly about this error on stackoverflow and other forums. But I still can not find the solution... For speed reasons I have one utility class which loads all static data maps (for example months) depending on locale provided. So this utility class looks something like this: public...

Why did the digit grouping and decimal separator change for en-ZA from .NET 3.5 to .NET 4.0?

We have code in our system to format numbers and currency according to the regional settings selected by the user. One of our users has selected en-ZA and noticed that the digit grouping and decimal separators have changed with our migration to .NET 4.0. I wrote a snippet of code to illustrate this change: using System; namespace regio...

What are the best practices for internationalizing a Java Swing desktop application?

I'm sure there are a lot of methods, but what's the recommended way to do this that has the least amount of impact to your code? The obvious is that you create properties files, but how do you swap the values in the rendering? In J2EE you always just re-render the whole page so it's easy. But in Swing apps, do you just add the code for...

Haskell: print TextEncoding

Haskell newbie here. $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1 While trying to debug weird locale-related bug in third-party Haskell program, I'm trying to print default encoding: import System.IO main = do print localeEncoding But it fails: $ ghc -o printlocale main.hs main.hs:4:2: No...

Can't get Django localization to work

I've searched several threads and bug reports, but couldn't find a solution. I changed the locale of my Django project to pt-br but it made no difference. I excepted all input fields and outputs to localize dates and numbers, specially DECIMAL_SEPARATOR and THOUSAND_SEPARATOR, including in the admin API. But the dates there continue to ...

Getting device info in iOS?

I'd like to find out and store information about a users device. I'm looking for the date, the type (iPhone/iPod/iPad), the locale (Language) and location. The date should be simple to get, as is the device type. What code is used to find out the current locale/language of the device interface? ...

How do I find out wether a locale uses 12 or 24 hour time in Java?

In Java, I want to print just the time of day in hours and minutes and want it to correctly switch between, e.g., "13:00" and "1:00 PM" according to the locale. How do I do this? ...

How to set thousend separator for PostgreSQL?

I want to format long numbers using thousend separator. It can be done using to_char function just like: SELECT TO_CHAR(76543210.98, '999G999G990D00') But when my PostgreSQL server with UTF-8 encoding is on Polish version of Windows such SELECT ends with: ERROR: invalid byte sequence for encoding "UTF8": 0xa0 HINT: This error can a...

Change locale for current iphone application (custom locale for NSBundle?)

Hi, i want to change the locale programmatically in my iphone app (basically because not all languages are supported by iphone itself, it should be possible for the user to switch language only for my application). I have seen on a different question http://stackoverflow.com/questions/1669645/how-to-force-nslocalizedstring-to-use-a-speci...

PHP/Gettext Problems

I remember running some tests a some months ago with gettext and the following code worked perfectly: putenv('LANG=l33t'); putenv('LANGUAGE=l33t'); putenv('LC_MESSAGES=l33t'); if (defined('LC_MESSAGES')) // available if PHP was compiled with libintl { setlocale(LC_MESSAGES, 'l33t'); } else { setlocale(LC_ALL, 'l33t'); } bindt...

Python not sorting unicode properly. Strcoll doesn't help.

I've got a problem with sorting lists using unicode collation in Python 2.5.1 and 2.6.5 on OSX, as well as on Linux. import locale locale.setlocale(locale.LC_ALL, 'pl_PL.UTF-8') print [i for i in sorted([u'a', u'z', u'ą'], cmp=locale.strcoll)] Which should print: [u'a', u'ą', u'z'] But instead prints out: [u'a', u'z', u'ą'] ...

How to un-set a keybinding for a particular locale

I have an Eclipse plugin that makes use of several keybindings (Alt-G x, Alt-G y, etc...). For most keyboard layouts, there are no problems for these specific keybindings. However, for Swiss German, it turns out that 'Alt-G' creates '@' and this makes it very hard for Swiss Germans to use the plugins I created. I do not want to change...

DateTime locale settings

We are haveing issue with DateTime on one of our application servers. The issue is the datetime is picking the locale settings as en-US and we want to use en-GB. I tried to Change the server Regional and Language options to UK still having the same issue. I could force DateTime to use en-GB but this will require code changes at various l...

Python: date formatted with %x (locale) is not as expected

I have a datetime object, for which I want to create a date string according to the OS locale settings (as specified e.g. in Windows'7 region and language settings). Following Python's datetime formatting documentation, I used the %x format code which is supposed to output "Locale’s appropriate date representation.". I expect this "repr...