tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arieh Markel <Arieh.Mar...@Central.Sun.COM>
Subject Localization and DefaultServlet
Date Fri, 16 Jun 2000 18:00:53 GMT
I am about to tackle the issue of locating localized versions of
web-resources (html files, images, etc).

Perhaps the topic has been already discussed. If so, apologies.

I would like to get input as far as the applicability of the proposal
I am about to make.

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:		http://bar.com/resource.html
  	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' string
as part of the basename of the file - i.e. /dir/docRoot/resource_en_US.html,
however, the manipulation of the concatenated strings makes it more
complicated in my opinion).


----

I understand that I could implement the same within our code, by extending
DefaultServlet and refer to it on the web.xml for the application.

----

So, I would like to hear some opinions about the solution, whether it is 
worthwhile resolving for the general case, or whether I just need to
implement it within our own application.

Thanks.

Arieh
--
 Arieh Markel		                Sun Microsystems Inc.
 Network Storage                        500 Eldorado Blvd. MS UBRM11-194
 e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
 Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
 (e-mail me with subject SEND PUBLIC KEY to get public key)


Mime
View raw message