?? linguist-manager.leaf
字號:
\chapter Release Manager\index Release ManagerTwo tools are provided for the release manager, \l lupdate and \llrelease. These tools depend on \e qmake project files. You don'thave to use \e qmake, though.A third tool, \c qm2ts, can be used for converting Qt 2.x messagefiles to \c .ts files.\section1 Qt Project Files\index .pro Files\index Project Files\index qmake!Project Files\l lupdate and \l lrelease depend on information in the application's\c .pro Qt project file. There must be an entry in the \c TRANSLATIONSsection of the project file for each language that is additional tothe native language. A typical entry looks like this:\index TRANSLATIONS!in Project Files\quotefile tt2/tt2.pro\skipto TRANSLATIONS\printline tt2_fr\printline tt2_nlUsing a locale within the translation file name is useful fordetermining which language to load at runtime. This is explained in\link Programmers Chapter 4: Programmers \endlink.\index HEADERS!in Project Files\index SOURCES!in Project Files\index FORMS!in Project Files\index TRANSLATIONS!in Project FilesAn example of a complete \c .pro file with four translation source files:\code HEADERS = main-dlg.h \ options-dlg.h SOURCES = main-dlg.cpp \ options-dlg.cpp \ main.cpp FORMS = search-dlg.ui TRANSLATIONS = superapp_dk.ts \ superapp_fi.ts \ superapp_no.ts \ superapp_se.ts\endcode\index QApplication!defaultCodec()\index defaultCodec()!QApplication\index DEFAULTCODEC!in Project Files\index Chinese Language\index Japanese Language\l QApplication::setDefaultCodec() makes it possible to choose a8-bit encoding for literal strings that appear within \c tr() calls.This is useful for applications whose source language is, for example,Chinese or Japanese. If no encoding is set, \c tr() uses Latin-1.If you do use the QApplication::defaultCodec() mechanism in yourapplication, \e {Qt Linguist} needs you to set the \c DEFAULTCODECentry in the \c .pro file as well. For example:\code DEFAULTCODEC = ISO-8859-5\endcode\section1 lupdate\index lupdateUsage: \c {lupdate myproject.pro} \index Qt DesignerThis is a simple command line tool. \l lupdate reads a Qt \c .proproject file, finds the translatable strings in the specified source,header and \e {Qt Designer} interface files, and produces or updatesthe \c .ts translation files listed in the project file. Thetranslation files are given to the translator who uses \e {QtLinguist} to read the files and insert the translations.Companies that have their own translators in-house may find it usefulto run \l lupdate regularly, perhaps monthly, as the applicationdevelops. This will lead to a fairly low volume of translation workspread evenly over the life of the project and will allow thetranslators to support a number of projects simultaneously.Companies that hire in translators as required may prefer to run \llupdate only a few times in the application's life cycle, the firsttime might be just before the first test phase. This will provide thetranslator with a substantial single block of work and any bugs thatthe translator detects may easily be included with those found duringthe initial test phase. The second and any subsequent \l lupdate runswould probably take place during the final beta phase.\index .ts Files\index Translation Source Files\index XMLThe \c .ts file format is a simple human-readable XML format that canbe used with version control systems if required.\section1 lrelease\index lreleaseUsage: \c {lrelease myproject.pro}\index .qm Files\index Qt Message FilesThis is another simple command line tool. It reads a Qt \c .proproject file and produces the \c .qm files used by the application,one for each \c .ts translation source file listed in the projectfile. The \c .qm file format is a compact binary format that providesextremely fast lookups for translations.This tool is run whenever a release of the application is to be made,from initial test version through to final release version. If the \c.qm files are not created, e.g. because an alpha release is requiredbefore any translation has been undertaken, the application will runperfectly well using the text the programmers placed in the sourcefiles. Once the \c .qm files are available the application willdetect them and use them automatically.Note that \l lrelease will only incorporate translations that aremarked as "done". If a translation is missing, or has failedvalidation, the original text will be used instead.\section1 Missing TranslationsBoth \l lupdate and \l lrelease may be used with \c .ts translationsource files which are incomplete. Missing translations will be replacedwith the native language phrases at runtime.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -