Wednesday, January 17, 2018

[Salesforce / Translation Workbench] Import/Export translations betwen ORGs with different metadata configuration

This guest post is written by one of the most powerful coworkers I've been working with in the last years.

His name is Tommaso Bolis and I call him the Robo-Bolis because I believe he's a smart and super productive top coder, and sometimes make me fear he's not human!

Jokes aside, it's months I'm asking him to write as a guest blogger for my blog and finally he decided to put some of his knowledge inside this humble blog.

Tommaso Bolis is a Solution Architect and Salesforce Senior Developer at WebResults, a Salesforce platinum italian partner. His main interests span from backend development to DB administration, to Javascript frontend development and, ofcourse, Salesforce.

If you are the kind of guys belonging to the TL;DR party, here is an amazing GitHub repository with all the code to solve the challenge in the post's title.


Background: Multi region and content management


During one of my last projects I had to introduce on one of our customer’s site/community the multi region (EMEA, APAC, ...) content management and the multi language support.

This last requirement was particularly challenging (we are talking about 8 different languages including Japanese, Korean and Arabic...), but I don’t want to bother you with what have been done to accomplish the goal, I just want to tell you about one problem I have been facing trying to move translations among our different orgs.

If you have already played with translation workbench you know for sure how trying to export/import translations can be tricky.


The challenge: ORGs with different metadata configuration


The point is that if two orgs differ for some reason in terms of translatable metadata than the export/import process can fail and a manual adjustment of the exported data can be necessary in order to import the data inside the destination org without errors.

For example, if you have a custom label on the source org that has not been deployed on the destination org, when you try to export translations from the source org the resulting files will contain translation for this custom label and trying to import these files will result in errors.


Solution: Python app to rest easy


In order to solve this annoying problem I developed a Python script that takes files exported from the source org and process it removing all references to metadata that does not exist on the destination org.

In this way it is possible to import files without errors!

The idea is to use files exported from both orgs source and destination and simply remove everything is on source files but not on destination files.

This operation is enough to obtain a set of translation files that can be imported without errors.

Jump to this GitHub repository, fork it and follow the README.md file to run the magic!

Maybe around the web something similar already exist, but I can’t say no when I’ve to work on a good handcrafted script.

1 comment:

  1. This is truly a great read for me.I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! kn95 mask

    ReplyDelete