Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Embedding Qt's own language files
Forum Updated to NodeBB v4.3 + New Features

Embedding Qt's own language files

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 261 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    For my own application language files, I embed them in the application using a translations.qrc file:

    <!DOCTYPE RCC><RCC version="1.0">
    <qresource prefix="i18n">
        <file>DSS.ca.qm</file>
        <file>DSS.cs.qm</file>
        <file>DSS.de.qm</file>
        <file>DSS.en.qm</file>
        <file>DSS.es.qm</file>
        <file>DSS.fr.qm</file>
        <file>DSS.it.qm</file>
        <file>DSS.nl.qm</file>
        <file>DSS.pt_BR.qm</file>
        <file>DSS.ro.qm</file>
        <file>DSS.ru.qm</file>
        <file>DSS.tr.qm</file>
        <file>DSS.zh_TW.qm</file>
    </qresource>
    </RCC>
    

    I realise that windeploytqt will copy the Qt language files from $QtInstallDir\msvc2019_64\translations to a subdirectory of my output directory called translations. Instead of doing that however I'd prefer to include them in my .exe file to reduce the number of files I need to ship when I release the code.

    What's the preferred way to do that? Do I hack the qrc file above to add them directly from $QtInstallDir\msvc2019_64\translations ? Or do you suggest a different approach?

    JKSHJ 1 Reply Last reply
    0
    • PerdrixP Perdrix

      For my own application language files, I embed them in the application using a translations.qrc file:

      <!DOCTYPE RCC><RCC version="1.0">
      <qresource prefix="i18n">
          <file>DSS.ca.qm</file>
          <file>DSS.cs.qm</file>
          <file>DSS.de.qm</file>
          <file>DSS.en.qm</file>
          <file>DSS.es.qm</file>
          <file>DSS.fr.qm</file>
          <file>DSS.it.qm</file>
          <file>DSS.nl.qm</file>
          <file>DSS.pt_BR.qm</file>
          <file>DSS.ro.qm</file>
          <file>DSS.ru.qm</file>
          <file>DSS.tr.qm</file>
          <file>DSS.zh_TW.qm</file>
      </qresource>
      </RCC>
      

      I realise that windeploytqt will copy the Qt language files from $QtInstallDir\msvc2019_64\translations to a subdirectory of my output directory called translations. Instead of doing that however I'd prefer to include them in my .exe file to reduce the number of files I need to ship when I release the code.

      What's the preferred way to do that? Do I hack the qrc file above to add them directly from $QtInstallDir\msvc2019_64\translations ? Or do you suggest a different approach?

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @Perdrix said in Embedding Qt's own language files:

      What's the preferred way to do that? Do I hack the qrc file above to add them directly from $QtInstallDir\msvc2019_64\translations ? Or do you suggest a different approach?

      Disclaimer: I've never tried to override windeployqt and manually manage the Qt translations, so I don't have an approach to suggest. But here are some notes that might be of interest to you:

      Notice that windeployqt runs lconvert.exe to merge multiple files into one. The different source files come from different modules. So if you want to manage those directly, make sure you grab all the files from the various modules. You might also want to pre-merge them and add them to your own project.

      Notice also that some files are very tiny (~150+ bytes). These are "blank" files that you want to avoid.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved