Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121136 CMake API Review for Qt 6.7
  3. QTBUG-122396

Address Qt 6.7 CMake API review notes for qttranslations

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Fixed
    • P2: Important
    • None
    • Build System: CMake
    • None
    • b387a6cd8 (dev), 1d5586460 (dev), 974d791f3 (dev), 7d1dd8d71 (dev), fdf06f5db (6.7), 2d5d8137f (6.7), e294095b4 (6.7), c3b2bde90 (dev), 908404d9f (dev), b3a847f6a (dev), 13a6934ef (dev), 610e91b1d (dev), 11cf9f40d (dev), d2255ade3 (6.7), 251ea84ae (6.7)

    Description

      See https://git.qt.io/alcroito/qt6-cmake-api-review/-/blob/master/api_review_qt_6_7_part2.md#qbase

      qtbase qt_standard_project_setup action points

      ✅ AP: Rename `I18N_NATIVE_LANGUAGE` to `I18N_SOURCE_LANGUAGE`

      ✅ AP: Rename `I18N_LANGUAGES` to `I18N_TRANSLATED_LANGUAGES`

      ✅ AP: Always generates plurals file source language unless opted out
      This is already the case.

      ✅ AP: Add opt out QT_I18N_NO_GENERATE_DEVELOPMENT_LANGUAGE_PLURALS_ONLY_FILE
      I'll make this an option to qt_add_translations

      ✅ AP: Default to english if `I18N_SOURCE_LANGUAGE` is not set, no warning, no error,
      because Info.plist created by xcode new project wizard implicitly has english

      ✅ AP: Don't add example snippet, instead add see also link to `qt_add_translations`
      paragraph that also calls `qt_standard_project_setup`

      ✅ AP: If source language is specified also to `I18N_TRANSLATED_LANGUAGES`,
      generate full strings for it, and not plurals file

      Needs more thought.

      ❌ AP: Consider not generating plurals if no plurals in code,
      need care that cmake file dependencies still work

      Considered and rejected. Users can turn the generation of the plurals-only file off. Generating the file is inexpensive.

      ✅ AP: Rename cmake variables QT_I18N_LANGUAGES and QT_I18N_NATIVE_LANGUAGE to QT_I18N_TRANSLATED_LANGUAGES and QT_I18N_SOURCE_LANGUAGE

      Final proposed synopsis:

      set(QT_I18N_NO_GENERATE_DEVELOPMENT_LANGUAGE_PLURALS_ONLY_FILE TRUE)
      
      qt_standard_project_setup(
          I18N_SOURCE_LANGUAGE en
          I18N_TRANSLATED_LANGUAGES fr de
      )
      

      qttools qt_add_lupdate

      ✅ AP: Mention the old deprecated signature in the synopsis, so there will be 2 signatures.

      ✅ AP: Introduce since qt verison blurb.

      ✅ AP: Update example snippet with something richer

      ✅ AP: Update `NATIVE_TS_FILE` to `PLURALS_TS_FILE`

      qttools qt_add_translations

      ✅ AP: Add opt out NO_GENERATE_DEVELOPMENT_LANGUAGE_PLURALS_ONLY_FILE

      ✅ AP: There is a use case to pass in extra qm files (e.g qt sdk translations) to
      `qt_add_translations` to merge them, currently not released, open gerrit change,
      possibly in Qt 6.8.

      https://codereview.qt-project.org/q/topic:QTBUG-110444

      ✅ AP: Look into what happens when id-based translations are mixed with regular translations
      https://doc.qt.io/qt-6/linguist-id-based-i18n.html

      Result: you can apparently mix those in when producing .ts files.
      However, when producing the .qm files, you need to decide whether lrelease is called with the -idbased flag or not. I've played with the i18n example and added one id-based translation. I can have either id-based translations or regular translations. On .qm file level, we cannot mix the two.

      ✅ AP: Mention idbased option on qt_add_translations doc page, and link to page above
      just mention `LRELEASE_OPTIONS -idbased`

      💼 AP: Kai: Talk to qt design team why they use idbased translations

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes