Dashboard > Community Wiki > ... > Developing with Magnolia > I18n Developer Information
I18n Developer Information Log In View a printable version of the current page.

Added by GrĂ©gory Joseph , last edited by Boris Kraft on Jun 23, 2008  (view change)
Labels: 

This is the latest information. there are some jira tasks which can have an impact on the current i18n solution (more in the context of configuration than to the api).

configuration

the configuration is done in Config repository: /server/i18n:

  • define the application language (change the language node)
  • the fall back language is en
  • the standard bundle is info.magnolia.module.admininterface.messages_en.properties

General

  • We use Propertyfiles
  • We use JSTL fmt tags
  • Each module has his own messages bundle

JSP

Use the standard fmt JSTL Tags

examples:

<title><fmt:message key="central.title"/></title>

<fmt:message key="buttons.editfooter" var="label"/>
<cms:editButton label="$\{label}" ..

JavaSide (servlet, beans, ..)

Use the MessagesManager.getMessages(request, ...) to get the Messages or MessagesManager.get(request, ....) to get a string. The mechanism will handle the exception if the request is null.

javax.servlet.jsp.jstl.fmt.LocaleSupport

If you can provide a PageContext, you can use the static methods of this class. Our system is behaving like JSTL so you will get the same result.

Dialogs, Paragraphs

the labels, .. can define a key which is searched in this order

  1. info.magnolia.module.admininterface.messages_templating_custom.properties
  2. info.magnolia.module.admininterface.messages_templating.properties
  3. if not found return the label (it is not a key)

The class used in this case is TemplateMessagesUtil providing some static methods.

messages_templating and messages_templating_custom

I separated the strings, because we said that a bundle must be translated fully. in the messages_templating are our delilvered dialog, paragraph strings. If someone needs his own i18n-dialogs he will put the strings in messages_templating_custom. In this way he can have chinese-dialogs without a fully translated chinese-magnolia.

Javascript

Use the Object mgnlMessages.get(key, basename, args[]). basename and args are optional.

Keys starting with js. will be added to the mgnlMessages-Object by admintemplate/js/messages.jsp

Powered by a free Atlassian Confluence Open Source Project License granted to Magnolia International. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators