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]

Reply via email to