You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steven Banks <SD...@vac-acc.gc.ca> on 2002/07/31 16:24:30 UTC

Internationalizing large amounts of text

I have been asked to convert some static html pages to jsp pages using Struts.  These pages include several very large paragraphs, like important notices and privacy statements.

Should all this text be put into the applicationResource.properties file?  Is it acceptable to have the appropriately internationalized static html text included in the page using an equals tag to determine which language version to include.  



Steven Banks
368-0566


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Internationalizing large amounts of text

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  You can also use Tiles and its i18n capabilities:
Transform your large paragraphs into tiles (i.e. a jsp or an html), one 
for each language.  Save your tiles in your web application:
   mysite/tiles/fr/bigParagraph.jsp
   mysite/tiles/en/bigParagraph.jsp

Create a default definition file 'tiles-def.xml' containing one 
definition for each paragraph:
...
<definition name='bigParagraph' path='/tiles/en/bigParagraph.jsp' />
...

  For each language, create another definition files (ex : 
tiles-def_fr.xml'). The file name should use java i18n naming scheme. In 
this file, overload the default definitions when needed. Specify the 
path for your translated tiles.
...
<definition name='bigParagraph' path='/tiles/fr/bigParagraph.jsp' />
...

And now, in your jsp pages, insert the definition where you want it to 
be displayed:
<tiles:definition name="bigParagraph" />

Tiles will select the appropriate definition according to the local.
An old example of this i18n capability is provided in  
tiles-documentation.war, under the tutorial subdirectory.

  Cedric

Steven Banks wrote:

>I have been asked to convert some static html pages to jsp pages using Struts.  These pages include several very large paragraphs, like important notices and privacy statements.
>
>Should all this text be put into the applicationResource.properties file?  Is it acceptable to have the appropriately internationalized static html text included in the page using an equals tag to determine which language version to include.  
>
>
>
>Steven Banks
>368-0566
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Internationalizing large amounts of text

Posted by Joe Germuska <Jo...@Germuska.com>.
At 11:24 AM -0300 2002/07/31, Steven Banks wrote:
>I have been asked to convert some static html pages to jsp pages 
>using Struts.  These pages include several very large paragraphs, 
>like important notices and privacy statements.
>
>Should all this text be put into the applicationResource.properties 
>file?  Is it acceptable to have the appropriately internationalized 
>static html text included in the page using an equals tag to 
>determine which language version to include.

You could do it that way, but I think it would become a management 
headache.  While I've used properties files for a few multi-line 
messages, the fact that they are line-oriented means you have to be 
careful to maintain line-continuation characters (\) at the end of 
each line in your message.  If you want them to be editable by 
non-programmers, those are the kinds of details they often overlook.

If you're using Struts 1.1 you might consider implementing your own 
Message Resources which doesn't have to use a properties file to get 
its data.  Your version, for example, might look up a text file (or 
HTML fragment) by constructing a path based on the language and the 
message key.

If you're not using Struts 1.1, you might consider writing your own 
custom tag to do something similar.  Writing custom tags is fairly 
easy, although I found Sun's documentation a little unclear -- 
fortunately, you have several working examples in the Struts source 
code to go from.

Hope that helps,
	Joe

-- 
--
* Joe Germuska    { joe@germuska.com }
"It's pitiful, sometimes, if they've got it bad. Their eyes get 
glazed, they go white, their hands tremble.... As I watch them I 
often feel that a dope peddler is a gentleman compared with the man 
who sells records."
	--Sam Goody, 1956
tune in posse radio: <http://www.live365.com/stations/289268>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Internationalizing large amounts of text

Posted by honsali ilia <il...@hps.ma>.
hello
maybe this response come to late but I stand for the "bean_message is
problematic" discussion to finish in order to complete my response
so what I sggest to you is to put the name of your static files in the
ApplicationRessources.properties
ex:

in ApplicationResources_fr.properties:
key.file=/frenchFile.htm
--------------------------------------------------------------------
in ApplicationResources_en.properties:
key.file=/englishFile.htm
--------------------------------------------------------------------
and in the main Page
<%@ taglib uri="struts-bean.tld" prefix="bean" %>
<bean:define id="theFile"><bean:message key="file"/></bean:define>
<bean:include id="pageFile" page="<%=theFile%>" />
<%=pageFile%>
--------------------------------------------------------------------






-----Message d'origine-----
De : David M. Karr [mailto:dmkarr@earthlink.net]
Envoye : jeudi 1 aout 2002 16:18
A : struts-user@jakarta.apache.org
Objet : Re: Internationalizing large amounts of text


>>>>> "Steven" == Steven Banks <SD...@vac-acc.gc.ca> writes:

    Steven> I have been asked to convert some static html pages to jsp pages
using Struts.  These pages include several very large paragraphs, like
important notices and privacy statements.
    Steven> Should all this text be put into the
applicationResource.properties file?  Is it acceptable to have the
appropriately internationalized static html text included in the page using
an equals tag to determine which language version to include.
Note that if you do store this in a properties file, you don't have to have
conditional checks in your page to check for the locale.  Just put the text
associated with each locale in a different locale-specific properties file,
and
the i18n code will find the message for the correct locale.  Your page just
asks for a single message.

--
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Internationalizing large amounts of text

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Steven" == Steven Banks <SD...@vac-acc.gc.ca> writes:

    Steven> I have been asked to convert some static html pages to jsp pages using Struts.  These pages include several very large paragraphs, like important notices and privacy statements.
    Steven> Should all this text be put into the applicationResource.properties file?  Is it acceptable to have the appropriately internationalized static html text included in the page using an equals tag to determine which language version to include.  
Note that if you do store this in a properties file, you don't have to have
conditional checks in your page to check for the locale.  Just put the text
associated with each locale in a different locale-specific properties file, and
the i18n code will find the message for the correct locale.  Your page just
asks for a single message.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>