📄 language.tpl
字号:
/****************************************************************************** * <notice>This is the template for generating language.doc. * Edit manually this file, not the language.doc!</notice> * * * Copyright (C) 1997-2001 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * *//*! \page langhowto Internationalization<h3>Support for multiple languages</h3>Doxygen has built-in support for multiple languages. This means that the text fragments that doxygen generates can be produced inlanguages other than English (the default) at configuration time.Currently (version $version), $numlang languages are supported (sorted alphabetically): $languages.The table of information related to the supported languages follows.It is sorted by language alphabetically. The <b>Status</b> columnwas generated from sources and shows approximately the last versionwhen the translator was updated.$information_tableMost people on the list have indicated that they were also busydoing 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.<h3>Adding a new language to doxygen</h3>This short HOWTO explains how to add support for a new language to Doxygen:Just follow these steps:<ol><li>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. <li>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.<li>Edit language.cpp: Add a \verbatim#include<translator_xx.h>\endverbatim in <code>setTranslator()</code> add\verbatim else if (L_EQUAL("your_language_name")) { theTranslator = new TranslatorYourLanguage; }\endverbatim after the <code>if { ... }</code><li>Edit libdoxygen.pro.in and add \c translator_xx.h to the \c HEADERS line.<li>Edit <code>translator_xx.h</code>: <ul> <li>Rename <code>TRANSLATOR_EN_H</code> to <code>TRANSLATOR_XX_H</code> twice. <li>Rename TranslatorEnglish to TranslatorYourLanguage <li>In the member <code>idLanguage()</code> change "english" into the name of your language (use lower case characters only). Depending on the language you may also wish to change the member functions latexLanguageSupportCommand(), idLanguageCharset() and others (you will recognize them when you start the work). <li>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: <ul> <li> Enter them directly if your keyboard supports that and you are using a Latin-1 font. Doxygen will translate the characters to proper \f$\mbox{\LaTeX}\f$ and leave the HTML and man output for what it is (which is fine, if idLanguageCharset() is set correctly). <li> Use html codes like \ä for an a with an umlaut (i.e. ä). See the HTML specification for the codes. </ul> </ul><li>Run configure and make again from the root of the distribution, in order to regenerated the Makefiles.<li>Now you can use <code>OUTPUT_LANGUAGE = your_language_name</code> in the config file to generate output in your language.<li>Send <code>translator_xx.h</code> to me so I can add it to doxygen. Send also your name and e-mail address to be included in the \c maintainers.txt list.</ol><h3>Maintaining a language</h3>New versions of doxygen may use new translated sentences. In suchsituation, the \c Translator class requires implementation of newmethods -- its interface changes. Of course, the Englishsentences need to be translated to the other languages. At least,new methods have to be implemented by the language-relatedtranslator class; otherwise, doxygen wouldn't even compile. Waitinguntil all language maintainers have translated the new sentences andsent the results would not be very practical. The following textdescribes the usage of translator adapters to solve the problem.<b>The role of Translator Adapters.</b> Whenever the \c Translator class interface changes in the newrelease, the new class \c TranslatorAdapter_x_y_z is added to the \ctranslator_adapter.h file (here x, y, and z are numbers thatcorrespond to the current official version of doxygen). Alltranslators that previously derived from the \c Translator class nowderive from this adapter class.The \c TranslatorAdapter_x_y_z class implements the new, requiredmethods. If the new method replaces some similar but obsoletemethod(s) (e.g. if the number of arguments changed and/or thefunctionality of the older method was changed or enriched), the \cTranslatorAdapter_x_y_z class may use the obsolete method to get theresult which is as close as possible to the older result in thetarget language. If it is not possible, the result (the defaulttranslation) is obtained using the English translator, which is (bydefinition) always up-to-date. <b>For example,</b> when the new \c trFile() method withparameters (to determine the capitalization of the first letter andthe singular/plural form) was introduced to replace the older method\c trFiles() without arguments, the following code appeared in oneof the translator adapter classes:\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); }\endverbatimThe \c trFiles() is not present in the \c TranslatorEnglish class,because it was removed as obsolete. However, it was used until nowand its call was replaced by \verbatim trFile(true, false)\endverbatimin the doxygen source files. Probably, many language translatorsimplemented the obsolete method, so it perfectly makes sense to usethe same language dependent result in those cases. The \cTranslatorEnglish does not implement the old method. It derivesfrom the abstract \c Translator class. On the other hand, the oldtranslator for a different language does not implement the new \ctrFile() method. Because of that it is derived from another baseclass -- \c TranslatorAdapter_x_y_z. The \c TranslatorAdapter_x_y_zclass have to implement the new, required \c trFile() method.However, the translator adapter would not be compiled if the \ctrFiles() method was not implemented. This is the reason forimplementing the old method in the translator adapter class (usingthe same code, that was removed from the TranslatorEnglish).The simplest way would be to pass the arguments to the Englishtranslator and to return its result. Instead, the adapter uses theold \c trFiles() in one special case -- when the new<code>trFile(true, false)</code> is called. This is themostly used case at the time of introducing the new method -- seeabove. While this may look too complicated, the technique allowsthe developers of the core sources to change the Translatorinterface, while the users may not even notice the change. Ofcourse, when the new \c trFile() is used with different arguments,the English result is returned and it will be noticed by non Englishusers. Here the maintainer of the language translator shouldimplement at least that one particular method.<b>What says the base class of a language translator?</b>If the language translator class inherits from any adapter class themaintenance is needed. In such case, the language translator is notconsidered up-to-date. On the other hand, if the languagetranslator derives directly from the abstract class \c Translator, thelanguage translator is up-to-date.The translator adapter classes are chained so that the oldertranslator adapter class uses the one-step-newer translator adapteras the base class. The newer adapter does less \e adapting workthan the older one. The oldest adapter class derives (indirectly)from all of the adapter classes. The name of the adapter class ischosen so that its suffix is derived from the previous officialversion of doxygen that did not need the adapter. This way, one cansay approximately, when the language translator class was lastupdated -- see details below.The newest translator adapter derives from the abstract \cTranslatorAdapterBase class that derives directly from the abstract\c Translator class. It adds only the private English-translatormember for easy implementation of the default translation inside theadapter classes, and it also enforces implementation of one methodfor noticing the user that the language translation is not up-to-date(because of that some sentences in the generated files may appear inEnglish).Once the oldest adapter class is not used by any of the languagetranslators, it can be removed from the doxygen project. Themaintainers should try to reach the state with the minimal number oftranslator adapter classes.<b>To simplify the maintenance of the language translator classes</b>for the supported languages, the \c translator.pl perlscript was developed (located in \c doxygen/doc directory). It extracts the important information about obsolete andnew methods from the source files for each of the languages. The information is stored in the <em>translator report</em> ASCII file($translator_report_file_name). \htmlonly If you compiled this documentationfrom sources and if you have also doxygen sources available thelink $translator_report_link should be valid.\endhtmlonly Looking at the base class of the language translator, the scriptguesses also the status of the translator -- see the last column ofthe table with languages above. The \c translator.pl is calledautomatically when the doxygen documentation is generated. You canalso 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. Youcan find the same information by looking at the adapter class andits base classes.<b>How should I update my language translator?</b> Firstly, youshould be the language maintainer, or you should let him/her knowabout the changes. The following text was written for the languagemaintainers as the primary audience.There are several approaches to be taken when updating yourlanguage. If you are not extremely busy, you should always chosethe most radical one. When the update takes much more time than youexpected, you can always decide use some suitable translator adapter tofinish the changes later and still make your translator working.<b>The most radical way of updating the language translator</b> isto make your translator class derive directly from the abstract class \c Translator and provide translations for themethods that are required to be implemented -- the compiler willtell you if you forgot to implement some of them. If you are indoubt, have a look at the \c TranslatorEnglish class to recognize thepurpose of the implemented method. Looking at the previously usedadapter class may help you sometimes, but it can also be misleadingbecause the adapter classes do implement also the obsolete methods(see the previous \c trFiles() example).In other words, the up-to-date language translators do not need the\c TranslatorAdapter_x_y_z classes at all, and you do not need toimplement anything else than the methods required by the Translatorclass (i.e. the pure virtual methods of the \c Translator -- they end with <code>=0;</code>).If everything compiles fine, try to run \c translator.pl, and have alook at the translator report (ASCII file) at the \c doxygen/docdirectory. Even if your translator is marked as up-to-date, therestill may be some remarks related to your souce code. Namely, theobsolete methods--that are not used at all--may be listed in thesection for your language. Simply, remove their code (and run the\c translator.pl again).<b>If you do not have time to finish all the updates</b> you shouldstill start with <em>the most radical approach</em> as describedabove. You can always change the base class to the translatoradapter class that implements all of the not-yet-implemented methods.<b>If you prefer to update your translator gradually</b>, lookat the <em>translator report</em> generated by the \c translator.pl scriptand choose one of the missing method that is implemented by thetranslator adapter, that is used as your base class. When there isnot such a method in your translator adapter base class, you probablycan change the translator adapter base to the newer one.Do not blindly implement all methods that are implemented by yourtranslator adapter base class. The reason is that the adapterclasses implement also obsolete methods. Another reason is thatsome of the methods could become obsolete from some newer adapter on.*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -