You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Arieh Markel <Ar...@Sun.COM> on 2001/03/14 16:19:16 UTC

Proposal for implementation of lookup of localized web-resources

We are about to release a product on which we include Tomcat 3.2.

Our testing and localization people have been banging at our product
and come up with several remarks about how lookup for a localized
resource (file: html, gif, javascript, etc) are being done.

I have in the past contributed localization code to the 3.2 code base.

I have received a couple of remarks from the localization people.

The current way that localization is done on the code I contributed
to 3.2 was what I called 'file-based' lookup.

An alternative method that I implemented in our application (but have
not contributed to Jakarta yet) is 'docbase-based' lookup.

Here is a brief overview of both mechanisms:

Assume locale in request is:		fr_CA
Assume locale of where tomcat is set:	en_US


   requested path	
   
 		<docbase>/dir/.../index.html  

   file-based:		(path/<filebasename>[locale].filetype)
   
1. <docbase>/dir/.../index_fr_CA.html
2. <docbase>/dir/.../index_fr.html
3. <docbase>/dir/.../index_en_US.html
4. <docbase>/dir/.../index_en.html
5. <docbase>/dir/.../index.html


   docbase-based:	([locale]/path/filename)

1. <docbase>/fr_CA/dir/.../index.html
2. <docbase>/fr/.../index.html
3. <docbase>/en_US/.../index.html
4. <docbase>/en/.../index.html
5. <docbase>/dir/.../index.html


File-based lookup works in a manner similar to how ResourceBundle does.

Docbase-based lookup is similar to how JavaHelp organizes the files.

----

Implementation proposal:

a. create a class 'org.apache.tomcat.util.Localization' (for 3.x).
	          'org.apache.catalina.util.Localization' (for 4.x).

b. implement two static methods:

	public static String getLocalizedPathFileBased (
			String dir, String path, Locale loc, Locale fbLoc)
			
	public static String getLocalizedPathDocBaseBased (
			String dir, String path, Locale loc, Locale fbLoc)


c. For 3.x:  in StaticInterceptor, add "localization" as a property
   with valid values of:
   		"file" "docbase"
   		
d. For 4.x:  (I have just begun looking at the code yesterday - would
	      appreciate some pointers from the 4.x experts of where the
	      serving of resource is done)
	      
----

Any opinions ?

Much of the code has already been written and has been tested.


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


Re: Proposal for implementation of lookup of localized web-resources

Posted by David Rees <db...@greenhydrant.com>.
On Wed, Mar 14, 2001 at 08:19:16AM -0700, Arieh Markel wrote:
> 
>    file-based:		(path/<filebasename>[locale].filetype)
>    
> 1. <docbase>/dir/.../index_fr_CA.html
> 2. <docbase>/dir/.../index_fr.html
> 3. <docbase>/dir/.../index_en_US.html
> 4. <docbase>/dir/.../index_en.html
> 5. <docbase>/dir/.../index.html

Why not use the same setup that Apache uses?  If you ever plan on
integrating Tomcat/Apache, this will make the transition painless.

Apache uses this by default I believe:

1. <docbase>/dir/.../index.html.fr
2. <docbase>/dir/.../index.html.en
3. <docbase>/dir/.../index.html

You can read more about it here:

http://httpd.apache.org/docs/content-negotiation.html

-Dave

Re: Proposal for implementation of lookup of localized web-resources

Posted by Kazuhiro Kazama <ka...@ingrid.org>.
Arieh,

Basically lookup of localized resources is welcomed. As I have
evaluated your localization codes to 3.2, I write comments:

1, Your file-based naming scheme isn't compatible with apache
MultiView function that David Rees and Takashi Okamoto says.

Now apache naming scheme becomes popular in Japan. But almost nobody
uses your naming scheme. It is unhappy that we must change all
filename that is written by apache naming scheme.

At the least, compatible option is needed.

2, In your file-based approach & docbase-approach, we can't specify
charset of HTML files. It is desiable that charset will be supported
in consideration of Content-Type header.

3, I think your file-based lookup don't work for JSP files by my
experience (true?). But I hope you will support same localization for
JSP files.

Kazuhiro Kazama (kazama@ingrid.org)	NTT Network Innovation Laboratories

Re: Proposal for implementation of lookup of localized web-resources

Posted by Takashi Okamoto <to...@rd.nttdata.co.jp>.
Hi!!

