...
Referencing the text item is performed by prefixing the texts id with % where you'd usually put the text, for example
Code Block |
---|
| xml | xml |
---|
title | Original Search panel definition contained within a larger client:config item |
---|
linenumbers | true |
---|
| xml |
---|
|
<view id="com.cohga.html.client.main.searchView">
<label>Search</label>
<location>west</location>
</view>
|
would be become
Code Block |
xml |
---|
| xml |
---|
title | Localised Search panel definition |
---|
linenumbers | true |
---|
| xml |
---|
|
<view id="com.cohga.html.client.main.searchView">
<label>%search.label</label>
<location>west</location>
</view>
|
To actually define the text to be used you need to create a separate client resources
item
Code Block |
xml |
---|
| xml |
---|
title | Setting the default resource value for search label |
---|
linenumbers | true |
---|
| xml |
---|
|
<client:resources>
<resource id="search.label">Search</resource>
</client:resources>
|
...
However, the real point here is to allow the text to be changed for each user based on their preferred language, and the way we do that it to create another client resources item that contains the alternate text and specify what locale the user should ask for for that text to be used. To do this we duplicate the existing resources item and set a lang
property for the resources, for example:
Code Block |
---|
| xml | xml |
---|
title | Setting alternate resource values for search label |
---|
linenumbers | true |
---|
| xml |
---|
|
<client:resources lang="sv">
<resource id="search.label">Hitta</resource>
</client:resources>
<client:resources lang="ru">
<resource id="search.label">находить</resource>
</client:resources>
|
...
Alternate configuration layout
If you need to set a lot of resources it can become quite verbose to set each item with a separate resource
entry in a resources
item, so as an alternative way of creating resources you can build fullstop separated items by nesting tags, for example
Code Block |
---|
| xml | xml |
---|
title | Alternate resource syntax |
---|
linenumbers | true |
---|
| xml |
---|
|
<client:resources>
<search>
<label>Search</label>
<tooltip>
<title>Search</title>
<text>Search for an entity</text>
<tooltip>
</search>
</client:resources>
|
...