zoukankan      html  css  js  c++  java
  • 当qml文件添加到qrc文件中,实现internationalization(国际化)

    lupdate test.pro只检测 SOURCE 和 HEADER中的文件,当qml文件添加到qrc中时lupdate test.pro时不能被检测到,这时需要手动添加qml文件或者ts文件告诉lupdate时检测,

    具体步骤,example:

    test.pro文件

    TRANSLATIONS += 
      fr.ts
      ch.ts // 这里是需要生成的翻译的语言生成的ts文件

    lupdate_only{
      SOURCES +=
        test.qml
        common/*.qml
    }

    然后lupdate test.pro就OK了

    Usage:
         lupdate [options] [project-file]
         lupdate [options] [source-file|path]... -ts ts-files
     Options:
         -help  Display this information and exit.
         -noobsolete
                Drop all obsolete strings.
         -extensions <ext>[,<ext>]...
                Process files with the given extensions only.
                The extension list must be separated with commas, not with whitespace.
                Default: 'ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx'.
         -pluralonly
                Only include plural form messages.
         -silent
                Don't explain what is being done.
         -version
                Display the version of lupdate and exit.

    lrelease test.pro生成qm文件
     Usage:
         lrelease [options] project-file
         lrelease [options] ts-files [-qm qm-file]
     Options:
         -help  Display this information and exit
         -compress
                Compress the .qm files
         -nounfinished
                Do not include unfinished translations
         -removeidentical
                If the translated text is the same as
                the source text, do not include the message
         -silent
                Don't explain what is being done
         -version
                Display the version of lrelease and exit
  • 相关阅读:
    MySQL存储引擎--MyISAM与InnoDB区别
    PHP笔试面试题精选(一)
    优化 sql 语句的一般步骤
    EXPLAIN 小秘密
    Git stash 使用的小技巧
    git remote用法
    git subtree用法
    nodejs-------windows安装配置
    MongoDB -----windows上安装服务
    layer父子页面交互
  • 原文地址:https://www.cnblogs.com/fuyanwen/p/3907103.html
Copyright © 2011-2022 走看看