# How to supply external translators with LaTeX documents?

I'm in charge of writing the documentation of a product for my company, and I would like to do it with LaTeX. How to deal with external translators?

At the present moment my company writes the english documentation of products using Word, and then sends the .docx to external translator: the whole process is straightforward enough.

If I switched to LaTeX, how could I manage the external translation of documents? I fear that providing the translators with the raw source code (without any elaboration) might lead to confusion and errors, but giving them the compiled .pdf and asking them to add translation with pdf comments would surely be too laborious for me to insert the translated text back in the source code. Is there a compromise?

A possible approach: I could write a script which produces an .xlsx file where each row contains a single line of my .tex source, using Excel conditional formatting to highlight the rows not to be translated (e.g. a line starting with with \includegraphics), or the rows with mixed LaTeX syntax and text to be translated, and asking the translator to insert the translation in the second column. After that I could write another script which takes the .xlsx with the translated text and produces a .tex back.

• OmegaT can import .tex files, if you'd like to try that out. – LianTze Lim Nov 8 '16 at 5:42
• Unless I understand the question in a wrong way, what speaks against separating the text from the document, and letting the translators translate a .tex file containing only text (with no/few latex commands - essentially a plain-text file), which is then \inputed into the main document? – aehrm Jan 7 '17 at 2:42
• What do you mean by "separating the text from the document"? In almost any LaTeX document, text and commands are tightly tangled... – Rackbox Jan 8 '17 at 8:58

A possible approach is to build a script with commands. Each command has to be loaded with individual content, the source can be put in a csv file and the columns have language code de|en|fr

using datatool you can do this, but this approach is slow. Sending csv files can be done easily and no one has to know, that you process this content via latex...

\documentclass{scrreprt}

\usepackage{etex}
\reserveinserts{28}
\usepackage{morewrites}
\usepackage[english,german]{babel} % English language
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage[utf8]{inputenc} % Uses the utf8 input encoding
\usepackage{datatool}
\usepackage{fp}
\usepackage{filecontents}

\newcommand{\fetchinfo}[3]{%
% Get the column index for the column labelled c1''
\DTLgetcolumnindex{\columnidx}{#3}{c1}%
% Get the row where that column matches the given text:
\DTLgetrowindex{\rowidx}{#3}{\columnidx}{#2}%
% Set it as the current row
\dtlgetrow{#3}{\rowidx}%
% Get the index for the required column
\DTLgetcolumnindex{\columnidx}{#3}{c\langselectkey}%
\dtlgetentryfromcurrentrow{#1}{\columnidx}%
}

\begin{filecontents*}{cvdatabase-A.csv}
Langaugecode;SYSTEM;;2;3;;;DE;EN;ESP;SRB;SLO;;;;;;;;;;;;;
cmdAAAA;Content;Chapter;3;10;Main;;"German Text";"English Text";"ESP";"SRB";"SLO";;;;;;;;;;;;;
\end{filecontents*}

\FPupn{langselect}{1} % take 1 for german, 2 for english, 3, add more languages to the csv file
\DTLsetseparator{;}
\FPupn{langselectkey}{0}

\FPupn{langselectkey}{langselect 7 + 0 round}
\DTLifdbexists{cva}{\DTLdeletedb{cva}}{ }
\typeout{pause}
% \input{../dblaa}

\fetchinfo{\cmdAAAA}{cmdAAAA}{cva}

\begin{document}
\selectlanguage{german}

\cmdAAAA

You have to replace each text to a command and add the command to the csv file, also you have to load it via fetchinfo....

\end{document}


It will be as mentioned above very slow...

• Can you elaborate a little bit more to better explain the csv content? – Luca Del Tongo Jul 8 '16 at 13:09

I define a new and empty command for each text block, e.g. \newcommand{\descript}{} in the main file,

then I put the text I want to display into a file each: e.g. german.tex, where I have

\renewcommand{\descript}{
Das ist der Text.
}


In the main file, call \input{german.tex} And then where appropriate \descript

You can go a step further and also separate the layout (columns whatever) into a command or file. Then your main file can end up looking like this, which prints all the languages one after the other in the same layout (since layout calls the commands defined in the language files):

\input{german.tex}
\input{layout.tex}
\input{french.tex}
\input{layout.tex}