Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Client resources

When configuring client items in Weave it's possible to set the text displayed to the user for various items directly, this is generally done by setting a 'label', 'text' or 'tooltip' type of properties for the items.

Previously when these values were set they would completely replace the value displayed for every user, however a recent update in Weave provides version 2.4.7 of Weave introduced a way to set these values indirectly and have a different value provided to the user based on their location.

Warning

Currently this localisation method is only available for properties set within a client config, so for example it's not yet possible to specify localised labels for an entity or a search using this method.

The actual values to be displayed to the users are set in a separate client resources configuration item, where you outline the text to be displayed to the user and give each piece of text a unique id, then reference that id where previously you'd use the text directly.

...

Code Block
xml
xml
titleSetting the default resource value for search label
linenumberstrue
	<client:resources>
		<resource id="search.label">Search</resource>
	</client:resources>
Note

The client resources item is not embedded within the client config, and is a separate top level configuration item in its own right and would be included at the same level as the client config item.

Info

You can create as many resources configuration items as you like, this allows you to either keep one single large resources section or break them up and locate them close to the items that they're used in.
Keeping them in a separate file and including them into your configuration is also a useful way to reduce clutter.

...

Here we've set alternate values for the search label for Swedish and Russin Russian users, with no change required to the configuration for the search panel and nothing required from the user.

Info

The original resource item didn't set a lang property, so it will be the default value for any properties that haven't specifically been overwritten by locale specific versions, so someone from Italy would see the English label for the search panel.
The default value could have just as easily have been specified in Italian and an English specific resource could have been created (using 'en' and the language) if the site is intended primarily for Italian speaking users

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
titleAlternate resource syntax
linenumberstrue

	<client:resources>
		<search>
			<label>Search</label>
			<tooltip>
				<title>Search</title>
				<text>Search for an entity</text>
			<tooltip>
		</search>
	</client:resources>

This will define search.label, search.tooltip.title and search.tooltip.text