(This is a starter page on multilingual use of JSPWiki.)

Christian Fischer wrote into the Jspwiki-users mailing list:

Our application is multilingual; the language is chosen by reading the browser properties. The documentation should by multilingual, too. Is there any possibility to store JSPWiki files in different languages and let JSPWiki detect the language automatically?

Unfortunately there is no built-in facility to do that.

However, it should be pretty easy to do by making a template, which would simply look at the browser properties and insert the proper page. The <wiki:InsertPage> tag allows you to specify the "page" parameter, which allows you to include something else than the current page.

For example

<% String language = MyBean.figureOutUserLanguage()
       WikiContext ctx = WikiContext.findContext( pageContext );
       String pageName = ctx.getPage().getName() + "_" + language;
%>

<wiki:InsertPage page="<%=pageName%>"/>

This would allow you to have pages such as "FooBar_en", "FooBar_de", etc. Just use JSP scriptlets creatively :)

Add safeties and checks as necessary. The WikiContext.findContext() is not available until 2.4, though — in 2.2 you have to examine the JSP pages on how it could be done.

(This example is totally untested and from memory, so you might want to use your own judgement when coding :)

/Janne

Discussion

...

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.
« This page (revision-6) was last changed on 01-Aug-2006 11:49 by Christian Fischer