views:

151

answers:

4

Hi,

I am working on the I18n of our java application and we have decided that we will only support data in one locale whereas the user interface may support many.

My question is this:

Should sorting and filtering of data be performed using the user's locale or the data's?

Orginally we had assumed it made sense to sort according to data's locale but having read articles like the one below it seems to make more sense to sort by the user's.

"Sorts can also vary depending on the fundamental order the language and culture use for the alphabet. For example, the Swedish language has an "Ä" character that it sorts after "Z" in the alphabet. The German language also has this character, but sorts it like "ae", after "A" in the alphabet." http://msdn.microsoft.com/en-us/library/a7zyyk0c.aspx

Has anyone had to make this decision before? What did you decide? Opinions?

Can anyone think of examples that require the use of the data's locale for sorting or filtering?

Thanks in advance.

+2  A: 

I guess it'll have to depend on the use-cases, i.e. what helps the users the most?

If you're an American working with Swedish names, and Swedish people, it'd really help you to view the data sorted using Swedish rules, since that is what most people you're interacting with would expect.

unwind
I guess in 99%, it's the ui locale that you should filter/sort by. This is what the (most) user expects.
Tobias Langner
Agreed. If it's for display to the user, then in the user's locale. If you're sorting the list internally to support binary searches and whatnot, then sort by whatever is fastest.
Ian Boyd
A: 

If your sorting the data just to display it on the screen in a nice list for the user. Sort using the UI locale.

If your sorting the data for storage, or sequencing, use the data locale.

Simon P Stevens
A: 

You should sort using the locale the user expects. In your case, sort based on the the locale selected by the user in the UI. To do otherwise will confuse your users.

Aaron Saarela
+1  A: 

The obvious answer is "what the user expects" Only that it is not so easy to guess what the user expects :-)

For the first answer: "an American working with Swedish names". Can we be sure that the American is familiar with the Swedish sorting rules? I think not. But we are sure he is familiar with the American sorting rules. (if I want to search for the phone number of a friend in Sweden, does it mean I know how they sort over there?)

Some frameworks/OSes can help. There are usually settings in the "Control Panel" (or equivalent) on what locale should be used to do formatting, or sorting. Find out what the API is to retrieve that info and use it.

Usually the UI is localized in one "flavor" of the language, not enough to decide what to do about formatting, sorting, etc. (Think English UI. But I can be in Australia, or UK, or India, where some conventions are different)

If you give some info about your environment, I might be able to point you to the proper APIs.

Mihai Nita