4.4.2.3. getApplicationName

The getApplicationName method has to return a display name for the content handler. The passed languageCode argument is the user interface language for which the application name shall be retrieved. You could just ignore the languageCode argument and return a language independent application name, for example:
    public String getApplicationName(String languageCode)
    {
        return "My Text Viewer";
    }
However, if the application name shall be language dependent, you can use the the getLabel method of the org.docma.plugin.PluginUtil class to return a localized application name:
    public String getApplicationName(String languageCode)
    {
        String key = getApplicationId() + ".application_name";
        return PluginUtil.getLabel(languageCode, key, null);
    }
Given this implementation, the application name has to be defined in a file named locale.properties, which needs to be placed in the content handler directory. Assuming that the content handler identifier is "my_text_viewer", this file has to contain a property named "my_text_viewer.application_name":. In other words, the locale.properties file has to contain a line as follows:

    my_text_viewer.application_name = My Text Viewer

Listing 4.4.1. locale.properties (viewer example)

To provide a localized application name, for example for the German language (language code "de"), you just have to copy the locale.properties file, rename it to locale_de.properties and translate the property value(s):

    my_text_viewer.application_name = Meine Text Ansicht

Listing 4.4.2. locale_de.properties (viewer example)

The locale.properties and all locale_xx.properties files have to be placed in the content handler directory. As soon as the content handler is loaded, the properties defined in these files can be retrieved by the API's localization methods, as for example PluginUtil.getLabel. Be aware that the property names have to be unique within the complete Docmenta application. Therefore it is recommended to use the content handler identifier as prefix, as shown in the example above.