2.3.6. Gentext configuration
The text phrases that are automatically generated during the publication export process are defined in the file System > gentext.properties. An example of generated text (GenText) is the title that appears at the top of the table of contents. By default, the title of the table of contents is "Table of Contents". Another example is the generated label for the title line of images and tables. Normally, the default generated text phrases should be adequate. However, sometimes it is required to change some of the default phrases. To do so, proceed as follows:
- Select the gentext.properties file and click the "Edit" button in the bottom-panel of the preview-area. Alternatively download the gentext.properties file and open the file in a text editor.
Figure 2.3.34. Editing the gentext.properties file
- The gentext.properties file defines properties in the format key=value. Search the property where the default text phrase is contained. For example if you search for "Table of Contents" you will find following lines:
# TableofContents=Table of Contents
# tableofcontents=Table of Contents
Note that lines that start with the # character are commented out, i.e. the lines are ignored by Docmenta. If a property is commented out, then the default value is used for this property. Be aware that some text phrases have two entries, one for lower case and one for upper case. In the example above, the property "TableofContents" defines the upper case phrase, and the property "tableofcontents" defines the lower case phrase. However, both generate the same text phrase "Table of Contents".
- To customize property values, uncomment the lines (i.e. remove the # at the beginning of the lines). Then replace the default text phrase with the desired text phrase. For example, to change the title of the table of contents to "Contents", change the lines above to
- Save the changed gentext.properties file by clicking the "Save" button in the bottom-panel of the preview-area. Alternatively, if you have downloaded the file, upload the modified file to the root-folder System (overwriting the existing gentext.properties file). The system now uses the text phrases of the uncommented properties.
Figure 2.3.35. Saving the modified gentext.properties file
The gentext.properties file has to be encoded in ISO-8859-1 character encoding. Characters that cannot be directly represented in this encoding can be written using Unicode escapes in the format \uXXXX for the appropriate hexadecimal value XXXX. The ASCII characters \, tab, form feed, newline and carriage return are written as \\, \t, \f, \n and \r, respectively. The characters #, !, =, and : should be written with a preceding backslash to ensure proper loading.
Be aware that the system accesses the gentext.properties file through the alias name "gentext". Therefore do not change this alias name, or if you want to use another file as the gentext configuration, then set the alias name of this file to "gentext".
Translating the "gentext.properties" file
The generated text phrases can be different for different languages. Therefore the gentext.properties file can be translated. For example, if you export a German translation of your product documentation then the generated title of the table of contents is by default "Inhaltsverzeichnis" (which is the German word for "Table of Contents").
To customize the text phrases for the language XX, switch to translation-mode for the language XX and edit the file with name gentext[XX].properties within the root-folder System. Customize the property values as described in steps 2 and 3 above. Save the changed file as described in step 4 above (assure that you are still in translation-mode).
Including a gentext phrase in the content
Normally the text phrases defined in the gentext.properties file are automatically inserted into the content. However, in some cases it can be useful to manually insert the text phrase into the content. This can easily be achieved by entering the inline inclusion pattern [$key] in the content, where key is the name of the gentext property.
In the following example the gentext inline inclusion is used to automatically generate the title of a warning box. Assure that the gentext property with name "Warning" is defined, i.e. view the contents of the gentext.properties file and search for a line that starts with "Warning=":
Figure 2.3.36. Gentext property "Warning"
(Note: If the "Warning" property is commented out, remove the leading # character.)
In the next step create a content node and insert a note-box with the title "[$Warning]". For example, create a table with one column and two rows. Assign the example style "header_note" to the cell in the first row (by selecting "header_note" from the Class listbox). Then enter "[$Warning]" in the first row:
Figure 2.3.37. Example of gentext inline inclusion
After having saved the node, you will notice that in the preview window the pattern "[$Warning]" has been replaced by the text "Warning" (as defined in the gentext properties file).