From: "Arieh Markel" <Ar...@Sun.COM>
> Assume locale in request is: fr_CA
> Assume locale of where tomcat is set: en_US
>
>
>    requested path
>
>   <docbase>/dir/.../index.html
>
>    file-based: (path/<filebasename>[locale].filetype)
>
> 1. <docbase>/dir/.../index_fr_CA.html
> 2. <docbase>/dir/.../index_fr.html
> 3. <docbase>/dir/.../index_en_US.html
> 4. <docbase>/dir/.../index_en.html
> 5. <docbase>/dir/.../index.html
>
>
>    docbase-based: ([locale]/path/filename)
>
> 1. <docbase>/fr_CA/dir/.../index.html
> 2. <docbase>/fr/.../index.html
> 3. <docbase>/en_US/.../index.html
> 4. <docbase>/en/.../index.html
> 5. <docbase>/dir/.../index.html

Did you read following apache URL?
http://httpd.apache.org/docs-2.0/content-negotiation.html

I think your proopsal is good. But unfortunately, your proposal will lose
compatibility with Apache.
Please rewrite your proposal.

regards.
----------------------
Takashi Okamto


Re: Proposal for implementation of lookup of localized web-resources

Posted by cm...@yahoo.com.
+1 for 3.3

+1 for 3.2 if the code change is just adding few methods ( that can't
affect anyone ) and a one line change in StaticInterceptor
( and if the release manager is comfortable with that - but that's the
default :-)

Costin


On Wed, 14 Mar 2001, Arieh Markel wrote:

> We are about to release a product on which we include Tomcat 3.2.
> 
> Our testing and localization people have been banging at our product
> and come up with several remarks about how lookup for a localized
> resource (file: html, gif, javascript, etc) are being done.
> 
> I have in the past contributed localization code to the 3.2 code base.
> 
> I have received a couple of remarks from the localization people.
> 
> The current way that localization is done on the code I contributed
> to 3.2 was what I called 'file-based' lookup.
> 
> An alternative method that I implemented in our application (but have
> not contributed to Jakarta yet) is 'docbase-based' lookup.
> 
> Here is a brief overview of both mechanisms:
> 
> Assume locale in request is:		fr_CA
> Assume locale of where tomcat is set:	en_US
> 
> 
>    requested path	
>    
>  		<docbase>/dir/.../index.html  
> 
>    file-based:		(path/<filebasename>[locale].filetype)
>    
> 1. <docbase>/dir/.../index_fr_CA.html
> 2. <docbase>/dir/.../index_fr.html
> 3. <docbase>/dir/.../index_en_US.html
> 4. <docbase>/dir/.../index_en.html
> 5. <docbase>/dir/.../index.html
> 
> 
>    docbase-based:	([locale]/path/filename)
> 
> 1. <docbase>/fr_CA/dir/.../index.html
> 2. <docbase>/fr/.../index.html
> 3. <docbase>/en_US/.../index.html
> 4. <docbase>/en/.../index.html
> 5. <docbase>/dir/.../index.html
> 
> 
> File-based lookup works in a manner similar to how ResourceBundle does.
> 
> Docbase-based lookup is similar to how JavaHelp organizes the files.
> 
> ----
> 
> Implementation proposal:
> 
> a. create a class 'org.apache.tomcat.util.Localization' (for 3.x).
> 	          'org.apache.catalina.util.Localization' (for 4.x).
> 
> b. implement two static methods:
> 
> 	public static String getLocalizedPathFileBased (
> 			String dir, String path, Locale loc, Locale fbLoc)
> 			
> 	public static String getLocalizedPathDocBaseBased (
> 			String dir, String path, Locale loc, Locale fbLoc)
> 
> 
> c. For 3.x:  in StaticInterceptor, add "localization" as a property
>    with valid values of:
>    		"file" "docbase"
>    		
> d. For 4.x:  (I have just begun looking at the code yesterday - would
> 	      appreciate some pointers from the 4.x experts of where the
> 	      serving of resource is done)
> 	      
> ----
> 
> Any opinions ?
> 
> Much of the code has already been written and has been tested.
> 
> 
> Arieh
> --
>  Arieh Markel		                Sun Microsystems Inc.
>  Network Storage                        500 Eldorado Blvd. MS UBRM11-194
>  e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
>  Pray for snow !!!!                     Phone: (303) 272-8547 x78547
>  (e-mail me with subject SEND PUBLIC KEY to get public key)
>