\hypertarget{langhowto}{}\section{Internationalization}\label{langhowto}
 \subsubsection*{Support for multiple languages}


Doxygen has built-in support for multiple languages. This means  that the text fragments that doxygen generates can be produced in languages other than English (the default) at configuration time.

Currently (version 1.2.11), 24 languages  are supported (sorted alphabetically):  Brazilian Portuguese, Chinese, Croatian, Czech, Danish,  Dutch, English, Finnish, French, German,  Hungarian, Italian, Japanese, Korean, Norwegian,  Polish, Portuguese, Romanian, Russian, Slovak,  Slovene, Spanish, Swedish, and Ukrainian.

The table of information related to the supported languages follows. It is sorted by language alphabetically. The {\bf Status} column was generated from sources and shows approximately the last version when the translator was updated.

 
\begin{tabular}{|l|l|l|l|}
  \hline 
  {\bf Language} & {\bf Maintainer} & {\bf Contact address} & {\bf Status} \\
  \hline
  \hline
  Brazilian & Fabio "FJTC" Jun Takada Chino & {\tt chino@grad.icmc.sc.usp.br} & up-to-date \\
  \hline
  Chinese & Wang Weihan & {\tt wangweihan@capinfo.com.cn} & 1.2.1 \\
  \hline
  Croatian & Boris Bralo & {\tt boris.bralo@zg.tel.hr} & up-to-date \\
  \hline
  Czech & Petr P\v{r}ikryl & {\tt prikrylp@skil.cz} & up-to-date \\
  \hline
  Danish & Erik S\o{}e S\o{}rensen & {\tt erik@mail.nu} & 1.2.7 \\
  \hline
  Dutch & Dimitri van Heesch & {\tt dimitri@stack.nl} & up-to-date \\
  \hline
  English & Dimitri van Heesch & {\tt dimitri@stack.nl} & up-to-date \\
  \hline
  Finnish & Olli Korhonen & {\tt Olli.Korhonen@ccc.fi} & 1.0.0 \\
  \hline
  French & Xavier Outhier & {\tt xouthier@yahoo.fr} & up-to-date \\
  \hline
  German & Jens Seidel & {\tt jensseidel@users.sf.net} & up-to-date \\
   & Jens Breitenstein & {\tt Jens.Breitenstein@tlc.de} &  \\
  \hline
  Hungarian & F\"{o}ldv\'{a}ri Gy\"{o}rgy & {\tt foldvari@diatronltd.com} & 1.2.1 \\
  \hline
  Italian & Ahmed Aldo Faisal & {\tt aaf23@cam.ac.uk} & up-to-date \\
   & Alessandro Falappa & {\tt a.falappa@flashnet.it} &  \\
  \hline
  Japanese & Kenji Nagamatsu & {\tt naga@joyful.club.ne.jp} & 1.2.5 \\
  \hline
  Korean & Richard Kim & {\tt ryk@dspwiz.com} & 1.1.0 \\
  \hline
  Norwegian & Lars Erik Jordet & {\tt larsej@stud.ifd.hibu.no} & 1.2.2 \\
  \hline
  Polish & Grzegorz Kowal & {\tt g\_kowal@poczta.onet.pl} & 1.2.1 \\
  \hline
  Portuguese & Rui Godinho Lopes & {\tt ruiglopes@yahoo.com} & up-to-date \\
  \hline
  Romanian & Alexandru Iosup & {\tt aiosup@yahoo.com} & 1.2.1 \\
  \hline
  Russian & Alexandr Chelpanov & {\tt cav@cryptopro.ru} & up-to-date \\
  \hline
  Slovak & Stanislav Kudl\'{a}\v{c} & {\tt qwerty1@pobox.sk} & up-to-date \\
  \hline
  Slovene & Matjaz Ostroversnik & {\tt matjaz.ostroversnik@zrs-tk.si} & 1.1.5 \\
  \hline
  Spanish & Francisco Oltra Thennet & {\tt foltra@puc.cl} & 1.2.7 \\
  \hline
  Swedish & Samuel H\"{a}agglund & {\tt sahag96@nts.mh.se} & 1.0.0 \\
   & XeT Erixon & {\tt xet@hem.passagen.se} &  \\
  \hline
  Ukrainian & Olexij Tkatchenko & {\tt olexij.tkatchenko@gmx.de} & up-to-date \\
  \hline
\end{tabular}


Most people on the list have indicated that they were also busy doing other things, so if you want to help to speed things up please  let them (or me) know.

If you want to add support for a language that is not yet listed  please read the next section.

\subsubsection*{Adding a new language to doxygen}


This short HOWTO explains how to add support for a new language to Doxygen:

Just follow these steps: \begin{enumerate}
\item 
Tell me for which language you want to add support. If no one else is already working on support for that language, you will be  assigned as the maintainer for the language.  \item 
Create a copy of translator\_\-en.h and name it  translator\_\-$<$your\_\-2\_\-letter\_\-country\_\-code$>$.h I'll use xx in the rest of this document. \item 
Edit language.cpp: Add a  

\footnotesize\begin{verbatim}
#include<translator_xx.h>
\end{verbatim}\normalsize 
 in {\tt set\-Translator()} add 

\footnotesize\begin{verbatim}
    else if (L_EQUAL("your_language_name"))
    {
      theTranslator = new TranslatorYourLanguage;
    }
\end{verbatim}\normalsize 
 after the {\tt if \{ ... \}} \item 
Edit libdoxygen.pro.in and add {\tt translator\_\-xx.h} to  the {\tt HEADERS} line. \item 
Edit {\tt translator\_\-xx.h}: \begin{CompactItemize}
\item 
Rename {\tt TRANSLATOR\_\-EN\_\-H} to {\tt TRANSLATOR\_\-XX\_\-H} twice. \item 
Rename Translator\-English to Translator\-Your\-Language  \item 
In the member {\tt id\-Language()} change \char`\"{}english\char`\"{} into the  name of your language (use lower case characters only). Depending on the language you may also wish to change the member functions  latex\-Language\-Support\-Command(), id\-Language\-Charset() and others (you will recognize them when you start the work). \item 
Edit all the strings that are returned by the member functions that  start with tr.  Try to match punctuation and capitals! To enter special characters (with accents) you can: \begin{CompactItemize}
\item 
 Enter them directly if your keyboard supports that and you are  using a Latin-1 font. Doxygen will translate the characters to proper $\mbox{\LaTeX}$ and leave the HTML and man output for what it is (which is fine, if id\-Language\-Charset() is set correctly). \item 
 Use html codes like \&auml; for an a with an umlaut (i.e. \"{a}). See the HTML specification for the codes. \end{CompactItemize}
\end{CompactItemize}
\item 
Run configure and make again from the root of the distribution,  in order to regenerated the Makefiles. \item 
Now you can use {\tt OUTPUT\_\-LANGUAGE = your\_\-language\_\-name}  in the config file to generate output in your language. \item 
Send {\tt translator\_\-xx.h} to me so I can add it to doxygen. Send also your name and e-mail address to be included in the {\tt maintainers.txt} list. \end{enumerate}
\subsubsection*{Maintaining a language}


As new versions of doxygen appear, new sentences ({\tt tr\-Xxxx()} methods) will be added to the {\tt Translator} interface class. Of course, these need to be translated as well (otherwise doxygen wouldn't even compile!). Waiting until all language maintainers have translated the new sentences and sent the results would not be very practical. The following text describes the usage of translator adapters to solve the problem.

{\bf The role of Translator Adapters.}  Whenever the {\tt Translator} class interface changes in the new release, the new class {\tt Translator\-Adapter\_\-x\_\-y\_\-z} is added to the {\tt translator\_\-adapter.h} file (here x, y, and z are numbers that correspond to the current version of doxygen). All translators that previously derived from the {\tt Translator} class now derive from this adapter class.

The {\tt Translator\-Adapter\_\-x\_\-y\_\-z} class implements the new, required methods. If the new method replaces some similar but obsolete method(s) (e.g. if the number of arguments changed and/or the functionality of the older method was changed or enriched), the {\tt Translator\-Adapter\_\-x\_\-y\_\-z} class may use the obsolete method to get the result which is as close as possible to the older result in the target language. If it is not possible, the result (the default translation) is obtained using the English translator, which is (by definition) always up to date.

{\bf For example,} when the new {\tt tr\-File()} method with parameters (to determine the capitalization of the first letter and the singular/plural form) was introduced to replace the older method {\tt tr\-Files()} without arguments, the following code appeared in one of the translator adapter classes:



\footnotesize\begin{verbatim}
    /*! This is the default implementation of the obsolete method
     * used in the documentation of a group before the list of
     * links to documented files.  This is possibly localized.
     */
    virtual QCString trFiles()
    { return "Files"; }

    /*! This is the localized implementation of newer equivalent
     * using the obsolete method trFiles().
     */
    virtual QCString trFile(bool first_capital, bool singular)
    {
      if (first_capital && !singular)
        return trFiles();  // possibly localized, obsolete method
      else
        return english.trFile(first_capital, singular);
    }
\end{verbatim}\normalsize 


The {\tt tr\-Files()} is not present in the {\tt Translator\-English} class, because it was removed as obsolete. However, it was used until now and its call was replaced by



\footnotesize\begin{verbatim}
    trFile(true, false)
\end{verbatim}\normalsize 


in the doxygen source files. Probably, many language translators implemented the obsolete method, so it perfectly makes sense to use the same language dependent result in those cases. The {\tt Translator\-English} does not implement the old method. It derives from the abstract {\tt Translator} class. On the other hand, the old translator for a different language does not implement the new {\tt tr\-File()} method. Because of that it is derived from another base class -- {\tt Translator\-Adapter\_\-x\_\-y\_\-z}. The {\tt Translator\-Adapter\_\-x\_\-y\_\-z} class have to implement the new, required {\tt tr\-File()} method. However, the translator adapter would not be compiled if the {\tt tr\-Files()} method was not implemented. This is the reason for implementing the old method in the translator adapter class (using the same code, that was removed from the Translator\-English).

The simplest way would be to pass the arguments to the English translator and to return its result. Instead, the adapter uses the old {\tt tr\-Files()} in one special case -- when the new {\tt tr\-File(true,\ false)} is called. This is the mostly used case at the time of introducing the new method -- see above. While this may look too complicated, the technique allows the developers of the core sources to change the Translator interface, while the users may not even notice the change. Of course, when the new {\tt tr\-File()} is used with different arguments, the English result is returned and it will be noticed by non English users. Here the maintainer of the language translator should implement at least that one particular method.

{\bf What says the base class of a language translator?} If the language translator class inherits from any adapter class the maintenance is needed. In such case, the language translator is not considered up-to-date. On the other hand, if the language translator derives directly from the abstract class {\tt Translator}, the language translator is up-to-date.

The translator adapter classes are chained so that the older translator adapter class uses the one-step-newer translator adapter as the base class. The newer adapter does less {\em adapting} work than the older one. The oldest adapter class derives (indirectly) from all of the adapter classes. The newest adapter class derives directly from the abstract class {\tt Translator}.

The name of the adapter class was chosen so that its suffix is derived from the previous version of doxygen. This way, one can say approximately, when the language translator class was last updated -- see details below. The newest adapter translator for CVS release (i.e. non official) is named {\tt Translator\-Adapter\-CVS}. As it derives only from the {\tt Translator} class, it can be used only for language translator classes that were up-to-date in the time of the last release.

Status of the translators that derive from the {\tt Translator\-Adapter\-CVS} is named as {\em almost up-to-date}. Its code is moved into the new {\tt Translator\_\-x\_\-y\_\-z} when new version of doxygen is officially released.

Once the oldest adapter class is not used by any of the language translators, it can be removed from the doxygen project. This also means, that there probably still is some language which uses the oldest adapter. The maintainers should try to reach the state with the minimal number of translator adapter classes.

{\bf To simplify the maintenance of the language translator classes} for the supported languages, the {\tt translator.pl} perl script was developed (located in {\tt doxygen/doc} directory).  It extracts the important information about obsolete and new methods from the source files for each of the languages.  The information is stored in the {\em translator report} ASCII file ({\tt doxygen/doc/translator\_\-report.txt}). 

Looking at the base class of the language translator, the script guesses also the status of the translator -- see the last column of the table with languages above. The {\tt translator.pl} is called automatically when the doxygen documentation is generated. You can also run the script manualy whenever you feel that it can help you. Of course, you are not forced to use the results of the script. You can find the same information by looking at the adapter class and its base classes.

{\bf How should I update my language translator?} Firstly, you should be the language maintainer, or you should let him/her know about the changes. The following text was written for the language maintainers as the primary audience.

There are several approaches to be taken when updating your language. If you are not extremely busy, you should always chose the most radical one. When the update takes much more time than you expected, you can always decide use some suitable translator adapter to finish the changes later and still make your translator working.

{\bf The most radical way of updating the language translator} is to make your translator class derive directly  from the abstract class {\tt Translator} and provide translations for the methods that are required to be implemented -- the compiler will tell you if you forgot to implement some of them. If you are in doubt, have a look at the {\tt Translator\-English} class to recognize the purpose of the implemented method. Looking at the previously used adapter class may help you sometimes, but it can also be misleading because the adapter classes do implement also the obsolete methods (see the previous {\tt tr\-Files()} example).

In other words, the up-to-date language translators do not need the {\tt Translator\-Adapter\_\-x\_\-y\_\-z} classes at all, and you do not need to implement anything else than the methods required by the Translator class (i.e. the pure virtual methods of the {\tt Translator} -- they  end with {\tt =0;}).

If everything compiles fine, try to run {\tt translator.pl}, and have a look at the translator report (ASCII file) at the {\tt doxygen/doc} directory. Even if your translator is marked as up-to-date, there still may be some remarks related to your souce code. Namely, the obsolete methods--that are not used at all--may be listed in the section for your language. Simply, remove their code (and run the {\tt translator.pl} again).

{\bf If you do not have time to finish all the updates} you should still start with {\em the most radical approach} as described above. You can always change the base class to the translator adapter class that implements all of the not-yet-implemented methods.

{\bf If you prefer to update your translator gradually}, look at the {\em translator report} generated by the {\tt translator.pl} script and choose one of the missing method that is implemented by the translator adapter, that is used as your base class. When there is not such a method in your translator adapter base class, you probably can change the translator adapter base to the newer one.

Do not blindly implement all methods that are implemented by your translator adapter base class. The reason is that the adapter classes implement also obsolete methods. Another reason is that some of the methods could become obsolete later.

