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}.
babel
package. If you're thinking about generating documents from a multilingual database or CMS, then i18n should happen at the data aggregation level.translator
package.