Create custom localized labels

This guide will help you create custom localized labels.

Default custom localized resources path

ARender internationalization approach uses .properties files where localizable information are stored in.

ARender allows you to customize localized labels from external custom resource files.

By default, ARender uses the following order to fetch custom localized resource files:

  • Configuration properties
  • <HOME_DIR>/ARenderCustomLabels/
  • arondor-arender-hmi-spring-boot-2023.1.0.jar\BOOT-INF\classes\labels\

To go further

Define the folder path containing the custom labels

To define the folder path where the custom labels are stored, you must edit the following property :

configurations/arender-custom-server.properties
# ARender label configuration
# Define the folder path where the custom labels are stored
# Otherwise leave empty so that ARender can look in the <HOME_DIR>/ARenderCustomLabels/ or in the labels/ folder
# NB: Make sure the path ends with a file separator, the slash /
arender.server.external.custom.labels.path=

Create your own custom localized labels

Typical resource files are named as CustomLabels_{lang}.properties, which lang corresponds to locale code :

  • ar (Arabic)
  • de (German)
  • en (English)
  • es (Spanish)
  • fr (French)
  • he (Hebrew)
  • it (Italian)
  • ja (Japanese)
  • pl (Polish)
  • pt (Portuguese)
  • pt-BR (Brazilian Portuguese)
  • ru (Russian)
  • zh-CN (Simplified Chinese)
  • zh-TW (Traditional Chinese)

For each language or the one needed, store localizable information in the form of case-sensitive key-value pairs.

To provide a concrete example, suppose you need a custom label for a custom button in 3 different languages: english, spanish and french :

These .properties files are to be placed whether in <HOME_DIR>/ARenderCustomLabels/ or in *arondor-arender-hmi-spring-boot-2023.1.0.jar\BOOT-INF\classes\labels*.

CustomLabels_en.properties
hello=Hello World
CustomLabels_es.properties
hello=Hola Mundo
CustomLabels_fr.properties
hello=Bonjour le monde

To use this custom label, you will need to reference it with the tag customLabels#{label-key}.

Since version 2023.0.0:

configurations/arender-custom-server-integration.xml
<!-- Sample implementation of a Custom button -->
<bean id="customButton"
		class="com.arondor.viewer.client.toppanel.presenter.ButtonPresenter">
		<constructor-arg value="customButton"/>
		<property name="enabled" value="true" />
		<property name="className" value="standardButton icon-arender" />
		<property name="buttonTitle">
			<value>Custom Button</value>
		</property>
		<property name="buttonHandler">
			<bean class="com.arondor.viewer.client.jsapi.toppanel.JSCallButtonHandler">
				<property name="jsCode">
					<value>
						try
						{
						alert('Hello world !');
						$wnd.getARenderJS().getGenericNotificationJSAPI().askNotification("hello");
						alert("Finished !");
						}
						catch(e)
						{
						alert("error !" + e);
						}
					</value>
				</property>
			</bean>
		</property>
	</bean>