Language Translation in XML for Complex Adobe Illustrator Projects

If you want to be able to complete language translation for a complex Adobe Illustrator project and batch re-export all your assets, this workflow is for you.

Note: I’m currently using Adobe Illustrator CS6 on a Mac, I have not tested this with CC 2015 or later. In this tutorial, we will be using Adobe Illustrator Variables and Data Sets.

Step 1. Install Fonts

As per usual, install all the fonts that were used in the project before you open the file.

Step 2. Relink the Project

If necessary, relink your project to the appropriate media.

Step 3. Download — Dynamic Text Conversion Script

Copy the code for this script that makes all selected text dynamic provided by Carlos Canto.

Step 4. Download — Layers to PNG Script

This script was written by Matthew Ericson. Here is the link to the full documentation about his script to export layers and artboards to PNGS from Adobe Illustrator.

Step 5. Install the Scripts

Look up the location of your scripts folder in the Adobe Illustrator Automation with Scripts documentation. I’m on a Mac and I’m using Adobe Illustrator CS6. So I saved the script into the following folder:

/Applications/Adobe Illustrator CS6/Presets.localized/en_US/Scripts

Restart Illustrator to activate the scripts.

Step 6. Select All Text Objects

After you’ve installed the scripts and restarted Illustrator, open the Illustrator file and double check that all your fonts are correct and that your source files are connected. In Illustrator go to:

Select >> Objects >> Text Objects

This selects all the text that is a text object in the entire document (sadly, this will not apply to text that has been converted to outlines).

Now that all the text is selected, we are going to use a feature in Illustrator called Variables. Our friend Carlos Canto comes to the rescue again with his instructions on language translation in illustrator using Variables/ Data Sets. As stated in his blog post, Variables in Illustrator are not well documented, but his explanation is good and I’ve got them working, but my instructions differ slightly when used in conjunction with his script.

Step 7. Run the Dynamic Text Conversion Script

Now that all of your text objects are selected, you are ready to run the dynamic text conversion script. Before you do so, make sure that no variables exist in your project.

It should look like this:

A blank Variables window panel in Adobe Illustrator

To run the script, go to:

File >> Scripts >> MakeSelectedTextDynamic

After the script executes, it will have created variables for all of your text objects. This prepares them to be included in various data sets and to be output into an editable XML file for translation. Data sets are how we will separate the translation into different languages.

The Variables panel in Adobe Illustrator with variables assigned

Step 8. Create A Data Set for Each Language

Once the text objects have been made dynamic by the script, you will want to create a data set for each object. Carlos Canto recommends creating a new text object and typing in the name of the language.

In this example, I created a new layer called ‘TRANSLATOR CONTROLLER’, then I added a text object to that layer and typed in the word ‘ENGLISH’.

A text object reads ‘ENGLISH’ on the TRANSLATOR CONTROLLER layer in the Layers panel in Adobe Illustrator

Next, I selected the text object and jumped over to the Variables panel. With the text object selected, I clicked the ‘make text dynamic’ button.

Select the text object and click ‘Make Text Dynamic’

By clicking ‘Make Text Dynamic’ Illustrator assigns the object to the next variable. In this example, see Variable48 ‘ENGLISH’.

To create the data set, click on the dropdown menu in the top right corner and click ‘Capture Data Set’. Name this data set ‘ENGLISH’ or the native language of your original design, whichever one makes sense to you.

The Variables Panel in Adobe Illustrator showing the option for ‘Capture Data Set’

Now that you’ve created the first data set, you need to create additional data sets for the number of languages you plan to use. To do this, simply edit the ‘ENGLISH’ text box to the next language. In this example, let’s use ‘SPANISH’. Note the asterisk * next to the title of the ENGLISH data set. This indicates that it reads a change in the text object and you can now create a new data set.

Click on the ‘Capture Data Set’ option again. This time, when you save it, name it ‘SPANISH’. Now you will see you have two data sets in the drop down menu at the top, ENGLISH and SPANISH. Repeat this process for as many languages as are needed. Now you are ready to save this out and edit the XML.

Step 9. Save Variable Data…

Now that you’ve created a data set for each language, it’s time to save it out to an XML file that you can pass off to a translator. To do this go back to the dropdown menu at the top right and select ‘Save Variable Library…’

Choose a location for the XML file, I normally put it next to my project file and use the same name as the project file so it’s easy to associate them with one another.

Step 10. Edit XML

Now that you have the XML, you can open it in a text editor and complete the translation. Make sure the person translating knows not to disturb the formatting of the XML document. I used Google Translate in this example, so please excuse any translation mistakes. This is just for the sake of demonstration. You can see that the variable numbers match up with the numbers that were assigned in the Variables panel in Illustrator.

Step 11. Load Variable Data

Once you are done with the translation in the XML document, save it and reload it back into illustrator. To do so, open the Variables panel and go to ‘Load Variable Library…’. Select the XML you just edited. When you do, a dialog box will pop up that says ‘The current document already contains variables. Do you want to overwrite the current variables and data sets?”, click Yes. The translations will appear in the data sets.

Spanish translation is loaded into the Illustrator document in the Variables panel
Clicking through the language data sets updates the text automatically

Step 12. Batch Export PNGs

In the Variables panel, select the data set you want to batch export. Then go to:

File >> Scripts >> MultiExporter >> Export what: >> Layers (on currently selected artboard)

Choose an output directory, and click Export and watch them export automatically.

Repeat this process for each language/data set and you are done!

Final Note

Always check your Illustrator files to make sure that no text got chopped off or looks bad visually.

There will always be little tweaks you have to make when changing the copy to any design, but this process should get you a lot further a lot faster than manually going through and trying to find each text element in a huge project if you don’t have to.

Feel free to get in touch if you have any questions or comments!