TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I could not really find anything matching, maysome someone got an idea or a starting point:

I want to maintain a collection of documents written in Kile, Using LaTeX converted by xetex into pdf format. These documents have to be updated from time to time. I required each document to be available in two or three languages.

I do not want to maintain separate source files/collections for the different languages, since this will certainly lead to documents running out of sync. Instead I imagine something like this:

- each token of natural language ("phrase") will be enclosed in a macro
- the macro fetches the translation of the phrase from a local service
- this service could be a script reading translations from a file

Since there are applications suitable to maintain such phrase collections this appears to be a natural approach to me. However, I fail to find a good starting point..

share|improve this question

migrated from stackoverflow.com Jul 20 '12 at 16:54

This question came from our site for professional and enthusiast programmers.

Found op4a myself: po4a.alioth.debian.org, however this changes the document source which I think is the wrong way to go. – arkascha Jul 19 '12 at 17:59
One more related question: Is it possible to use some sort of internationalization in LaTeX? – Stephan Lehmke Jul 20 '12 at 17:23
up vote 4 down vote accepted

Ok, I managed to put together my own solution by trying around and considering examples I found elsewhere. This is what I currently use, near the start of my project. It works fine so far:

% this is a document holding multiple languages
% switch between ENGLISH and GERMAN by commenting one of the following lines:
\usepackage[ngerman,english]{babel} % makes ENGLISH content
%\usepackage[english,ngerman]{babel} % makes GERMAN content
% this is the macro to define phrases in two languages:
\newcommand{\babel}[2]{\ifnum\pdfstrcmp{\languagename}{english}=0 {#2}\else{#1}\fi}
\newcommand{\babelDE}[1]{\ifnum\pdfstrcmp{\languagename}{ngerman}=0 {#1}\fi}
\newcommand{\babelEN}[1]{\ifnum\pdfstrcmp{\languagename}{english}=0 {#1}\fi}
% example:   \babel{Deutscher Text}{english text}
% example:   \babelDE{deutscher Text}
% example:   \babelEN{english text}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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