• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 319, comments - 22, trackbacks - 0, articles - 11
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            qt lupdate 功能說明(收集轉載)

            Posted on 2011-05-12 07:27 RTY 閱讀(637) 評論(0)  編輯 收藏 引用 所屬分類: Qt轉載隨筆
            http://blog.163.com/modingfa_002/blog/static/11092546620114105622401/?latestBlog

            一、lupdate 的命令行參數說明

             1 Usage:
             2     lupdate [options] [project-file]qt lupdate 功能說明 - modingfa_002 - 出發了不要問路在哪!
             3     lupdate [options] [source-file|path|@lst-file]qt lupdate 功能說明 - modingfa_002 - 出發了不要問路在哪!  -ts ts-files|@lst-file
             4 
             5 lupdate is part of Qt's Linguist tool chain. It extracts translatable
             6 messages from Qt UI files, C++, Java and JavaScript/QtScript source code.
             7 Extracted messages are stored in textual translation source files (typically
             8 Qt TS XML). New and modified messages can be merged into existing TS files.
             9 
            10 Options:
            11     -help  Display this information and exit.
            12     -no-obsolete
            13            Drop all obsolete strings.
            14     -extensions <ext>[,<ext>]qt lupdate 功能說明 - modingfa_002 - 出發了不要問路在哪!
            15            Process files with the given extensions only.
            16            The extension list must be separated with commas, not with whitespace
            17 .
            18            Default: 'java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml'
            19 .
            20     -pluralonly
            21            Only include plural form messages.
            22     -silent
            23            Do not explain what is being done.
            24     -no-sort
            25            Do not sort contexts in TS files.
            26     -no-recursive
            27            Do not recursively scan the following directories.
            28     -recursive
            29            Recursively scan the following directories (default).
            30     -I <includepath> or -I<includepath>
            31            Additional location to look for include files.
            32            May be specified multiple times.
            33     -locations {absolute|relative|none}
            34            Specify/override how source code references are saved in TS files.
            35            Default is absolute.
            36     -no-ui-lines
            37            Do not record line numbers in references to UI files.
            38     -disable-heuristic {sametext|similartext|number}
            39            Disable the named merge heuristic. Can be specified multiple times.
            40     -pro <filename>
            41            Name of a .pro file. Useful for files with .pro file syntax but
            42            different file suffix. Projects are recursed into and merged.
            43     -source-language <language>[_<region>]
            44            Specify the language of the source strings for new files.
            45            Defaults to POSIX if not specified.
            46     -target-language <language>[_<region>]
            47            Specify the language of the translations for new files.
            48            Guessed from the file name if not specified.
            49     -ts <ts-file>qt lupdate 功能說明 - modingfa_002 - 出發了不要問路在哪!
            50            Specify the output file(s). This will override the TRANSLATIONS
            51            and nullify the CODECFORTR from possibly specified project files.
            52     -codecfortr <codec>
            53            Specify the codec assumed for tr() calls. Effective only with -ts.
            54     -version
            55            Display the version of lupdate and exit.
            56     @lst-file
            57            Read additional file names (one per line) from lst-file.
            58 


            二、lrealease的命令行參數說明

             1 Usage:
             2     lrelease [options] project-file
             3     lrelease [options] ts-files [-qm qm-file]
             4 
             5 lrelease is part of Qt's Linguist tool chain. It can be used as a
             6 stand-alone tool to convert XML-based translations files in the TS
             7 format into the 'compiled' QM format used by QTranslator objects.
             8 
             9 Options:
            10     -help  Display this information and exit
            11     -idbased
            12            Use IDs instead of source strings for message keying
            13     -compress
            14            Compress the QM files
            15     -nounfinished
            16            Do not include unfinished translations
            17     -removeidentical
            18            If the translated text is the same as
            19            the source text, do not include the message
            20     -markuntranslated <prefix>
            21            If a message has no real translation, use the source text
            22            prefixed with the given string instead
            23     -silent
            24            Do not explain what is being done
            25     -version
            26            Display the version of lrelease and exit
            27 


            三、示例說明
            1. 提取aboutDialog.cpp欲翻譯的內容到ts文件中

            lupdate -codecfortr GB2312 aboutdialog.cpp -ts aboutdialog.ts

            2.如何在程序中使用ts生成的qm文件,下面用硬代碼來解釋
             1 #include <QtGui>
             2 #include "mainwindow.h"
             3 
             4 int main(int argc, char *argv[])
             5 {
             6     QApplication app(argc, argv);
             7 
             8     QTranslator translator;
             9     bool b = false;
            10     b = translator.load("aboutdialog.qm");
            11     app.installTranslator(&translator);
            12 
            13 
            14     MainWindow w;
            15     w.show();
            16 
            17     return app.exec();
            18 }
            19 

            3. 加載多個獨立的qm文件。一個QTranslator對象只有最后load的才算數!
                QTranslator translator;
                bool b = false;
                b = translator.load("aboutdialog.qm");
                b = translator.load("mainwindow.qm");
                app.installTranslator(&translator);
            說明:只有"mainwindow.qm" 文件被正常使用。

            下面可以通過聲明兩個Translator對象進行load,然后安裝就可以分模塊使用了!
            1     QTranslator translator1, translator2;
            2     bool b = false;
            3     b = translator1.load("aboutdialog.qm");
            4     b = translator2.load("mainwindow.qm");
            5     app.installTranslator(&translator1);
            6     app.installTranslator(&translator2);
            无码人妻精品一区二区三区久久久 | 久久99中文字幕久久| 久久精品www人人爽人人| 天天爽天天爽天天片a久久网| 久久免费香蕉视频| 久久国产精品77777| 久久国产精品免费| 久久精品国产99国产精品澳门| 久久精品成人免费观看97| 91久久香蕉国产熟女线看| 国产精品久久久久9999高清| 99久久精品免费看国产一区二区三区 | 久久精品无码一区二区WWW| 久久99精品久久久久久9蜜桃| 久久天天躁狠狠躁夜夜2020一| 色综合久久综精品| 久久久久久久亚洲Av无码| 欧美激情精品久久久久久久九九九| 久久天堂AV综合合色蜜桃网| 久久精品国产2020| 久久久久久久综合日本| 国内精品久久久久久99蜜桃 | 国内精品久久久久伊人av| 日本加勒比久久精品| 国产精品青草久久久久福利99| 青青草原综合久久| 性色欲网站人妻丰满中文久久不卡| 久久久久无码国产精品不卡| 国产精品无码久久综合网| 久久精品国内一区二区三区 | 欧美丰满熟妇BBB久久久| 日日狠狠久久偷偷色综合96蜜桃| 91精品国产综合久久香蕉| 久久最近最新中文字幕大全| 久久久久国产精品| 久久九九青青国产精品| 精品久久香蕉国产线看观看亚洲| 97久久香蕉国产线看观看| 国产精品久久自在自线观看| 日本福利片国产午夜久久| 国产精品女同一区二区久久|