locale

What locale should I use for case-insensitive queries from Java?

The classic way to query an SQL database case-insensitively from Java is as follows: String name = ...; // get the user's input (case is unknown) String sql = "select * from Person where lower(name) = ?"; Object jdbcBindVariable = name.toLowerCase(); // ... using JDBC, bind that variable and run the SQL query The problem is that lowe...

Thread safe locale techniques

We're currently writing a web application based on a threaded python web server framework (cherrypy) and would like to simultaneously support users from multiple locales. The locale module doesn't appear to be thread safe. Are there 3rd party libraries or modules that provide locale parsing and formatting functionality in a thread-safe ...

GetUserDefaultLocaleName() API is crashing

I have one application which reads user default locale in Windows Vista and above. When i tried calling the API for getting User default Locale API is crashing. Below is the code, It will be helpfull if any points the reason #include <iostream> #include <WinNls.h> #include <Windows.h> int main() { LPWSTR lpLocaleName=NULL; co...

Are there locales or common programs that use YYYY-DD-MM as the date format?

I've often standardized on YYYY-MM-DD as the date format for communicating within a geographically distributed project teams to dispel any ambiguity that might arise from local date formats. Is it likely that I might run into people who are used to seeing dates as YYYY-DD-MM? Are there programs that use this as a date format? ...

Extract correct text from a wifstream regardless of encoding.

Here is the program: http://codepad.org/eyxunHotThe encoding of the file is UTF-8. I have a text file named "config.ini" with the following word in it: ➑ball If I use notepad to save the file with "UTF-8" encoding, then run the program, according to the debugger the value of eight_ball is: âball If I use notepad to save the file wi...

How to get list of locales in .Net

I would like to give user option to select text file locale. Is there some class in .net that keeps list of available locales? Now, I am planning to make my own list class from MSDN page: Language Identifier Constants and Strings, but it would be nicer if there is something already in .net. Here is MSDN article on CultureInfo.GetCu...

Weird problem with input encoding in IPython

Hello! I'm running python 2.6 with latest IPython on Windows XP SP3, and I have two questions. First one of my problems is, when under IPython, I cannot input Unicode strings directly, and, as a result, cannot open files with non-latin names. Let me demonstrate. Under usual python this works: >>> sys.getdefaultencoding() 'ascii' >>> s...

Drupal: how to set theme language programmatically?

How can i change drupal default language programmatically somewhere in code (like template.php)? (i need to overwrite default language set by admin in some cases.) i'm using drupal 6. PS: please read my own answer for more detail. and if you may help solve that PS: later i saw a module that was what i wanted. make sure take a look at i...

Android : changing Locale within the app itself

My users can change the Locale within the app (they may want to keep their phone settings in English but read the content of my app in French, Dutch or any other language ...) Why is this working perfectly fine in 1.5/1.6 but NOT in 2.0 anymore ??? @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemI...

How do I change a language of a particular page in Django website

Django internationalization allows me to set a language code either in settings file (site-wide) or on per-user / per-session basis. How can I change language for a particular page? I wrote a middleware that sets request.LANGUAGE_CODE the way I want it to be translated, but nothing seems to use this attribute to do the selected transla...

Flex: Wrapper for ResourceManager.getInstance().getString is not notified of localeChain updates

I have written a utility library that contains some of my most used functions. There I have a wrapper for ResourceManager.getString to simplify using the resource manager in non-UI classes: package { import mx.resources.ResourceManager; /** * Convenience function to return a localized string * */ [Bindable("change...

In Java, why does the decimal separator follow the Locale's language, not its country, and, more importantly, how does one override it?

Hello, I'm working on an international project and have observed that, in Java, the choice of the decimal separator is based on the Locale's language, not its country. For example: DecimalFormat currencyFormatter = (DecimalFormat) NumberFormat.getInstance(new Locale("it","IT")); System.out.println(currencyFormatter.format(-123456.78));...

Where is the system locale/culture set for .Net

I have a problem with a c# assembly (.net 2.0 written using Visual studio 2005) that is installed on a UK server and should use UK regional settings. What my code does is to convert a date in the form dd/MM/yyyy into utc. i.e. yyyy-mm-dd. The problem arose with dates like 16/02/2010 where the component failed to convert the date and ret...

Getting the available languages of the application dynamically

Is it possible to find dynamically what are the languages supported by the application? For example, I have strings for the following languages: English, French, Dutch and German. They are defined in their corresponding res directories: values, values-fr, values-nl and values-de. I want to give the user the possibility to choose between ...

How does JavaScript `Date` object determine the locale of the users browser?

I am trying to understand how the JavaScript running in the various browsers determines the locale that will be used by the JavaScript Date object when using the method toLocaleString. I have changed the language and locale settings of my system through windows control panel and I have also changed every browsers language settings to t...

GWT DatePicker Locale

is possible to set a Locale for com.google.gwt.user.datepicker.client.DatePicker? I need to show the days and the weeks in italian style. thanks ...

How to format date in SQLite according to current locale format settings?

I need to match on a date using the LIKE operator. The date should be in current user's local format, not in the general format. So I use the strftime function like this: WHERE strftime('%d.%m.%Y %H:%M', createdDate, 'localtime') LIKE '%{searchTerm}%' Unfortunately this works only for fixed format '%d.%m.%Y %H:%M'. But I want to use ...

Android - Forced locale resetted on orientation changes

I try to force the locale in my app to one the user specified. As this may be used to demonstrations, I want to change the language/locale in the app and not anytime for the whole device. I looked around SO and tried to use every hint I found here. The result: I can restart my test activity with the new language, but if I change the ori...

How to propagate a JSF locale to other layers in the application

In Java Server Faces, we normally get the locale of the current request with the UIViewRoot.getLocale() method, which would normally return the locale set in the browser. In a layered application, how can I read the same locale in other layers, where there's no access to the JSF objects? It seems that Locale.getDefault() is not suitable,...

What is the difference between C and Posix locales on Postgres?

I know that database locales on Postgres are responsible for proper order of national characters, proper lower/upper-casing etc. But why there are two language-neutral locales: posix and c? Is there any difference between them or is it just one neutral locale with two different names? UPDATE As Magnus Hagander states in his answer, POS...