Before building a script, you must understand the basics of Codex profiles. You can find all the information about Codex and the profiles here.


TABLE OF CONTENTS


Basics


For XLSX, XLSM, and XLS files, a cell is referenced using an SRC pattern: [Sheet, Row, Column].

This means that to extract the value of the first cell in the first sheet, you will tell Codex that it can find it at these coordinates: [0,0,0].

Do be careful, the index for XLSX, XLSM, XLS files starts at 0, not 1.



Above we have an XLSX Sample file. As we can see, the A and D columns do not need to be translated. Also, the first line contains column names we don't want to send to be translated. Find below the Codex Script that will allow you to ignore them when sending the file for translation:

selectionPathList = [Pair("[*,0,*]", False), Pair("[*,*,0]", False), Pair("[*,*,3]", False), Pair("[*,*,*]", True)]
contextsPath = []
groupingPaths = []
contentNames = []
groupingPathNames = []
targetInjections = []
targetInjectionsRange = []

Exclude all columns of the first line, Exclude all lines of the first column, Exclude all lines of the third column, Include other content.


Improve your scripts


Manage multiple target languages files with targetInjections parameter



Here we have as sample an XLSX File that has to be translated directly inside target language columns instead of replacing the source values one.

Find below the Codex Script that will allow you to separate properly:

selectionPathList = [Pair("[*,0,*]", False), Pair("[*,*,0]", False), Pair("[*,*,1]", True), Pair("[*,*,*]", False)]
contextsPath = []
groupingPaths = []
contentNames = []
groupingPathNames = []
targetInjections = [Triplet("[*,*,1]", "[?,?,2]",Language.de_DE), Triplet("[*,*,1]", "[?,?,3]",Language.it_IT)]
targetInjectionsRange = []

targetInjections dispatcher parameter has been set up to: 

  • extract the content of the second column as source content, and put the translations into the third column for de-DE language
  • extract the content of the second column as source content, and put the translations into the fourth column for it-IT language


WARNING: this parameter overrides any target languages that you could have set during uploading or manual launching. If you want to add another language for translation, update the script then apply a manual translation with any target languages.


Detect the target languages with targetInjectionsRange


Note that you can also let Codex find out which language matches which column by using the targetInjectionsRange. To do so you must provide in a cell of your target columns the language code to be injected: if a file is to be translated to de-DE and it-IT for example respectively in columns C to D, just provide the language code in the first cell of each column and then use the following script:

targetInjectionsRange = [Triplet("[*,*,1]","[?,0,2-3]",CodexAxis.VERTICAL)]

This script will read each first cell of columns C to D ([?,0,2-3]) and inject the translations of column B ([*,*,1]).


Split your large files with the groupingPaths parameter


Without using this parameter, the whole extracted content of your file will be integrated into one Document (DataEntity) on Translate (CVSE) module.


Let's say your sheet contains in the first column some values that can be used to group your content. You can then just use this column as a grouping path:

groupingPaths = [Pair("[*,*,*]", "[?,?,0]")]

Here Codex will create groups that have the same content in the first column, so the two first rows will be grouped together in a same task, and the other ones will each be in a separate task.


Give context to your localizable content with the contextPaths parameter


The localization process can be improved by providing translation context.

You can indicate in the script which cells should be used as translation context, and their values will then be displayed on the Details panel of the Translation Studio.

Here is a sample script to extract some content as context:

contextsPath = [Pair("[*,*,3]", True), Pair("[*,*,4], True)]

Here we've added the lines of the fourth and fifth columns as context.


URLs & Images

To have clickable URLs in the Translation Studio Details panel, make sure they are provided between "[url=" and "]" tags in the Excel file.

ex: [url=https://helpdesk.wezen.com]


To have images displayed in the Translation Studio Details panel, make sure they are provided between "[img=" and "]" tags in the Excel file.

ex: [img=https://wezen.com/yourimage.jpg]