In the simplest case you should store messages using ResourceBundle
properties file in your component module to use internationalization.
The location of the properties file should be in the same package as the related component(s) and is named Messages
(ex: org.talend.demo.MyComponent
will use org.talend.demo.Messages[locale].properties
).
Default components keys
Out of the box components are internationalized using the same location logic for the resource bundle and here is the list of supported keys:
Name Pattern | Description |
---|---|
${family}._displayName |
the display name of the family |
${family}.${configurationType}.${name}._displayName |
the display name of a configuration type (dataStore or dataSet) |
${family}.${component_name}._displayName |
the display name of the component (used by the GUIs) |
${property_path}._displayName |
the display name of the option. |
${simple_class_name}.${property_name}._displayName |
the display name of the option using it class name. |
${enum_simple_class_name}.${enum_name}._displayName |
the display name of the |
${property_path}._placeholder |
the placeholder of the option. |
Example of configuration for a component named list
belonging to the family memory
(@Emitter(family = "memory", name = "list")
):
memory.list._displayName = Memory List
Configuration class are also translatable using the simple class name in the messages properties file. This useful when you have some common configuration shared within multiple components.
If you have a configuration class like :
public class MyConfig {
@Option
private String host;
@Option
private int port;
}
You can give it a translatable display name by adding ${simple_class_name}.${property_name}._displayName to Messages.properties under the same package as the config class.
MyConfig.host._displayName = Server Host Name
MyConfig.host._placeholder = Enter Server Host Name...
MyConfig.port._displayName = Server Port
MyConfig.port._placeholder = Enter Server Port...
If you have a display name using the property path, it will override the display name defined using the simple class name. this rule apply also to placeholders |