03. Translating the Samples
The easiest way to get started with translating the platform is by translating the samples. The 'pentaho-solutions' directory in the Pre-Configured Installation contains all of the files necessary to run the sample solutions. All of the text in the .properties files will be seen by users and should be translated. The root directory for these files is:
<pentaho-demo>/pentaho-solutions/
Each directory under the pentaho-solutions contains an index.xml file and a corresponding index.properties file. For example, when the index.xml file under pentaho-solutions/samples is requested by a user with an English locale, the platform will look for an index.properties file in the same directory. When someone with a French locale logs in, the platform will look for index_fr.properties. And for a German locale, the platform looks for an index_de.properties. If the index_[country-code].properties file is not found, the default index.properties is used. If you are a German translator, you will create a new file called index_de.properties, add the German translated text and reload your browser. The German messages will now be used for German users. In order to select the correct text for the correct messages, there is a mapping scheme between the base document and the text in the .properties file. For the example index.xml, here is the text in the file:
<?xml version='1.0' encoding='ISO-8859-1'?> <index> <name>%name</name> <description>%description</description> <icon>solutions.png</icon> <visible>true</visible> </index>
Here are the contents of the index.properties file:
name=Pentaho BI Components Demo
description=These sample JSP pages show ...
For translating XML files, we use the Eclipse standard of mapping XML text beginning with a percent '%' sign to a name in the .properties file. In this example, %name in the XML file will be replaced by the text after name= key the .properties file. The index.xml files are used by the samples navigation JSP to generate names, descriptions and the image to use for a set of solutions. Here are the contents of the index_fr.properties:
name=Démo De Composants de BI De Pentaho
description=Ces pages témoin JSP montrent comment ...
Note: This example French translation was performed by a translation program and should not be taken literally. Steps for translating the samples:
- Start with the samples directory
- Open each .properties file for your language
- Edit the English text on the right of the equal '=' sign with the correct text for your language. IMPORTANT: DO NOT CHANGE THE TEXT TO THE LEFT OF THE '='. e.g. name=Démo De Composants
Seeing the results of your samples translations
As you translate each file, or each line, you can view the results. Some of the text will change just by refreshing your browser. The names and descriptions of Action documents are cached and must be published. To publish, navigate to the top level of the Pentaho Preconfigured Install Demo. The default URL is http://localhost:8080/pentaho. In the Refresh section, click "Solution Repository." A pop-up dialog will load. From the list, click the "Publish" link for the "Solution Repository" publisher. It is helpful if you keep this page available while translating.
There are three file types that will be encountered while translating the samples. After translating their .properties file, the changes can be verified as follows:
- index.xml-- Used for navigating between the groups of samples. You can see the results of changes to the index.properties files by navigating to that group. "Getting Started" is one such group.
- *.url-- Define URLs that are displayed along with the samples and can be used to initiate actions. The SchedulerAdmin under the admin folder is an example.
- *.xaction. Action documents that implement BI solutions. Select the action to verify your language changes.
When you are ready to share your work you can send it to Pentaho to be included in the Platform.