structure:componentLabel

This tag gets a label stored in the components attribute “ComponentLabels” (which you may have to add yourself). This removes the need for a global labels content and makes the component much more modular and self contained. It works much like the content:contentAttribute but easier.

Parameters

Name

Req.

Def.

Type

Description

Id

false

 

String

The result is stored in this variable. If not set the result is printed directly to the page.

languageId

false

 

Object/String

The id of the language you wish to get the label in. Default the language the user is browsing the pages in is used.

useAttributeLanguageFallback

false

true

Object/String

If set to true InfoGlue will fallback to the master language version if no label was found in the current language.

mapKeyName

true

 

Object/String

The ComponentLabels-attribute is supposed to be a name-value parameter map and that the attribute we want is found by the key you give here.

 

ID-result variable contains:
The string fetched if id is given.

Examples

The following example gets the label "SearchButtonLabel" from the current component and uses it as the button label. This example assumes that you have a attribute called ComponentLabels with these labels for example:

<structure:componentLabel id="searchButtonLabel" mapKeyName="SearchButtonLabel"/>
<structure:componentLabel id="formHeaderLabel" mapKeyName="FormHeaderLabel"/>

<form name=”searchForm” action=”#”>
<h2><c:out value="${formHeaderLabel}"/></h2>
…..form fields….
<input type=”submit” value=”<c:out value="${searchButtonLabel}"/>”/>
</form>

It is also possible to avoid having several language versions of a component just because of the labels. You can in the main language version state ComponentLabels like this:

FormHeaderLabel_en=Search form
FormHeaderLabel_sv=Sökformulär
SearchButtonLabel_en=Search
SearchButtonLabel_sv=Sök



comments powered by Disqus