tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan Jose Pablos" <>
Subject Re: Localization and DefaultServlet
Date Mon, 19 Jun 2000 18:30:04 GMT
Hi Arieh,
I think that you should not use the directory as the way to find the
resource, if you use LocalStrings_<Locale>.properties in the servlet, using
a diferent mapping does not seems right. I mean you know if you use
ResourceBundle.getBundle (resource, Locale), it tires to get it from a
properties file like LocalStrings_<Locale>.properties, so same mapping to
get resources make them easier to remember and understant.

Another thing, For deep path /a/b/c/d, how are you going to search the right
resource  /a/b/c/d/en or /en/a/b/c/d, its seems more expensive than the
other solution isn't it?
if you add the locale information on the name of file
name_<locale>.extension  that information is keep if the file is move to
another directory, if you move <locale>/myfile to /, how do you know the
localize information now?

It is just a few thoughts from a Junior in a chat of experts...


----- Original Message -----
From: "Arieh Markel" <Arieh.Markel@Central.Sun.COM>
To: <>
Sent: Friday, June 16, 2000 7:00 PM
Subject: Localization and DefaultServlet

> So here it is:
> . modify DefaultServlet to operate in a manner similar to
>   ResourceBundle.getBundle (resource, Locale)
>   so that when a document path is looked up, the Locale is factored in
>   the calculation of the real path to the resource
>   example:
>   request:
>   requestLocale: en_US
> defaultserverLocale:  fr_FR
> DocumentRoot: /dir/docRoot/
>    DefaultServlet would try to locate the resource.html file in an
>    appropriately localized subdirectory off DocumentRoot in the following
>    order:
>    1. /dir/docRoot/en_US/resource.html
>    2. /dir/docRoot/en/resource.html
>    3. /dir/docRoot/fr_FR/resource.html
>    4. /dir/docRoot/fr/resource.html
>    5. /dir/docRoot/resource.html
> The advantage of the approach is that the hypertext links (HREF in the
> documents) request no localization.
> A disadvantage is that there is more work to do for every request.
> Also, that there is valid direct access to the localized resource.
> Another disadvantage is that it forces to lay out the files in a specific
> manner.
> (I would add that it would have been possible to include the 'locale'
> as part of the basename of the file - i.e.
> however, the manipulation of the concatenated strings makes it more
> complicated in my opinion).

View raw message