Content pages for use in an ATG application contain standard HTML tags and JHTML or JSP tags. When translating text within or between JHTML or JSP tags, take care to translate only the text that will appear to the user; all other code should remain in English. Any text located between the <oparam>
</oparam>
tags must be translated. There are certain cases when text within <param
>, <input
>, and <java
> tags should be translated. There are also cases when this text should remain in English.
This section provides an overview of the rules that should be followed when translating content pages.
In this section, all text that requires translation is displayed in italics.
HTML Tags
Standard HTML text, such as paragraph text, anchor tag values, text in lists, and submit button values must be translated.
Oparam Tags
In general, the text to translate in a content page is located between <oparam
> </oparam
> tags. You should not translate the text within the <oparam
> tag. In the following JSP example, you would translate the text that is shown in italics:
<dsp:oparam name="keyA">Text to translate
</dsp:oparam>
Param Tags
Take great care when translating text within <param
> tags. There are certain instances when text within <param
> tags should be translated and certain cases when it should not.
Value Param Tags
In the following JHTML example, the value
text should be translated.
<droplet src="header.jhtml">
<param name="storename" value="Text to translate
">
</droplet>
Here is the same example in JSP code:
<dsp:include page="header.jsp">
<dsp:param name="storename" value="Text to translate"/>
</dsp:include>
Key Value Param Tags
In the following JHTML example, the values associated with each key value should be translated:
<param name="messageTable"
value="oneWordCheckFailed=Text to translate
"
value="missingRequiredField=Text to translate
">
Bean Value Param Tags
In the following JHTML example, no text should be translated. This is because the <param
> value is defined as a bean property.
<param name="value" value="bean:SurveyBean.formError">
The same example in JSP code does not use a value attribute, so here it is clearer that no text needs to be translated:
<dsp:param bean="SurveyBean.formError" name="value"/>
Param Tags within Anchor Tags
In the following JHTML example, the <param>
tag is nested within an anchor tag. In this case, the <param
> value should be translated. In addition, the text between the <a href
></a
> tags should be translated.
<a href="rainbow.jhtml">
<param name="position" value="Text to translate
">
Text to translate
</a>
Here is the same example in JSP code:
<dsp:a href="rainbow.jsp">
<dsp:param name="position" value="Text to translate
"/>
Text to translate
</dsp:a>
For more information on <param>
tags, refer to the ATG Page Developer's Guide
Input tags
There are certain cases when text within <input>
tags should be translated and certain cases when it should not. (Note: The following examples are from JHTML pages, but the same rules apply to the equivalent JSP code.)
Default Values in Text Bean Input Tags
In the following example, there is a default value specified for the value
attribute. This value is visible to the user. In this case, the default value text for this attribute should be translated.
<input type=text bean="{component name}.{property name}"
[name="{input name}"] [value="{Text to translate
}"]>
Default Values in Hidden Bean Input Tags
In the following example, no text should be translated. The default value of the value
attribute is a hidden value that is not visible to the user.
<input type=hidden bean="{component name}.{property name}"
[name="{input name}"] [value="{default value}"]>
Checkbox Input Tags
In the following example, input tags are used to display a checkbox. In this case, no text should be translated.
<input type=checkbox bean="{component name}.{property name}"
[name="{input name}"] [checked | unchecked]>
In the following example, multiple options are displayed with checkboxes. In this case, the text following the input tag should be translated.
<input type=checkbox bean="/test/person.hobbies" value="swimming"> Text to translate <input type=checkbox bean="/test/person.hobbies" value="biking"> Text to translate <input type=checkbox bean="/test/person.hobbies" value="photography"> Text to translate
Radio Button Input Tags
In the following example, input tags are used to display radio buttons. In this case, no text should be translated.
<input type=radio bean="{component name}.{property name}"
name="{button name}" value="{button value}" [checked | unchecked]>
Image Input Tags
An image input is represented as an image (taken from the src
attribute). In this case, no text should be translated.
<input type=image bean="{component name}.{property name}"
[name="{input name}"] src="{image URL}" submitvalue="{submit value}">
Submit Input tags
In the case of submit input tags, the value associated with the submit button should be translated.
In the following example, the value
attribute specifies the button value. This text should be translated.
<input type=submit bean="{component name}.{property name}"
[name="{input name}"] [value="{Text to translate
}"]>
In the following example, the text prior to the input tags and the submit button value should be translated:
<form enctype="multipart/form-data" action="a_page.jhtml" method="POST"> Text to Translate <input type=file bean="/FileUploadComponent.uploadProperty"> <input type=submit value="Text to translate"> </form>
Java Tags
In general, text within <java
> tags should not be translated. There is one exception to this rule: any text associated with an out.print
or out.println
statement should be translated if the text is located between quotes.
Example A
In the following example, the text within quotes following the out.println
statement should be translated. Note that the word “operation” should not be translated.
<java> if (operationTable.size() == 0) { out.println("<p>Text to translate <i>" + operation + "</i>"); return; } </java>
Example B
In the following example, the only text to translate is the text within quotes following the out.println
statement. Note that "dispatcherServiceMap"
should not be translated.
<java> if ( !configure.isDefaultServer() && !configure.isUsingDefault("dispatcherServiceMap") ) out.println( " text to translate " ); </java>
Example C
In the following example, although there is an out.print
statement, there is no text within quotes. Therefore nothing should be translated.
<java> out.print( key ); </java>
Example D
In the following example, nothing should be translated, because there are no out.print
or out.println
statements.
<java> /* default the path parameter */ String path = request.getParameter("path"); if (path == null) request.setParameter("path", "/demo/"); </java>