1

I have a document which I have to translate in other languages. I was thinking of writing the translations in different text files with tagged paragraphs so that I could include in the right place of the original LaTex frame. How could do that?

I've read Managing multiple translation of a single document and Creating multiple language versions from single latex source by fetching translation from file.

The questions are the same as mine but the answers didn't consider putting the translations in different text files. Thank you

EDIT It seems that my question was not clear. Perhaps my english phrase was bad. Sorry for that.

The following is an example of a minimum latex document:

\documentclass[paper=a5,fontsize=10pt]{scrbook}
\usepackage[T1]{fontenc}
...etc...
% a command to read the <language>.txt (translations)
\begin{document}
\paragraph{tag01} %% from the file italiano.txt
\paragraph{tag01} %% from the file italiano.txt
\begin{document}

---- translation files File: spanish.txt

[tag01]
Los t\'{e}rminos en swahili utilizados en esta gu\'{i}a deben leerse de la siguiente manera
[tag02]
\textbf{Cada} sociedad en la tierra tiene tradiciones que se transmiten de generaci\'{o}n en generaci\'{o}n

File: italiano.txt

[tag01]
I termini swahili utilizzati in questa quida si pronunciano come segue
[tag02]
\textbf{Ogni} societ ha tradizione che si tramettono da generazione a generazione
  • @KJO I forgot to write "did not answer"! – nino_user183677 Apr 13 at 17:05
1

Since you have not had a reply yet I will kick off with a very simple system that does not require >if this >then that from your first link. (which would work better with datatools imports)

It is based on each language having its own folder and very simply each phrase in its own file (It is NOT efficient and I would not normally recommend either separate folders nor wasting disk storage in this manner but its quick and only slightly dirty, see my comments)

\documentclass[paper=a5,fontsize=10pt]{scrbook}
\usepackage[T1]{fontenc}
%...etc...
% a command to read the </languagefolder/><###.txt> (one numbered translation per file)
\newcommand{\lang}{Spanish} % consider changing ``lang'' to an obscure word as it is very common, see next comment
\newcommand{\load}{./\lang/} % do not use ``read'' in place of ``load'' as it is already assigned (even load may clash with other packages)

% Since this is a **1 language at a time** solution I have kept it simple, 
% however you could define Dual languages by adding an alternative to \Load such as  
%\newcommand{\getES}{./Spanish/}  
%\newcommand{\getIT}{./Italian/}  
%...etc... and use \getES001.txt is equavent to \getIT001.txt but may also need \LangES and \LangIT for main body text

\begin{document}


% Example 3 from the file /language/###.txt' where 003.txt just contains Hello World in each language but see comment as ``Hello World'' may be better
\textbf {English ``Hello World'', is in \lang }NOTE\% if we do not use a brace around $\backslash$lang itself
then the imediately folowing space is lost so needs a $\sim$ (tilde) when a space is required before next word. See the last example.\newline
\par \textbf{``\input{\load003.txt}''} NOTE\% there is NO space after mundo'' in the text file but one gets inserted when input. So quotes should be applied in the txt file\newline

\par The Swahili terms used in this guide are pronounced as follows in \lang:- 
\par \input{\load001.txt} \newline

And  the {\lang} for ``Every society on earth has traditions that are transmitted from generation to generation'' is ``
\input{\load002.txt}''\newline %see comment above about use of quotes

Fin
\end{document}

enter image description here For a better method using tags as you request look at catchfilebetweentags as described in https://tex.stackexchange.com/a/4952/170109

  • thank you for your help. Your solution is not good for my document because it is very long and I need to have one for every language, because it's more managable: I can get translations for other people or just send them to native speakers to proofread. Anyway you suggested me a better solution. I tried to use the catchfilebetweentagsa and it seems to meet my needs. Thank you – nino_user183677 Apr 14 at 14:11
  • Yes the catchfilebetweentags is possibly the best solution as you only need one file per language, the advantage of separate files is best for including mult-paragraph pages at a time, especially if they include graphics or equations that can be tested in those smaller files – user170109 Apr 14 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.