Orb/Doxygen/doc/language.tpl
changeset 0 42188c7ea2d9
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 
       
     2 ATTENTION! This is the template for generating language.doc. If you want to
       
     3 change the language.doc, make the changes here and inside maintainers.txt.
       
     4 
       
     5 /******************************************************************************
       
     6  * %(editnote)s 
       
     7  *
       
     8  * Copyright (C) 1997-2006 by Dimitri van Heesch.
       
     9  *
       
    10  * Permission to use, copy, modify, and distribute this software and its
       
    11  * documentation under the terms of the GNU General Public License is hereby 
       
    12  * granted. No representations are made about the suitability of this software 
       
    13  * for any purpose. It is provided "as is" without express or implied warranty.
       
    14  * See the GNU General Public License for more details.
       
    15  *
       
    16  * Documents produced by Doxygen are derivative works derived from the
       
    17  * input used in their production; they are not affected by this license.
       
    18  *
       
    19  * $Id: language.tpl 695 2009-05-22 11:07:08Z dimitri $
       
    20  */
       
    21 /*! \page langhowto Internationalization
       
    22 
       
    23 <h3>Support for multiple languages</h3>
       
    24 
       
    25 Doxygen has built-in support for multiple languages. This means that the
       
    26 text fragments, generated by doxygen, can be produced in languages other
       
    27 than English (the default). The output language is chosen through the
       
    28 configuration file (with default name and known as Doxyfile).
       
    29 
       
    30 Currently (version %(doxVersion)s), %(numLangStr)s languages 
       
    31 are supported (sorted alphabetically):
       
    32 %(supportedLangReadableStr)s.
       
    33 
       
    34 The table of information related to the supported languages follows.
       
    35 It is sorted by language alphabetically.  The <b>Status</b> column
       
    36 was generated from sources and shows approximately the last version
       
    37 when the translator was updated.
       
    38 
       
    39 %(informationTable)s
       
    40 
       
    41 Most people on the list have indicated that they were also busy
       
    42 doing other things, so if you want to help to speed things up please 
       
    43 let them (or me) know.
       
    44 
       
    45 If you want to add support for a language that is not yet listed 
       
    46 please read the next section.
       
    47 
       
    48 
       
    49 <h3>Adding a new language to doxygen</h3>
       
    50 
       
    51 This short HOWTO explains how to add support for the new language to Doxygen:
       
    52 
       
    53 Just follow these steps:
       
    54 <ol>
       
    55 <li>Tell me for which language you want to add support. If no one else
       
    56     is already working on support for that language, you will be 
       
    57     assigned as the maintainer for the language. 
       
    58 <li>Create a copy of translator_en.h and name it 
       
    59     translator_\<your_2_letter_country_code\>.h
       
    60     I'll use xx in the rest of this document.
       
    61 <li>Add definition of the symbol for your language in the configure 
       
    62 at two places in the script:
       
    63   <ol>
       
    64   <li>After the <code>f_langs=</code> is statement, in lower case.
       
    65   <li>In the string that following <code>\@allowed=</code> in upper case.
       
    66   </ol>
       
    67 The rerun the configure script such that is generates src/lang_cfg.h.
       
    68 This file should now contain a \#define for your language code.
       
    69 <li>Edit language.cpp:
       
    70     Add a 
       
    71 \verbatim
       
    72 #ifdef LANG_xx
       
    73 #include<translator_xx.h>
       
    74 #endif
       
    75 \endverbatim
       
    76     Remember to use the same symbol LANG_xx that you added to \c lang_cfg.h.
       
    77     I.e., the \c xx should be capital letters that identify your language.
       
    78     On the other hand, the \c xx inside your \c translator_xx.h should use
       
    79     lower case.
       
    80     <p>Now, in <code>setTranslator()</code> add
       
    81 \verbatim
       
    82 #ifdef LANG_xx
       
    83     else if (L_EQUAL("your_language_name"))
       
    84     {
       
    85       theTranslator = new TranslatorYourLanguage;
       
    86     }
       
    87 #endif    
       
    88 \endverbatim
       
    89     after the <code>if { ... }</code>. I.e., it must be placed after the code
       
    90     for creating the English translator at the beginning, and before the 
       
    91     <code>else { ... }</code> part that creates the translator for the 
       
    92     default language (English again).
       
    93 <li>Edit libdoxygen.pro.in and add \c translator_xx.h to 
       
    94     the \c HEADERS line.
       
    95 <li>Edit <code>translator_xx.h</code>:
       
    96    <ul>
       
    97    <li>Rename <code>TRANSLATOR_EN_H</code> to <code>TRANSLATOR_XX_H</code> 
       
    98        twice (i.e. in the \c \#ifndef and \c \#define preprocessor commands at 
       
    99        the beginning of the file).
       
   100    <li>Rename TranslatorEnglish to TranslatorYourLanguage 
       
   101    <li>In the member <code>idLanguage()</code> change "english" into the 
       
   102      name of your language (use lower case characters only). Depending
       
   103      on the language you may also wish to change the member functions 
       
   104      latexLanguageSupportCommand(), idLanguageCharset() and others
       
   105      (you will recognize them when you start the work).
       
   106    <li>Edit all the strings that are returned by the member functions that 
       
   107      start with tr. 
       
   108      Try to match punctuation and capitals!
       
   109      To enter special characters (with accents) you can:
       
   110      <ul>
       
   111      <li>  Enter them directly if your keyboard supports that and you are 
       
   112            using a Latin-1 font. Doxygen will translate the
       
   113            characters to proper \f$\mbox{\LaTeX}\f$ and leave the
       
   114            HTML and man output for what it is (which is fine, if
       
   115            idLanguageCharset() is set correctly).
       
   116      <li>  Use html codes like \&auml; for an a with an umlaut (i.e. &auml;).
       
   117            See the HTML specification for the codes.
       
   118      </ul>
       
   119    </ul>
       
   120 <li>Run configure and make again from the root of the distribution, 
       
   121     in order to regenerated the Makefiles.
       
   122 <li>Now you can use <code>OUTPUT_LANGUAGE = your_language_name</code> 
       
   123     in the config file to generate output in your language.
       
   124 <li>Send <code>translator_xx.h</code> to me so I can add it to doxygen.
       
   125     Send also your name and e-mail address to be included in the
       
   126     \c maintainers.txt list.
       
   127 </ol>
       
   128 
       
   129 
       
   130 <h3>Maintaining a language</h3>
       
   131 
       
   132 New versions of doxygen may use new translated sentences.  In such
       
   133 situation, the \c Translator class requires implementation of new
       
   134 methods -- its interface changes.  Of course, the English
       
   135 sentences need to be translated to the other languages.  At least,
       
   136 new methods have to be implemented by the language-related
       
   137 translator class; otherwise, doxygen wouldn't even compile.  Waiting
       
   138 until all language maintainers have translated the new sentences and
       
   139 sent the results would not be very practical. The following text
       
   140 describes the usage of translator adapters to solve the problem.
       
   141 
       
   142 <b>The role of Translator Adapters.</b> 
       
   143 Whenever the \c Translator class interface changes in the new
       
   144 release, the new class \c TranslatorAdapter_x_y_z is added to the \c
       
   145 translator_adapter.h file (here x, y, and z are numbers that
       
   146 correspond to the current official version of doxygen). All
       
   147 translators that previously derived from the \c Translator class now
       
   148 derive from this adapter class.
       
   149 
       
   150 The \c TranslatorAdapter_x_y_z class implements the new, required
       
   151 methods.  If the new method replaces some similar but obsolete
       
   152 method(s) (e.g. if the number of arguments changed and/or the
       
   153 functionality of the older method was changed or enriched), the \c
       
   154 TranslatorAdapter_x_y_z class may use the obsolete method to get the
       
   155 result which is as close as possible to the older result in the
       
   156 target language.  If it is not possible, the result (the default
       
   157 translation) is obtained using the English translator, which is (by
       
   158 definition) always up-to-date.  
       
   159 
       
   160 <b>For example,</b> when the new \c trFile() method with
       
   161 parameters (to determine the capitalization of the first letter and
       
   162 the singular/plural form) was introduced to replace the older method
       
   163 \c trFiles() without arguments, the following code appeared in one
       
   164 of the translator adapter classes:
       
   165 
       
   166 \verbatim
       
   167     /*! This is the default implementation of the obsolete method
       
   168      * used in the documentation of a group before the list of
       
   169      * links to documented files.  This is possibly localized.
       
   170      */
       
   171     virtual QCString trFiles()
       
   172     { return "Files"; }
       
   173 
       
   174     /*! This is the localized implementation of newer equivalent
       
   175      * using the obsolete method trFiles().
       
   176      */
       
   177     virtual QCString trFile(bool first_capital, bool singular)
       
   178     {
       
   179       if (first_capital && !singular)
       
   180         return trFiles();  // possibly localized, obsolete method
       
   181       else
       
   182         return english.trFile(first_capital, singular);
       
   183     }
       
   184 \endverbatim
       
   185 
       
   186 The \c trFiles() is not present in the \c TranslatorEnglish class,
       
   187 because it was removed as obsolete.  However, it was used until now
       
   188 and its call was replaced by 
       
   189 
       
   190 \verbatim
       
   191     trFile(true, false)
       
   192 \endverbatim
       
   193 
       
   194 in the doxygen source files.  Probably, many language translators
       
   195 implemented the obsolete method, so it perfectly makes sense to use
       
   196 the same language dependent result in those cases. The \c
       
   197 TranslatorEnglish does not implement the old method.  It derives
       
   198 from the abstract \c Translator class.  On the other hand, the old
       
   199 translator for a different language does not implement the new \c
       
   200 trFile() method.  Because of that it is derived from another base
       
   201 class -- \c TranslatorAdapter_x_y_z. The \c TranslatorAdapter_x_y_z
       
   202 class have to implement the new, required \c trFile() method.
       
   203 However, the translator adapter would not be compiled if the \c
       
   204 trFiles() method was not implemented. This is the reason for
       
   205 implementing the old method in the translator adapter class (using
       
   206 the same code, that was removed from the TranslatorEnglish).
       
   207 
       
   208 The simplest way would be to pass the arguments to the English
       
   209 translator and to return its result.  Instead, the adapter uses the
       
   210 old \c trFiles() in one special case -- when the new
       
   211 <code>trFile(true,&nbsp;false)</code> is called.  This is the
       
   212 mostly used case at the time of introducing the new method -- see
       
   213 above.  While this may look too complicated, the technique allows
       
   214 the developers of the core sources to change the Translator
       
   215 interface, while the users may not even notice the change.  Of
       
   216 course, when the new \c trFile() is used with different arguments,
       
   217 the English result is returned and it will be noticed by non English
       
   218 users.  Here the maintainer of the language translator should
       
   219 implement at least that one particular method.
       
   220 
       
   221 <b>What says the base class of a language translator?</b>
       
   222 If the language translator class inherits from any adapter class the
       
   223 maintenance is needed.  In such case, the language translator is not
       
   224 considered up-to-date.  On the other hand, if the language
       
   225 translator derives directly from the abstract class \c Translator, the
       
   226 language translator is up-to-date.
       
   227 
       
   228 The translator adapter classes are chained so that the older
       
   229 translator adapter class uses the one-step-newer translator adapter
       
   230 as the base class.  The newer adapter does less \e adapting work
       
   231 than the older one.  The oldest adapter class derives (indirectly)
       
   232 from all of the adapter classes.  The name of the adapter class is
       
   233 chosen so that its suffix is derived from the previous official
       
   234 version of doxygen that did not need the adapter.  This way, one can
       
   235 say approximately, when the language translator class was last
       
   236 updated -- see details below.
       
   237 
       
   238 The newest translator adapter derives from the abstract \c
       
   239 TranslatorAdapterBase class that derives directly from the abstract
       
   240 \c Translator class.  It adds only the private English-translator
       
   241 member for easy implementation of the default translation inside the
       
   242 adapter classes, and it also enforces implementation of one method
       
   243 for noticing the user that the language translation is not up-to-date
       
   244 (because of that some sentences in the generated files may appear in
       
   245 English).
       
   246 
       
   247 Once the oldest adapter class is not used by any of the language
       
   248 translators, it can be removed from the doxygen project.  The
       
   249 maintainers should try to reach the state with the minimal number of
       
   250 translator adapter classes.
       
   251 
       
   252 <b>To simplify the maintenance of the language translator classes</b>
       
   253 for the supported languages, the \c translator.py Python
       
   254 script was developed (located in \c doxygen/doc directory). 
       
   255 It extracts the important information about obsolete and
       
   256 new methods from the source files for each of the languages.  
       
   257 The information is stored in the <em>translator report</em> ASCII file
       
   258 (%(translatorReportFileName)s). 
       
   259 
       
   260 \htmlonly If you compiled this documentation
       
   261 from sources and if you have also doxygen sources available the
       
   262 link %(translatorReportLink)s should be valid.\endhtmlonly 
       
   263 
       
   264 Looking at the base class of the language translator, the script
       
   265 guesses also the status of the translator -- see the last column of
       
   266 the table with languages above.  The \c translator.py is called
       
   267 automatically when the doxygen documentation is generated.  You can
       
   268 also run the script manualy whenever you feel that it can help you.
       
   269 Of course, you are not forced to use the results of the script.  You
       
   270 can find the same information by looking at the adapter class and
       
   271 its base classes.
       
   272 
       
   273 <b>How should I update my language translator?</b> Firstly, you
       
   274 should be the language maintainer, or you should let him/her know
       
   275 about the changes.  The following text was written for the language
       
   276 maintainers as the primary audience.
       
   277 
       
   278 There are several approaches to be taken when updating your
       
   279 language.  If you are not extremely busy, you should always chose
       
   280 the most radical one.  When the update takes much more time than you
       
   281 expected, you can always decide use some suitable translator adapter to
       
   282 finish the changes later and still make your translator working.
       
   283 
       
   284 <b>The most radical way of updating the language translator</b> is
       
   285 to make your translator class derive directly 
       
   286 from the abstract class \c Translator and provide translations for the
       
   287 methods that are required to be implemented -- the compiler will
       
   288 tell you if you forgot to implement some of them.  If you are in
       
   289 doubt, have a look at the \c TranslatorEnglish class to recognize the
       
   290 purpose of the implemented method.  Looking at the previously used
       
   291 adapter class may help you sometimes, but it can also be misleading
       
   292 because the adapter classes do implement also the obsolete methods
       
   293 (see the previous \c trFiles() example).
       
   294 
       
   295 In other words, the up-to-date language translators do not need the
       
   296 \c TranslatorAdapter_x_y_z classes at all, and you do not need to
       
   297 implement anything else than the methods required by the Translator
       
   298 class (i.e. the pure virtual methods of the \c Translator -- they 
       
   299 end with <code>=0;</code>).
       
   300 
       
   301 If everything compiles fine, try to run \c translator.py, and have a
       
   302 look at the translator report (ASCII file) at the \c doxygen/doc
       
   303 directory. Even if your translator is marked as up-to-date, there
       
   304 still may be some remarks related to your souce code. Namely, the
       
   305 obsolete methods--that are not used at all--may be listed in the
       
   306 section for your language. Simply, remove their code (and run the \c
       
   307 translator.py again). Also, you will be informed when you forgot to
       
   308 change the base class of your translator class to some newer adapter
       
   309 class or directly to the Translator class.
       
   310 
       
   311 <b>If you do not have time to finish all the updates</b> you should
       
   312 still start with <em>the most radical approach</em> as described
       
   313 above.  You can always change the base class to the translator
       
   314 adapter class that implements all of the not-yet-implemented methods.
       
   315 
       
   316 <b>If you prefer to update your translator gradually</b>, have a look
       
   317 at \c TranslatorEnglish (the \c translator_en.h file). Inside, you
       
   318 will find the comments like <code>new since 1.2.4</code> that separate
       
   319 always a number of methods that were implemented in the stated
       
   320 version. Do implement the group of methods that are placed below the
       
   321 comment that uses the same version numbers as your translator adapter
       
   322 class. (For example, your translator class have to use the \c
       
   323 TranslatorAdapter_1_2_4, if it does not implement the methods below
       
   324 the comment <code>new since 1.2.4</code>. When you implement them,
       
   325 your class should use newer translator adapter.
       
   326 
       
   327 Run the \c translator.py script occasionaly and give it your \c xx
       
   328 identification (from \c translator_xx.h) to create the translator
       
   329 report shorter (also produced faster) -- it will contain only the
       
   330 information related to your translator. Once you reach the state when
       
   331 the base class should be changed to some newer adapter, you will see
       
   332 the note in the translator report.
       
   333  
       
   334 Warning: Don't forget to compile Doxygen to discover, whether it is
       
   335 compilable. The \c translator.py does not check if everything is
       
   336 correct with respect to the compiler. Because of that, it may lie
       
   337 sometimes about the necessary base class.
       
   338 
       
   339 <b>The most obsolete language translators</b> would lead to
       
   340 implementation of too complicated adapters. Because of that, doxygen
       
   341 developers may decide to derive such translators from the \c
       
   342 TranslatorEnglish class, which is by definition always up-to-date.
       
   343 
       
   344 When doing so, all the missing methods will be replaced by the
       
   345 English translation.  This means that not-implemented methods will
       
   346 always return the English result.  Such translators are marked using
       
   347 word \c obsolete.  You should read it <b>really obsolete</b>. No
       
   348 guess about the last update can be done.  
       
   349 
       
   350 Often, it is possible to construct better result from the obsolete
       
   351 methods.  Because of that, the translator adapter classes should be
       
   352 used if possible.  On the other hand, implementation of adapters for
       
   353 really obsolete translators brings too much maintenance and
       
   354 run-time overhead.
       
   355 
       
   356 */
       
   357