Laurie,

Thanks a bunch for taking the time to respond. This helps us a lot. We really appreciate it.

Keith

Laurie Harper wrote:
Keith Fetterman wrote:
We could use some help from people that have experience internationalizing their Struts applications. I'd like to find out what the best practice is for handling these three cases:

1. One or more large paragraphs of text.

Depending on how large the paragraphs are and how they need to be managed, you may want to look at storing them in a database or other alternative format, but storing them in your application properties will work perfectly well too.

2. Text that has markup language or HTML tags mixed in, for example image tags, links or anchor tags, etc.

In general you should try to avoid that ;-) Some people feel more strongly than others on this issue, and it certainly can be useful sometimes to include markup in resource bundle text. But I would recommend that, if you have more than occasional need to do that, you localize your JSPs for those cases in addition to using resource bundles.

The main mechanism for doing that in Struts is Tiles. You can set up a set of Tiles definitions, then modify them on a per-locale basis. I'd still recommend you externalize as much as you can into resource bundles, though, in order to minimize the need for repetition in localized JSPs.

3. Text that has Struts or JSTL tags mixed in.

In that case, you should *really* try to avoid doing it by structuring your pages appropriately. You can't use resource bundles for this, since text pulled from a resource bundle (with, for example, bean:message) isn't parsed for JSP custom tags. To handle this, you would have to fall back on using localized JSPs via Tiles or something similar.

What has people found to be the easiest to maintain?

One JSP, with all localizable content held in, or referenced by, resource bundle strings. One tip is you can have a resource string that's a URL path pointing to, say, a localisable image or page fragment. That might be simpler than adding template/JSP internationalization via Tiles, etc.

Is the markup language stored in the message resources file?

Not if I can help it, and not in large chunks.

Or, is the text broken up into chunks, which is stored in the message resources file and the markup language stays in the JSP files?

If the text is broken into chunks, what happens when the sentence structure changes for a different language?

Ugh, no, don't do that, ever :-) For small amounts of inline markup, put it in the resource bundle. If things get too messy, you can always have one resource bundle for plain text, and another for marked up text. Or break those parts of the page out into localized tiles or something.

If a large paragraph of text is stored in messages resources file, is there a way to wrap it so it is easier to maintain?

Yep, just use standard .properties file formatting conventions.

Are there any other pitfalls we need to look for?

Many ;-) I highly recommend Java Internationalization (Andrew Deitsch & David Czarnecki; O'Reilly) to get a good foundation in the basics of I18N.

I have researched this issue all day on the Web, and have found no information that addresses these issues. I have also looked at several books and they don't address them either.

See above. Most Struts books also include information on the Struts-specific features or localization.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to