Full Localization of Tableau Workbooks

Tableau has a great whitepaper that explains all of the out of the box supported localization methods. But they are not exactly “seamless”; they take a lot of effort and still result in some quirks. In this post, I’ll explore how some simple modification to the Tableau XML files can provide a method to generate “fully” translated workbooks that are won’t look out of place even when using Web Edit or See Underlying Data.

To build a translatable workbook, follow these steps:

  1. Connect to your datasource. Do not rename any fields. Also do not create any calculations
  2. Publish the datasource to Tableau Server.
  3. Save the datasource as a .TDS file for later, in case you need to make changes.
  4. Connect to the published datasource on Tableau Server. Close the original local connection
  5. Save the workbook as a TWB

Now you have a workbook that is fully ready to be translated. Keep reading for how to make it work.

If you are one of the 10’s of regular readers here, you’ll know that TWB files are just XML encoded in UTF-8. We can open them up in a regular text editor and make changes to see what happens.

If you set the locale in Tableau Desktop, this actually introduces a locale parameter to the main workbook tag. You can modify theis programmatically when publishing out localized copies.

<workbook locale='en_GB' source-platform='win' version='9.1' xmlns:user='http://www.tableausoftware.com/xml/user'>

Workbooks have a set of datasources tags, within which each datasource is defined. All of the visible attributes that you can change about a Dimension or Measure within a datasource are defined in a set of column tags.

These are not the column tags inside a set of columns tags — so if you see something like

<columns header='yes' outcome='6'>
            <column datatype='integer' name='Row ID' ordinal='0' />
            <column datatype='string' name='Order ID' ordinal='1' />
            <column datatype='date' name='Order Date' ordinal='2' />
            <column datatype='date' name='Ship Date' ordinal='3' />
            <column datatype='string' name='Ship Mode' ordinal='4' />

you are in the wrong place. The columns you are looking for come after

<aliases enabled='yes' />

They look something like

 <column aggregation="Count" datatype="integer" default-type="ordinal" layered="true" name="[IDCustomer (DimCustomer)]" pivot="key" role="dimension" type="ordinal" user-datatype="integer" visual-totals="Default">
      <column aggregation="Count" caption="ID Customer" datatype="integer" default-type="ordinal" layered="true" name="[IDCustomer]" pivot="key" role="dimension" type="ordinal" user-datatype="integer" visual-totals="Default">

You’ll notice that one of these has a caption attribute. When this is visible, it is was is displayed in the Tableau UI for the Measure or Dimension name. The name attribute actually matches up to the name defined for the field elsewhere in the XML. This is why our steps are to publish without making any changes to how Tableau connects to the data initially — we want to make sure our names match up. Additionally, some caption information stored in a published data source will override the captions in the workbook, so it’s safer to minimize those and keep all the things we want to change in the workbook.

Our process for translation is just to add or change the caption attribute with the new values we want to use. For the most thorough method, you’ll go through and do a Rename in the Tableau UI and give each Measure and Dimension a token that can be easily identified and stored in a translation table somewhere.

So you might rename Order Date to {Order Date}, then set up a table in your DB or a Unicode CSV like the following:

Token English German Russian Thai
{Order Date} Order Date Auftragsdatum Дата заказа วันสั่ง
{Sales} Sales Bestellungen заказы คำสั่งซื้อ

Then you just go through and replace the tokens in the caption attribute with the appropriate translation.

Using the tableau_rest_api library

The older tableau_rest_api is incorporated into the current tableau_tools library. Please only use versions of tableau_tools 4.0.0+.



One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s