Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

In order to localize an existing Mondrian Schema deployed on the platform and use it in Analyzer, you must follow these steps.

1. Edit the schema file

Open your schema file and replace the names you would like to localize in different languages by placeholders. Example:

<Measure name="Measure 1" caption="%{myMeasure1}" column="unit_sales" aggregator="sum" />
<Measure name="Measure 2" caption="%{myMeasure2}" column="units" aggregator="count" />

Notice the usage of the %{ }. While most of the contents can be localized, keep in mind that it is recommended to localize the captions only, since localizing the actual names might have some behind-the-scenes consequences which are not always obvious. The caching will have a hard time providing decent performance, since all members of your queries will keep changing names as users come and go. Also, queries written by a given user in a given locale might not work in a different setup because the members will have different names, thus invalidating your queries. It is therefore strongly recommended to localize only the captions and to maintain unique member names through all locales.

2. Edit [solutions folder]/system/mondrian/mondrian.properties

Open the mondrian.properties file and add at the bottom the following property.

mondrian.rolap.localePropFile=com.pentaho.messages.MondrianMessages

3. Edit [solutions folder]/system/olap/datasources.xml

Open the datasources.xml file and locate your datasource declaration which uses the Mondrian schema you modified at step 1. You need to add some parameters to its DataSourceInfo element, as follows.

<DataSourceInfo>Provider=mondrian;DataSource=SampleData;DynamicSchemaProcessor=mondrian.i18n.LocalizingDynamicSchemaProcessor;UseContentChecksum=true</DataSourceInfo>

The two following properties were added to the DataSourceInfo element.

  • DynamicSchemaProcessor
    This property points to a fully qualified class name implementing mondrian.spi.DynamicSchemaProcessor. Dynamic schema processors are classes who filter the schema file contents and provide a filtered output to Mondrian's core. Mondrian comes with a dynamic schema processor who searches for tokens and replaces them with values from Java localization files. As a matter of fact, it is implemented with Java's standard localized messages framework.
  • UseContentChecksum
    This property tells Mondrian to maintain a checksum of the schema XML and expose it through mondrian.olap.Schema.getId(). This property is used by Pentaho Analyzer to detect changes in the schema and refresh his caches.

4. Create your language files

You now need to create your localization files. First, navigate to [platform folder]/biserver-ee/tomcat/webapps/pentaho/WEB-INF/classes/com/pentaho/messages. If some folders are missing (chances are all those inside the 'classes' folder won't be present), create all missing folders manually. Then you will need to create one text file per language you want to support, using the standard localization files convention. As an example, files to support both English and French would be respectively:

MondrianMessages_en.properties
MondrianMessages_fr.properties

Once those files are created, you will need to create pair of keys and values. The keys are all the tokens that you have inserted into your Mondrian schema file at step 1. The values are the actual translated name you would like to substitute the token by. As an example, the file MondrianMessages_en.properties would contain something similar to this:

myMeasure1=My Measure 1
myMeasure2=My Measure 2

And that should do it. Don't forget to restart your platform webapp, refresh the solution repository and clear the schema cache once you are done. From now on, the placeholders which are present in your Mondrian schema file will be automatically replaced by the translated version in the language requested by the user browsers.

  • No labels