Why do you need Metadata Localization?

Štěpán Machovský
GoodData Developers
5 min readJun 7, 2024

In the era of globalization, there has never been a bigger need for localized analytics, as it is easier than ever to work with different companies worldwide.

Let’s imagine a scenario where you are a global E-Commerce company with suppliers from across the world. Having suppliers (and possibly employees) from different countries, it would be nice to access the same data in their mother tongue. That is where metadata localization comes into play.

Wouldn’t it be nice if you could create any dashboard you want and then translate it to each of the languages you want, and your users could select their preferred language? This localization does not only include the visualizations and their descriptions but also the metrics used and basically each UI element that your users can encounter.

Do I need localization?

The short answer is yes, and the longer answer is, well, it depends. You can always default to English and assume that everyone is OK with it, but let’s be real: Not everyone is proficient in English, and you’ll hit a wall of miscommunication.

There are few roadblocks in delivering clear messages as big as speaking different languages. Miscommunication can lead to errors, delays, and dissatisfaction among global stakeholders. When everyone understands the data in their preferred language, it not only boosts productivity but also enhances the accuracy of interpretations and decisions.

Benefits of Metadata Localization

Metadata Localization has four major benefits when applied correctly:

  1. Enhanced User Experience: Users feel more comfortable and engaged when interacting with content in their native language. This leads to better comprehension and satisfaction.
  2. Improved Accuracy: Metrics, descriptions, and UI elements in the native language minimize misunderstandings and misinterpretations, leading to more accurate data analysis and decision-making.
  3. Inclusivity and Accessibility: Offering localized dashboards makes your platform more accessible to a global audience, fostering inclusivity and diversity within your user base.
  4. Competitive Advantage: Companies that offer localized services are more likely to attract and retain international partners and clients, giving them an edge over competitors who do not offer such services.

Challenges of Localization

However, localization can also be quite hard to get right, especially when you the platform doesn’t support it natively:

  1. Resource Intensive: Translating and maintaining multiple languages requires significant resources, including skilled translators and cultural experts.
  2. Technical Complexity: Implementing localization in analytics platforms can be technically challenging, requiring robust infrastructure to support multiple languages seamlessly.
  3. Consistency and Quality Control: Ensuring that translations are consistent and of high quality across all dashboard elements can be difficult, especially when dealing with complex or specialized terminology.

Does it have to be that hard?

Of course, it doesn’t! With native support from the platform, you have way less friction and can even leverage things like Google Translate for quick POCs and first iterations. The translations don’t have to be 100% from the beginning, and that is where most people fail because it is very demanding to iteratively make better and better translations.

The case for GoodData

Recently, GoodData added support for metadata localization through their APIs. I’ve worked on the metadata localization support through our Python SDK. It helps you quickly iterate and makes it much more convenient to start with translations! Be sure to check out the documentation.

Why through Code?

With Analytics as Code approach, you can easily (and transparently) change your analytics. You can easily version parts of your data pipelines and much more. If you’d like to learn more about Analytics as Code, check out our blog post.

Without this approach, you’d have to manually download the translation files from our UI, and it would be far from seamless overall. But let’s look at how easily you can do it with code.

If you want to try it, check my GitHub repository, where I leverage Google Translate. For simplicity, I’ve created a very naive wrapper function to create a translation function for different languages:

def create_translation_function(target_language):
def my_translation_function(
to_translate: str, already_translated=True, old_translation=""
) -> callable:
if to_translate == "":
return ""
try:
translator = Translator()
translated_text = translator.translate(to_translate, target_language)
return translated_text.text
except Exception as e:
print(f"Translation failed: {e}")
return old_translation

return my_translation_function

With this function (simply calling Translate API in the background), you can now easily update any workspace just like this:

sdk.catalog_workspace.add_metadata_locale(
workspace_id="123",
target_language="de-DE", #German
translator_func=create_translation_function("de-DE"),
set_locale=True #Switching the workspace to the target language
)

And that is it! Python SDK does all the API calling and all the hard lifting. Seems like this couldn’t get any easier! ;)

You might also want to skip this phase, where you translate your workspace like this. I get it, the function doesn’t have any context, and you’d like to do it properly. Well, no problem! With PySDK, you can simply save the translation file to your disk, and then after you are done with it, you can easily read it back. Just two function calls!

# Example usage for saving metadata locale to disk
sdk.catalog_workspace.save_metadata_locale_to_disk(
workspace_id="123",
target_language="de-DE",
file_path=Path("/path/to/file.xliff")
)

# Example usage for setting metadata locale from disk
sdk.catalog_workspace.set_metadata_locale_from_disk(
workspace_id="123",
file_path=Path("/path/to/file.xliff")
)

The XLIFF itself is pretty straightforward:

<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1" srcLang="en-US" trgLang="de-DE">
<file id="demo">
<group id="analyticalDashboard">
<group id="analyticalDashboard.campaign">
<unit id="analyticalDashboard.campaign.title">
<segment>
<source>Campaign</source>
</segment>
</unit>
<unit id="analyticalDashboard.campaign.description">
<segment>
<source></source>
</segment>
</unit>
<unit id="analyticalDashboard.campaign.spend">
<segment>
<source>
<mrk id="1" type="free-form:path" value="$.layout.sections[*].items[*].widget.title"/>Campaign Spend
</source>
</segment>
</unit>
</group>
</group>
</file>
</xliff>

Here you just add <target>tags after each <source> tag, and inside, you’d have the translation. Each <source> tag is also in a <segment> tag, so they are quite easy to find.

Here’s a short example of an already “translated” XLIFF:

<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.1" srcLang="en-US" trgLang="de-DE">
<file id="demo">
<group id="analyticalDashboard">
<group id="analyticalDashboard.campaign">
<unit id="analyticalDashboard.campaign.title">
<segment>
<source>Campaign</source>
<target>Die Kampagne</target>
</segment>
</unit>
</group>
</group>
</file>
</xliff>

Want to learn more?

As mentioned, you can localize your metadata with my GitHub repository, where you can easily change any workspace to your desired language.

With this repository, you can see firsthand how to implement metadata localization efficiently using the Python SDK. Whether you start with automated translations for a proof of concept or refine your translations for accuracy and cultural relevance, this approach provides flexibility and ease of use.

If you don’t have analytics in GoodData, you can always try the free trial!

For a deeper dive into “Analytics as Code” and its benefits, check out our detailed blog post.

--

--

Štěpán Machovský
GoodData Developers

AI/ML enthusiast, lover of ice cream and other forms of art.