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. QtLinguist and Plural rules for a new translation language
Forum Updated to NodeBB v4.3 + New Features

QtLinguist and Plural rules for a new translation language

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 754 Views 1 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.
  • L Offline
    L Offline
    Luganda01
    wrote on last edited by
    #1

    Hello,
    I am about to begin translating some of Qt into a new language, Luganda (aka 'Ganda'), whose code is 'lg' or 'lg_UG.
    I am experiencing two problems; 1. When I try to open a translation (.ts) file in QtLinguist it first complains that it does not know the plural rules for the language.
    does-not-know-plurals-rules.png
    There appears not to be anywhere to tell QtLinguist what they are.
    2. When I run lupdate -list-languages it does not include Luganda or Ganda in the resulting list. In addition, the code 'lg_UG' is assigned to multiple other languages.
    lupdate-list-languages.png
    Could anyone assist me with this please?
    I would like to get QtLinguist to know the plural rules for Luganda/Ganda and to have lupdate include Luganda/Ganda in the list of languages, with the code 'lg_UG' correctly assigned to just this language.

    Regards,

    Kizito

    1 Reply Last reply
    0
    • L Luganda01

      @Christian-Ehrlicher

      Hello,

      Luganda falls into the category of 'English style languages'. The plural rules for these appear to be in the
      static const NumerusTableEntry numerusTable[] = {
      ..
      ..
      { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0,
      "nplurals=2; plural=(n != 1);" },
      ..
      ..
      }

      section of https://code.qt.io/cgit/qt/qttools.git/tree/src/linguist/shared/numerus.cpp.
      Adding it to that list should fix the lack of plural rules.

      I will post to the list.

      Thanks for the advice.

      Regards,

      Kizito

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @Luganda01 said in QtLinguist and Plural rules for a new translation language:

      I will post to the list.

      You either can create a bug report with your patch or even better directly provide a patch for it.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      L 1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,

        Are you thinking of adding support and translation to Qt as well ?

        If so, you can start by reading this wiki page.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        L 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Are you thinking of adding support and translation to Qt as well ?

          If so, you can start by reading this wiki page.

          L Offline
          L Offline
          Luganda01
          wrote on last edited by Luganda01
          #3

          @SGaist
          Hello,

          Thanks for the welcome.

          I have ended up here having translated the Linux desktop LXQt and found that it relies on Qt for some of its translations. So, yes, my intention is to add Luganda support and translations to Qt.

          I have read that wiki page, set up the necessary accounts, joined the translation and development mailing lists and followed the git cloning and build instructions.

          I noticed the plurals problem whilst trying out the LXQt files on my system. The LXQt project uses Weblate to enable the translators to do their bit. This gives us .ts files to download, which I have been converting to .qm files via QtLinguist. That is where I saw it complaining and removing the plurals from the output files.

          Whilst researching the cause by scouring the mailing list archives and this forum I came across the lupdate -list-languages check. Further research in the source code has lead me to https://code.qt.io/cgit/qt/qttools.git/tree/src/linguist/shared/numerus.cpp which appears to be where the lupdate command and QtLinguist get their language information from.

          That file is missing an entry for Luganda (or 'Ganda' as QLocale has it, viz. 'QLocale::Ganda 194').

          From reading the comments in the source code, it also appears that the way the lupdate system works is that if it only finds partial information on a language it fills the rest in with whatever the host system has set as the locale. This seems to be why I get multiple instances of other languages showing up as 'lg_UG'.

          If my musings are correct would it help if I to made a suggestion on the development mailing list?

          Regards,

          Kizito

          Christian EhrlicherC 1 Reply Last reply
          0
          • L Luganda01

            @SGaist
            Hello,

            Thanks for the welcome.

            I have ended up here having translated the Linux desktop LXQt and found that it relies on Qt for some of its translations. So, yes, my intention is to add Luganda support and translations to Qt.

            I have read that wiki page, set up the necessary accounts, joined the translation and development mailing lists and followed the git cloning and build instructions.

            I noticed the plurals problem whilst trying out the LXQt files on my system. The LXQt project uses Weblate to enable the translators to do their bit. This gives us .ts files to download, which I have been converting to .qm files via QtLinguist. That is where I saw it complaining and removing the plurals from the output files.

            Whilst researching the cause by scouring the mailing list archives and this forum I came across the lupdate -list-languages check. Further research in the source code has lead me to https://code.qt.io/cgit/qt/qttools.git/tree/src/linguist/shared/numerus.cpp which appears to be where the lupdate command and QtLinguist get their language information from.

            That file is missing an entry for Luganda (or 'Ganda' as QLocale has it, viz. 'QLocale::Ganda 194').

            From reading the comments in the source code, it also appears that the way the lupdate system works is that if it only finds partial information on a language it fills the rest in with whatever the host system has set as the locale. This seems to be why I get multiple instances of other languages showing up as 'lg_UG'.

            If my musings are correct would it help if I to made a suggestion on the development mailing list?

            Regards,

            Kizito

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Luganda01 said in QtLinguist and Plural rules for a new translation language:

            If my musings are correct would it help if I to made a suggestion on the development mailing list?

            Yes, or directly create a patch to see if something else is missing like e.g. the information about the plural forms. It must be somewhere in the code too I would guess.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            L 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @Luganda01 said in QtLinguist and Plural rules for a new translation language:

              If my musings are correct would it help if I to made a suggestion on the development mailing list?

              Yes, or directly create a patch to see if something else is missing like e.g. the information about the plural forms. It must be somewhere in the code too I would guess.

              L Offline
              L Offline
              Luganda01
              wrote on last edited by
              #5

              @Christian-Ehrlicher

              Hello,

              Luganda falls into the category of 'English style languages'. The plural rules for these appear to be in the
              static const NumerusTableEntry numerusTable[] = {
              ..
              ..
              { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0,
              "nplurals=2; plural=(n != 1);" },
              ..
              ..
              }

              section of https://code.qt.io/cgit/qt/qttools.git/tree/src/linguist/shared/numerus.cpp.
              Adding it to that list should fix the lack of plural rules.

              I will post to the list.

              Thanks for the advice.

              Regards,

              Kizito

              Christian EhrlicherC 1 Reply Last reply
              0
              • L Luganda01

                @Christian-Ehrlicher

                Hello,

                Luganda falls into the category of 'English style languages'. The plural rules for these appear to be in the
                static const NumerusTableEntry numerusTable[] = {
                ..
                ..
                { englishStyleRules, sizeof(englishStyleRules), englishStyleForms, englishStyleLanguages, 0,
                "nplurals=2; plural=(n != 1);" },
                ..
                ..
                }

                section of https://code.qt.io/cgit/qt/qttools.git/tree/src/linguist/shared/numerus.cpp.
                Adding it to that list should fix the lack of plural rules.

                I will post to the list.

                Thanks for the advice.

                Regards,

                Kizito

                Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @Luganda01 said in QtLinguist and Plural rules for a new translation language:

                I will post to the list.

                You either can create a bug report with your patch or even better directly provide a patch for it.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                L 1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  @Luganda01 said in QtLinguist and Plural rules for a new translation language:

                  I will post to the list.

                  You either can create a bug report with your patch or even better directly provide a patch for it.

                  L Offline
                  L Offline
                  Luganda01
                  wrote on last edited by
                  #7

                  @Christian-Ehrlicher
                  Hello,
                  Thanks, I posted to that list and also created, tested and submitted a patch.

                  Regards,

                  SGaistS 1 Reply Last reply
                  0
                  • L Luganda01 has marked this topic as solved on
                  • L Luganda01

                    @Christian-Ehrlicher
                    Hello,
                    Thanks, I posted to that list and also created, tested and submitted a patch.

                    Regards,

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    @Luganda01 thanks for the involvement !

                    Can you post a link to the patch/ticket ? That way other people may find it more easily :-)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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