Kelly,

I think you have conflicting requirements. You can't rely on strings outside
the database for I18N support and then rely on them for sorting within the
database. I think this leaves you with two options:

1. Create a 2nd table which contains your text messages. Join to this table
and pull of the correct column which represents the language you want (en,
de, etc.)

2. Do the sorting in your middle tier.

Thanks,
Paul

-----Original Message-----
From: Kelly Harward [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 10, 2005 1:32 PM
To: user@struts.apache.org
Subject: Problem with localization and database sorting


This isn't necessarily a Struts-specific question, but I'm hoping I can get
some good ideas from this group.

I'm working on a Struts-based web app that has various i18n requirements.
Struts handles the localization quite well and for the most part makes the
need to support a new language pretty trivial.

However, I've come up against a problem that I'm sure is not unique to this
Struts app and hoping to hear how others have handled this issue. Like many
web apps, we display a lot of tabular data that is stored in an RDBMS. We
have the requirement to allow users to sort columns by clicking on the
column header (which munges the SORT BY clause on the underlying SQL query
and relegates the actual task of sorting the data to the database).

In many instances, we have various properties that are stored in the
database using arbitrary tokens (think of an event log where the notion of
event type is represented in the database as an integer). When rendering the
result set obtained by querying the database, we typically apply a renderer
to decorate those columns where the data is represented using the arbitrary
token (in the event log example, the renderer for the event type column
might be responsible for transforming the integer "2" into the more
user-friendly string "Warning").

Struts makes it pretty easy for us to provide a mapping between arbitrary
tokens (stored in the database) and localized strings (displayed to users).
We can support additional languages very easily simply by providing a new
mapping between the various tokens and their corresponding string
representations in the language we are required to support.

However, since we are relying on the database to do the sorting for us, when
we allow users to sort on a column that is represented in the database by
some token the database is going to sort on the token which is not
necessarily the natural ordering for the string values the users are seeing
(they would expect the natural order to be alphabetical ordering of the
translated strings we are displaying to them). Obviously we could attempt to
correlate the natural ordering of the tokens to the desired ordering of
their string representations, but this breaks down as soon as you attempt to
add support for a second language.

Anyone ever come across this dilemma and have any ideas on how to solve it?

Thanks in advance,

-Kelly


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains 
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New 
Jersey, USA 08889), and/or its affiliates (which may be known outside the 
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as 
Banyu) that may be confidential, proprietary copyrighted and/or legally 
privileged. It is intended solely for the use of the individual or entity named 
on this message.  If you are not the intended recipient, and have received this 
message in error, please notify us immediately by reply e-mail and then delete 
it from your system.
------------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to