Use GWiki I18N outside GWiki

For internationalisation Java uses properties files to provide text elements for different languages.
GWiki can be used to online maintainging this international texts.

Create I18N-Elements

Inside GWiki you can create I18N Files containing properties files for different languages.
If you want use the I18N Keys in pages which has no gwiki authentification, you have to give GWIKI_PUPLIC for read access (See Settings in the I18N Page Editor).

Make usage of

GWiki provides an Servlet Filter, which has to inserted in the web.xml:


The I18NModules value contains a comma seperated list of pages containing GWiki I18N Elements. This elements are used to translate the I18N Keys.


Add a filter mapping (*.do, *.action, depending which framework you use) to the page URLs, which containing I18N Keys.

If you have another filter, which provides I18N-Mechanism, add the filter mapping of GWIKi at last position. In this case GWiki delegates translation to the previsous filter.

In you JSP-File you can now using the fmt:message tag:

<%@ taglib uri="/WEB-INF/tlds/c-rt.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tlds/fmt-rt.tld" prefix="fmt"%>
<script type="text/javascript"
	src="<c:url value="/gwiki/static/js/jquery-1.4.min.js"/>"></script>
<script type='text/javascript'
	src="<c:url value='/gwiki/static/js/jquery.bgiframe.min.js'/>"></script>
	<script src='<c:url value="/gwiki/static/js/jquery.contextmenu.js"/>' type="text/javascript"></script>
<script type="text/javascript"
	src="<c:url value="/gwiki/static/gwiki/gwiki-i18n-contextmenu-0.3.js"/>"></script>
<style type="text/css">
.gwiki18nk {
	background-color: #EEEEEE;
<div id="gwikii18nmenu" style="font-size:0.7em;display:none;width:650px;background-color:white;border:1px solid black;padding:5px;"></div>

<h1>GWiki I18N Example.</h1>
This is a <fmt:message key="" /> and a message: <fmt:message key="gwiki.edit.EditPage.label.noNotificationEmails" />.


Inline Editing

To enable Inline editing set in request the variable gwiki18ndeco to true:

pageContext.getRequest().setAttribute("gwiki18ndeco", "true");

If the current user has the right to edit the underlying I18N element, the values can directly edited by the right context menu.
You can use the gwiki18nk style to higlight the used i18n Keys.

This page will be shown as:

Last modified 2010-04-14 13:29 by rkommer. ViewCount: 12998
By Roger Rene Kommer and Micromata