|
Version 4.10.0 | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
Translator | Translate base text into a localized form. |
Class Summary | |
---|---|
Messages | Custom tag for rendering a MessageList . |
Text | Custom tag for translating base language text (or a "coder key") into a localized form, and applying "wiki-style" formatting. |
TextFlow | Custom tag for translating regular text flow in large sections of a web page. |
Tooltips | Custom tag for translating TITLE, ALT and submit-button VALUE attributes in markup. |
Translation | Model Object for a translation. |
Translation.LookupResult | The result of Translation.lookUp(String, Locale, Map) . |
Translation of text for multilingual applications.
To achieve the first goal, WEB4J uses a policy of "last-second localization", whereby translations are performed outside of normal code, and only in Java Server Pages, using custom tags. This corresponds to the idea that a translation is "just a view".
LocaleSource
defines how an application deduces
a Locale
from an incoming request (using a policy defined by your application).
LocaleSource
is passed to
a Translator
, which defines how an application translates
base text into a given target language.
Text
tag uses the above to perform the translation
"at the last second", in a JSP.
TextFlow
tag translates all the text flow (the text appearing
outside of tags) appearing in its body. This tag is suitable for translating large sections
of markup whose text flow is simple and non-structured.
Tooltips
tag translates all TITLE
and ALT attributes appearing in its body (it also translates the text of SUBMIT buttons).
If placed in a high-level template, it
translates those attributes across a large number of pages - perhaps even the whole site.
Messages
tag translates the
AppResponseMessage
s emitted by Action
s.
Translator
,
that simply returns the base text, unchanged and untranslated
Text
,
Tooltips
,
TextFlow
,
and Messages
tags during development,
to internationalize JSPs from the beginning. (The text is not localized at this point.)
Translator
implementation, to always record the base text in some way (save to the database, or to an in-memory List,
for example). Thus, by simply exercising all parts of the application
(including all possible error messages), one may generate a listing of all items that need translation.
Translator
implementation. (See the example application for illustration.)
If an existing application needs to be changed from a single-language style to a multilingual style, then a similar technique may be used.
ResourceBundle
Translator
may be backed by a
ResourceBundle, the recommended style is to use a database instead.
ResourceBundle is a
mediocre tool for web applications.
|
Version 4.10.0 | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |