Dashboard > WebWork > ... > Data Tags > text
  WebWork Log In View a printable version of the current page.  
  text
Added by Onyeje Bose, last edited by Rainer Hermanns on Apr 13, 2007  (view change)
Labels: 
(None)

Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.

Description

Render a I18n text message.

The message must be in a resource bundle with the same name as the action that it is associated with. In practice this means that you should create a properties file in the same package as your Java class with the same name as your class, but with .properties extension.

If the named message is not found, then the body of the tag will be used as default message. If no body is used, then the name of the message will be used.

Parameters

Name

Required

Default

Type

Description

name true   Object/String Name of resource property to fetch
id false   Object/String id for referencing element. For UI and form tags it will be used as HTML id attribute

Examples

Accessing messages from a given bundle (the i18n Shop example bundle in the first example) and using bundle defined through ww in the second example.</p>
<!-- First Example -->
<ww:i18n name="webwork.action.test.i18n.Shop">
    <ww:text name="main.title"/>
</ww:i18n>

<!-- Second Example -->
<ww:text name="main.title" />

Other example

<ww:text name="format.money"><ww:param name="value" value="myMoneyValue"/></ww:text>

where

format.money={0,number,currency}

For documentation on possibilities for formatting text, see

  1. http://java.sun.com/j2se/1.4.2/docs/api/java/text/MessageFormat.html
  2. http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html

How to use this feature in other tags? for example <ww:select label="%

Unknown macro: {text('mylabel')}
" ... /> ???

Posted by Mariusz Smykula at Feb 13, 2006 09:28 | Permalink
Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators