Blame doc/language.tpl

Packit 1c1d7e
Packit 1c1d7e
ATTENTION! This is the template for generating language.doc. If you want to
Packit 1c1d7e
change the language.doc, make the changes here and inside maintainers.txt.
Packit 1c1d7e
Packit 1c1d7e
/******************************************************************************
Packit 1c1d7e
 * %(editnote)s
Packit 1c1d7e
 *
Packit 1c1d7e
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
Packit 1c1d7e
 *
Packit 1c1d7e
 * Permission to use, copy, modify, and distribute this software and its
Packit 1c1d7e
 * documentation under the terms of the GNU General Public License is hereby
Packit 1c1d7e
 * granted. No representations are made about the suitability of this software
Packit 1c1d7e
 * for any purpose. It is provided "as is" without express or implied warranty.
Packit 1c1d7e
 * See the GNU General Public License for more details.
Packit 1c1d7e
 *
Packit 1c1d7e
 * Documents produced by doxygen are derivative works derived from the
Packit 1c1d7e
 * input used in their production; they are not affected by this license.
Packit 1c1d7e
 *
Packit 1c1d7e
 */
Packit 1c1d7e
/*! \page langhowto Internationalization
Packit 1c1d7e
Packit 1c1d7e

Support for multiple languages

Packit 1c1d7e
Packit 1c1d7e
Doxygen has built-in support for multiple languages. This means that the
Packit 1c1d7e
text fragments, generated by doxygen, can be produced in languages other
Packit 1c1d7e
than English (the default). The output language is chosen through the
Packit 1c1d7e
configuration option \ref cfg_output_language "OUTPUT_LANGUAGE" in the
Packit 1c1d7e
configuration file (with default name and known as Doxyfile). To switch
Packit 1c1d7e
between languages inside a comment block the \ref cmdtilde "\\~" command
Packit 1c1d7e
can be used.
Packit 1c1d7e
Packit 1c1d7e
Currently (version %(doxVersion)s), %(numLangStr)s languages
Packit 1c1d7e
are supported (sorted alphabetically):
Packit 1c1d7e
%(supportedLangReadableStr)s.
Packit 1c1d7e
Packit 1c1d7e
The table of information related to the supported languages follows.
Packit 1c1d7e
It is sorted by language alphabetically.  The Status column
Packit 1c1d7e
was generated from sources and shows approximately the last version
Packit 1c1d7e
when the translator was updated.
Packit 1c1d7e
Packit 1c1d7e
%(informationTable)s
Packit 1c1d7e
Packit 1c1d7e
Most people on the list have indicated that they were also busy
Packit 1c1d7e
doing other things, so if you want to help to speed things up please
Packit 1c1d7e
let them (or me) know.
Packit 1c1d7e
Packit 1c1d7e
If you want to add support for a language that is not yet listed
Packit 1c1d7e
please read the next section.
Packit 1c1d7e
Packit 1c1d7e
Packit 1c1d7e

Adding a new language to doxygen

Packit 1c1d7e
Packit 1c1d7e
This short HOWTO explains how to add support for the new language to doxygen:
Packit 1c1d7e
Packit 1c1d7e
Just follow the following steps:
Packit 1c1d7e
    Packit 1c1d7e
  1. Tell me for which language you want to add support. If no one else
  2. Packit 1c1d7e
        is already working on support for that language, you will be
    Packit 1c1d7e
        assigned as the maintainer for the language.
    Packit 1c1d7e
  3. Create a copy of `doxygen/src/translator_en.h` and name it
  4. Packit 1c1d7e
        `doxygen/src/translator_<your_2_letter_country_code>.h`
    Packit 1c1d7e
        I'll use `xx` in the rest of this document (and `XX` for the uppercase version).
    Packit 1c1d7e
  5. Edit `doxygen/src/language.cpp`:
  6. Packit 1c1d7e
        Add the following code:
    Packit 1c1d7e
    \verbatim
    Packit 1c1d7e
    #ifdef LANG_XX
    Packit 1c1d7e
    #include<translator_xx.h>
    Packit 1c1d7e
    #endif
    Packit 1c1d7e
    \endverbatim
    Packit 1c1d7e
        Remember to use the same symbol `LANG_XX` that was added to `doxygen/src/lang_cfg.h`.
    Packit 1c1d7e
        

    Now, in setTranslator() add

    Packit 1c1d7e
    \verbatim
    Packit 1c1d7e
    #ifdef LANG_XX
    Packit 1c1d7e
        else if (L_EQUAL("your_language_name"))
    Packit 1c1d7e
        {
    Packit 1c1d7e
          theTranslator = new TranslatorYourLanguage;
    Packit 1c1d7e
        }
    Packit 1c1d7e
    #endif
    Packit 1c1d7e
    \endverbatim
    Packit 1c1d7e
        after the if { ... }. I.e., it must be placed after the code
    Packit 1c1d7e
        for creating the English translator at the beginning, and before the
    Packit 1c1d7e
        else { ... } part that creates the translator for the
    Packit 1c1d7e
        default language (English again).
    Packit 1c1d7e
  7. Edit doxygen/src/translator_xx.h:
  8. Packit 1c1d7e
       
      Packit 1c1d7e
         
    • Use the UTF-8 capable editor and open the file using the UTF-8 mode.
    • Packit 1c1d7e
         
    • Rename TRANSLATOR_EN_H to TRANSLATOR_XX_H
    • Packit 1c1d7e
             twice (i.e. in the \c \#ifndef and \c \#define preprocessor commands at
      Packit 1c1d7e
             the beginning of the file).
      Packit 1c1d7e
         
    • Rename \c TranslatorEnglish to \c TranslatorYourLanguage
    • Packit 1c1d7e
         
    • In the member idLanguage() change "english" into the
    • Packit 1c1d7e
           name of your language (use lower case characters only). Depending
      Packit 1c1d7e
           on the language you may also wish to change the member functions
      Packit 1c1d7e
           `latexLanguageSupportCommand()` and other (you will recognize them when
      Packit 1c1d7e
           you start the work).
      Packit 1c1d7e
         
    • Edit all the strings that are returned by the member functions that
    • Packit 1c1d7e
           start with \c tr.
      Packit 1c1d7e
           Try to match punctuation and capitals!
      Packit 1c1d7e
           To enter special characters (with accents) you can:
      Packit 1c1d7e
           
        Packit 1c1d7e
             
      • Enter them directly if your keyboard supports that. Recall that
      • Packit 1c1d7e
                   the text is expected to be saved using the UTF-8 encoding. Doxygen
        Packit 1c1d7e
                   will translate the characters to proper \LaTeX and
        Packit 1c1d7e
                   leaves the HTML and man output in UTF-8.
        Packit 1c1d7e
             
      • Use HTML codes like \c \ä for an \c a with an \c umlaut (i.e. \c ä).
      • Packit 1c1d7e
                   See the HTML specification for the codes.
        Packit 1c1d7e
             
        Packit 1c1d7e
           
        Packit 1c1d7e
      • Packit 1c1d7e
            
          Packit 1c1d7e
                
        • On *nix systems:
        • Packit 1c1d7e
              
            Packit 1c1d7e
                    
          • Rerun the `configure` script from the root (i.e. in the \c doxygen directory) so
          • Packit 1c1d7e
                    that it generates `doxygen/src/lang_cfg.h`.
            Packit 1c1d7e
                    This file should now contain a  \c \#define for your language code.
            Packit 1c1d7e
                    
          • Run \c make again from the root (i.e. in the \c doxygen
          • Packit 1c1d7e
                    directory) of the distribution, in order to regenerate the `Makefile`s.
            Packit 1c1d7e
                
            Packit 1c1d7e
                  
          • On Windows:
          • Packit 1c1d7e
                
              Packit 1c1d7e
                     
            • stop Visual Stdio
            • Packit 1c1d7e
                     
            • open a command window
            • Packit 1c1d7e
                     
            • goto the directory `doxygen\src`
            • Packit 1c1d7e
                     
            • give the command `python languages.py > ..\winbuild\Languages.rules`
            • Packit 1c1d7e
                     
            • close the command window
            • Packit 1c1d7e
                     
            • start Visual Studio again
            • Packit 1c1d7e
                     
            • Your language should now be selectable in the `General` part of the `Settings` of the `Properties`
            • Packit 1c1d7e
                     window of `lang_cfg.py`, by default Your language will be `on`. Rebuild `doxygen` (and `doxywizard`) now.
              Packit 1c1d7e
                  
              Packit 1c1d7e
                  
              Packit 1c1d7e
            • Now you can use OUTPUT_LANGUAGE = your_language_name
            • Packit 1c1d7e
                  in the config file to generate output in your language.
              Packit 1c1d7e
            • Send translator_xx.h to me so I can add it to doxygen.
            • Packit 1c1d7e
                  Send also your name and e-mail address to be included in the
              Packit 1c1d7e
                  \c maintainers.txt list. You can also clone the doxygen repository
              Packit 1c1d7e
                  at GitHub and make a Pull Request later.
              Packit 1c1d7e
              Packit 1c1d7e
              Packit 1c1d7e
              Packit 1c1d7e

              Maintaining a language

              Packit 1c1d7e
              Packit 1c1d7e
              New versions of doxygen may use new translated sentences.  In such
              Packit 1c1d7e
              situation, the \c Translator class requires implementation of new
              Packit 1c1d7e
              methods -- its interface changes.  Of course, the English
              Packit 1c1d7e
              sentences need to be translated to the other languages.  At least,
              Packit 1c1d7e
              new methods have to be implemented by the language-related
              Packit 1c1d7e
              translator class; otherwise, doxygen wouldn't even compile.  Waiting
              Packit 1c1d7e
              until all language maintainers have translated the new sentences and
              Packit 1c1d7e
              sent the results would not be very practical. The following text
              Packit 1c1d7e
              describes the usage of translator adapters to solve the problem.
              Packit 1c1d7e
              Packit 1c1d7e
              The role of Translator Adapters.
              Packit 1c1d7e
              Whenever the \c Translator class interface changes in the new
              Packit 1c1d7e
              release, the new class \c TranslatorAdapter_x_y_z is added to the \c
              Packit 1c1d7e
              translator_adapter.h file (here x, y, and z are numbers that
              Packit 1c1d7e
              correspond to the current official version of doxygen). All
              Packit 1c1d7e
              translators that previously derived from the \c Translator class now
              Packit 1c1d7e
              derive from this adapter class.
              Packit 1c1d7e
              Packit 1c1d7e
              The \c TranslatorAdapter_x_y_z class implements the new, required
              Packit 1c1d7e
              methods.  If the new method replaces some similar but obsolete
              Packit 1c1d7e
              method(s) (e.g. if the number of arguments changed and/or the
              Packit 1c1d7e
              functionality of the older method was changed or enriched), the \c
              Packit 1c1d7e
              TranslatorAdapter_x_y_z class may use the obsolete method to get the
              Packit 1c1d7e
              result which is as close as possible to the older result in the
              Packit 1c1d7e
              target language.  If it is not possible, the result (the default
              Packit 1c1d7e
              translation) is obtained using the English translator, which is (by
              Packit 1c1d7e
              definition) always up-to-date.
              Packit 1c1d7e
              Packit 1c1d7e
              For example, when the new \c trFile() method with
              Packit 1c1d7e
              parameters (to determine the capitalization of the first letter and
              Packit 1c1d7e
              the singular/plural form) was introduced to replace the older method
              Packit 1c1d7e
              \c trFiles() without arguments, the following code appeared in one
              Packit 1c1d7e
              of the translator adapter classes:
              Packit 1c1d7e
              Packit 1c1d7e
              \verbatim
              Packit 1c1d7e
                  /*! This is the default implementation of the obsolete method
              Packit 1c1d7e
                   * used in the documentation of a group before the list of
              Packit 1c1d7e
                   * links to documented files.  This is possibly localized.
              Packit 1c1d7e
                   */
              Packit 1c1d7e
                  virtual QCString trFiles()
              Packit 1c1d7e
                  { return "Files"; }
              Packit 1c1d7e
              Packit 1c1d7e
                  /*! This is the localized implementation of newer equivalent
              Packit 1c1d7e
                   * using the obsolete method trFiles().
              Packit 1c1d7e
                   */
              Packit 1c1d7e
                  virtual QCString trFile(bool first_capital, bool singular)
              Packit 1c1d7e
                  {
              Packit 1c1d7e
                    if (first_capital && !singular)
              Packit 1c1d7e
                      return trFiles();  // possibly localized, obsolete method
              Packit 1c1d7e
                    else
              Packit 1c1d7e
                      return english.trFile(first_capital, singular);
              Packit 1c1d7e
                  }
              Packit 1c1d7e
              \endverbatim
              Packit 1c1d7e
              Packit 1c1d7e
              The \c trFiles() is not present in the \c TranslatorEnglish class,
              Packit 1c1d7e
              because it was removed as obsolete.  However, it was used until now
              Packit 1c1d7e
              and its call was replaced by
              Packit 1c1d7e
              Packit 1c1d7e
              \verbatim
              Packit 1c1d7e
                  trFile(true, false)
              Packit 1c1d7e
              \endverbatim
              Packit 1c1d7e
              Packit 1c1d7e
              in the doxygen source files.  Probably, many language translators
              Packit 1c1d7e
              implemented the obsolete method, so it perfectly makes sense to use
              Packit 1c1d7e
              the same language dependent result in those cases. The \c
              Packit 1c1d7e
              TranslatorEnglish does not implement the old method.  It derives
              Packit 1c1d7e
              from the abstract \c Translator class.  On the other hand, the old
              Packit 1c1d7e
              translator for a different language does not implement the new \c
              Packit 1c1d7e
              trFile() method.  Because of that it is derived from another base
              Packit 1c1d7e
              class -- \c TranslatorAdapter_x_y_z. The \c TranslatorAdapter_x_y_z
              Packit 1c1d7e
              class has to implement the new, required \c trFile() method.
              Packit 1c1d7e
              However, the translator adapter would not be compiled if the \c
              Packit 1c1d7e
              trFiles() method was not implemented. This is the reason for
              Packit 1c1d7e
              implementing the old method in the translator adapter class (using
              Packit 1c1d7e
              the same code, that was removed from the TranslatorEnglish).
              Packit 1c1d7e
              Packit 1c1d7e
              The simplest way would be to pass the arguments to the English
              Packit 1c1d7e
              translator and to return its result.  Instead, the adapter uses the
              Packit 1c1d7e
              old \c trFiles() in one special case -- when the new
              Packit 1c1d7e
              trFile(true, false) is called.  This is the
              Packit 1c1d7e
              mostly used case at the time of introducing the new method -- see
              Packit 1c1d7e
              above.  While this may look too complicated, the technique allows
              Packit 1c1d7e
              the developers of the core sources to change the Translator
              Packit 1c1d7e
              interface, while the users may not even notice the change.  Of
              Packit 1c1d7e
              course, when the new \c trFile() is used with different arguments,
              Packit 1c1d7e
              the English result is returned and it will be noticed by non English
              Packit 1c1d7e
              users.  Here the maintainer of the language translator should
              Packit 1c1d7e
              implement at least that one particular method.
              Packit 1c1d7e
              Packit 1c1d7e
              What says the base class of a language translator?
              Packit 1c1d7e
              If the language translator class inherits from any adapter class then
              Packit 1c1d7e
              maintenance is needed.  In such case, the language translator is
              Packit 1c1d7e
              considered not up-to-date.  On the other hand, if the language
              Packit 1c1d7e
              translator derives directly from the abstract class \c Translator, the
              Packit 1c1d7e
              language translator is up-to-date.
              Packit 1c1d7e
              Packit 1c1d7e
              The translator adapter classes are chained so that the older
              Packit 1c1d7e
              translator adapter class uses the one-step-newer translator adapter
              Packit 1c1d7e
              as the base class.  The newer adapter does less \e adapting work
              Packit 1c1d7e
              than the older one.  The oldest adapter class derives (indirectly)
              Packit 1c1d7e
              from all of the adapter classes.  The name of the adapter class is
              Packit 1c1d7e
              chosen so that its suffix is derived from the previous official
              Packit 1c1d7e
              version of doxygen that did not need the adapter.  This way, one can
              Packit 1c1d7e
              say approximately, when the language translator class was last
              Packit 1c1d7e
              updated -- see details below.
              Packit 1c1d7e
              Packit 1c1d7e
              The newest translator adapter derives from the abstract \c
              Packit 1c1d7e
              TranslatorAdapterBase class that derives directly from the abstract
              Packit 1c1d7e
              \c Translator class.  It adds only the private English-translator
              Packit 1c1d7e
              member for easy implementation of the default translation inside the
              Packit 1c1d7e
              adapter classes, and it also enforces implementation of one method
              Packit 1c1d7e
              for notifying the user that the language translation is not up-to-date
              Packit 1c1d7e
              (because of that some sentences in the generated files may appear in
              Packit 1c1d7e
              English).
              Packit 1c1d7e
              Packit 1c1d7e
              Once the oldest adapter class is not used by any of the language
              Packit 1c1d7e
              translators, it can be removed from the doxygen project.  The
              Packit 1c1d7e
              maintainers should try to reach the state with the minimal number of
              Packit 1c1d7e
              translator adapter classes.
              Packit 1c1d7e
              Packit 1c1d7e
              To simplify the maintenance of the language translator classes
              Packit 1c1d7e
              for the supported languages, the \c translator.py Python
              Packit 1c1d7e
              script was developed (located in \c doxygen/doc directory).
              Packit 1c1d7e
              It extracts the important information about obsolete and
              Packit 1c1d7e
              new methods from the source files for each of the languages.
              Packit 1c1d7e
              The information is stored in the translator report ASCII file
              Packit 1c1d7e
              (\c %(translatorReportFileName)s).
              Packit 1c1d7e
              Packit 1c1d7e
              \htmlonly If you compiled this documentation
              Packit 1c1d7e
              from sources and if you have also doxygen sources available the
              Packit 1c1d7e
              link %(translatorReportLink)s should be valid.\endhtmlonly
              Packit 1c1d7e
              Packit 1c1d7e
              Looking at the base class of the language translator, the script
              Packit 1c1d7e
              guesses also the status of the translator -- see the last column of
              Packit 1c1d7e
              the table with languages above.  The \c translator.py is called
              Packit 1c1d7e
              automatically when the doxygen documentation is generated.  You can
              Packit 1c1d7e
              also run the script manually whenever you feel that it can help you.
              Packit 1c1d7e
              Of course, you are not forced to use the results of the script.  You
              Packit 1c1d7e
              can find the same information by looking at the adapter class and
              Packit 1c1d7e
              its base classes.
              Packit 1c1d7e
              Packit 1c1d7e
              How should I update my language translator? First, you
              Packit 1c1d7e
              should be the language maintainer, or you should let him/her know
              Packit 1c1d7e
              about the changes.  The following text was written for the language
              Packit 1c1d7e
              maintainers as the primary audience.
              Packit 1c1d7e
              Packit 1c1d7e
              There are several approaches to be taken when updating your
              Packit 1c1d7e
              language.  If you are not extremely busy, you should always chose
              Packit 1c1d7e
              the most radical one.  When the update takes much more time than you
              Packit 1c1d7e
              expected, you can always decide use some suitable translator adapter to
              Packit 1c1d7e
              finish the changes later and still make your translator working.
              Packit 1c1d7e
              Packit 1c1d7e
              The most radical way of updating the language translator is
              Packit 1c1d7e
              to make your translator class derive directly
              Packit 1c1d7e
              from the abstract class \c Translator and provide translations for the
              Packit 1c1d7e
              methods that are required to be implemented -- the compiler will
              Packit 1c1d7e
              tell you if you forgot to implement some of them.  If you are in
              Packit 1c1d7e
              doubt, have a look at the \c TranslatorEnglish class to recognize the
              Packit 1c1d7e
              purpose of the implemented method.  Looking at the previously used
              Packit 1c1d7e
              adapter class may help you sometimes, but it can also be misleading
              Packit 1c1d7e
              because the adapter classes do implement also the obsolete methods
              Packit 1c1d7e
              (see the previous \c trFiles() example).
              Packit 1c1d7e
              Packit 1c1d7e
              In other words, the up-to-date language translators do not need the
              Packit 1c1d7e
              \c TranslatorAdapter_x_y_z classes at all, and you do not need to
              Packit 1c1d7e
              implement anything else than the methods required by the Translator
              Packit 1c1d7e
              class (i.e. the pure virtual methods of the \c Translator -- they
              Packit 1c1d7e
              end with =0;).
              Packit 1c1d7e
              Packit 1c1d7e
              If everything compiles fine, try to run \c translator.py, and have a
              Packit 1c1d7e
              look at the translator report (ASCII file) at the \c doxygen/doc
              Packit 1c1d7e
              directory. Your translator is marked as up-to-date only if the script
              Packit 1c1d7e
              does not detect anything special. If the translator uses the \c Translator
              Packit 1c1d7e
              base class, there still may be some remarks related to your source code.
              Packit 1c1d7e
              In the case, the translator is marked as almost up-to-date.
              Packit 1c1d7e
              Namely, the obsolete methods--that are not used at all--may be listed in the
              Packit 1c1d7e
              section for your language. Simply, remove their code (and run the \c
              Packit 1c1d7e
              translator.py again). Also, you will be informed when you forgot to
              Packit 1c1d7e
              change the base class of your translator class to some newer adapter
              Packit 1c1d7e
              class or directly to the Translator class.
              Packit 1c1d7e
              Packit 1c1d7e
              If you do not have time to finish all the updates you should
              Packit 1c1d7e
              still start with the most radical approach as described
              Packit 1c1d7e
              above.  You can always change the base class to the translator
              Packit 1c1d7e
              adapter class that implements all of the not-yet-implemented methods.
              Packit 1c1d7e
              Packit 1c1d7e
              If you prefer to update your translator gradually, have a look
              Packit 1c1d7e
              at \c TranslatorEnglish (the \c translator_en.h file). Inside, you
              Packit 1c1d7e
              will find the comments like new since 1.2.4 that separate
              Packit 1c1d7e
              always a number of methods that were implemented in the stated
              Packit 1c1d7e
              version. Do implement the group of methods that are placed below the
              Packit 1c1d7e
              comment that uses the same version numbers as your translator adapter
              Packit 1c1d7e
              class. (For example, your translator class have to use the \c
              Packit 1c1d7e
              TranslatorAdapter_1_2_4, if it does not implement the methods below
              Packit 1c1d7e
              the comment new since 1.2.4. When you implement them,
              Packit 1c1d7e
              your class should use a newer translator adapter.
              Packit 1c1d7e
              Packit 1c1d7e
              Run the \c translator.py script occasionally and give it your \c xx
              Packit 1c1d7e
              identification (from \c translator_xx.h) to create the translator
              Packit 1c1d7e
              report shorter (also produced faster) -- it will contain only the
              Packit 1c1d7e
              information related to your translator. Once you reach the state when
              Packit 1c1d7e
              the base class should be changed to some newer adapter, you will see
              Packit 1c1d7e
              the note in the translator report.
              Packit 1c1d7e
              Packit 1c1d7e
              Warning: Don't forget to compile doxygen to discover, whether it is
              Packit 1c1d7e
              compilable. The \c translator.py does not check if everything is
              Packit 1c1d7e
              correct with respect to the compiler. Because of that, it may lie
              Packit 1c1d7e
              sometimes about the necessary base class.
              Packit 1c1d7e
              Packit 1c1d7e
              The most obsolete language translators would lead to
              Packit 1c1d7e
              implementation of too complicated adapters. Because of that, doxygen
              Packit 1c1d7e
              developers may decide to derive such translators from the \c
              Packit 1c1d7e
              TranslatorEnglish class, which is by definition always up-to-date.
              Packit 1c1d7e
              Packit 1c1d7e
              When doing so, all the missing methods will be replaced by the
              Packit 1c1d7e
              English translation.  This means that not-implemented methods will
              Packit 1c1d7e
              always return the English result.  Such translators are marked using
              Packit 1c1d7e
              the word \c obsolete.  You should read it really obsolete. No
              Packit 1c1d7e
              guess about the last update can be done.
              Packit 1c1d7e
              Packit 1c1d7e
              Often, it is possible to construct better result from the obsolete
              Packit 1c1d7e
              methods.  Because of that, the translator adapter classes should be
              Packit 1c1d7e
              used if possible.  On the other hand, implementation of adapters for
              Packit 1c1d7e
              really obsolete translators brings too much maintenance and
              Packit 1c1d7e
              run-time overhead.
              Packit 1c1d7e
              Packit 1c1d7e
              \htmlonly
              Packit 1c1d7e
              Go to the next section or return to the
              Packit 1c1d7e
               index.
              Packit 1c1d7e
              \endhtmlonly
              Packit 1c1d7e
              Packit 1c1d7e
              */
              Packit 1c1d7e