6

For example, I have one manuscript that will create a PDF file in German and one in English.

My idea is that it should be used like i18n in Java, so I have a key for a text block or a sentence and a language file for each language. For example:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[utf8]{inputenc}

\begin{document}

\i18n{hello.world.text}

\end{document}

This would create two documents, one containing the text Hallo Welt and one containing Hello World.

Everything that I've found on this topic is to use multiple languages in the same document, but that's not what I'm looking for.

3
  • 3
    I'm not sure I understand what you're getting at with this approach. It seems clumsy to make multilingual document versions by maintaining a "master file" with a key word for every sentence of the document and i18n files associating texts with every key word. If you're interested in internationalization of constant texts like "Table of Contents", look at the babel package. If you're thinking about generating documents from a multilingual database or CMS, then i18n should happen at the data aggregation level. Jun 14, 2012 at 15:59
  • 2
    In Java, the program itself is what matters most, being language-independent, while text is "just" something on top neccessary for user interaction. With TeX, the text itself is the main content, so the focus of internationalization is different. Jun 14, 2012 at 16:02
  • 3
    You can have a look at Beamer's translator package. Jun 14, 2012 at 16:19

1 Answer 1

4

This sounds like what I do when editing the multilingual problem set for the International Olympiad in Linguistics. It takes one master file in which all chunks of text are replaced by control sequences (as in \greeting, \universe!), several dictionary files (one for each language) which define the control sequences in their respective ways (for example, the one for German says \def\greeting{Hallo} \def\universe{Welt}), and as many shell files, each of which inputs Babel with the required settings, the dictionary for its language and the master.

A somewhat larger example:

English dictionary:

\def \ThelgVai{Vai}
\def \ThelgFar{Faroese}
\def \belongsto #1#2{#1 belongs to the #2}
\def \toCMande{Central group of the Mande language family}
\def \toNGerma{Northern subgroup of the Germanic languages}
\def \spokenca #1#2{It is spoken by approx.\ #1 people #2}
\def \inLbrSle{in Liberia and Sierra Leone}
\def \iFaroetc{in the Faroe Islands and elsewhere}

German dictionary:

\def \ThelgVai{Vai}
\def \ThelgFar{Färöische}
\def \belongsto #1#2{Das #1 gehört zur #2}
\def \toCMande{zentralen Gruppe der Mande-Sprachfamilie}
\def \toNGerma{nordischen Untergruppe der germanischen Sprachen}
\def \spokenca #1#2{Es wird von ungefähr #1 Menschen #2 gesprochen}
\def \inLbrSle{in Liberia und Sierra Leone}
\def \iFaroetc{auf den Färöern und anderswo}

Master source:

\belongsto {\ThelgVai}{\toCMande}. \spokenca{105\,000}{\inLbrSle}.
[…]
\belongsto {\ThelgFar}{\toNGerma}. \spokenca{48\,000}{\iFaroetc}.
4
  • 2
    The example makes it much clearer. But English and German are very similar in the way sentences and larger text units are constructed. Furthermore, the text you are building is very simple. I believe if you'd try to build larger documents from more varying languages this will get very confusing and hard to maintain. Jun 28, 2012 at 20:14
  • 1
    Mind you, our company is building large documents all the time in a very similar way, for product catalogs and technical documentation, but I just can't imagine how to apply this to a more complex document which is not in itself generated from a data base. Jun 28, 2012 at 20:17
  • I'm writing a CV, which should be available in 3 languages, and I don't want to make every design change 3 times. So for this purpose I think it works. I think for big and complex documents it is more appropriate to write different .tex files, because in French, for example, your text is most likely much longer than the German or the English one, and that would make your design look ugly.
    – thobens
    Jun 29, 2012 at 13:17
  • For a better idea of the documents I generate in this way, see the IOL's site (click on ‘Past Contests’, the year 2008 or any later one, and ‘Problems’). The languages are as diverse as Russian and Estonian and Korean (and we'll also have Hebrew this year); I chose English and German as an example only because they were mentioned in the original question. Jun 30, 2012 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .