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. Handling plurals with no numbers inthe text?
Forum Updated to NodeBB v4.3 + New Features

Handling plurals with no numbers inthe text?

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 6 Posters 1.0k Views 3 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

    31a38c7d-079c-41c7-9fbc-d1d0bae3f9a3-image.png

    I set the group-box title for singular/plural using an appropriate tr() invocation:

    ui->dropFiles->setTitle(tr("Add %n file(s) as", "IDC_DROPFILESTEXT", static_cast<int>(fileCount)));
    

    But the radio buttons being plural is a bit tacky....

    Is it possible to do this:

    lightFrames->setText(QCoreApplication::translate("DropFilesDlg", "Light Frames", "IDC_LIGHTFRAMES", static_cast<int>(fileCount)));

    and set the singular form to "A Light Frame" and the plural form to "Light Frames"?

    Clearly I'll need to move the translation stuff into my code rather than having it in the ui header.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Simply add a function and eithter set the text for one or for more items (and hopefully don't have to translate to languages which has more translations)

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

      1 Reply Last reply
      0
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        Yes Polish is a bear to translate plurals.

        JonBJ 1 Reply Last reply
        0
        • PerdrixP Perdrix

          Yes Polish is a bear to translate plurals.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Perdrix said in Handling plurals with no numbers inthe text?:

          Yes Polish is a bear to translate plurals.

          Purely OoI, given this topic is solved, why is that? I know no Polish!

          PerdrixP 1 Reply Last reply
          0
          • JonBJ JonB

            @Perdrix said in Handling plurals with no numbers inthe text?:

            Yes Polish is a bear to translate plurals.

            Purely OoI, given this topic is solved, why is that? I know no Polish!

            PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote on last edited by Perdrix
            #5

            @JonB In Polish, there isn't just singular and plural, there are three forms:

            Singular: n = 1
            Paucal: n = 2--4, 22--24, 32--34, 42--44, ...
            Plural: n = 0, 5--21, 25--31, 35--41, ...
            

            Luckily Qt understands that and offers three forms for Polish translation.
            D.

            JonBJ 1 Reply Last reply
            0
            • PerdrixP Perdrix

              @JonB In Polish, there isn't just singular and plural, there are three forms:

              Singular: n = 1
              Paucal: n = 2--4, 22--24, 32--34, 42--44, ...
              Plural: n = 0, 5--21, 25--31, 35--41, ...
              

              Luckily Qt understands that and offers three forms for Polish translation.
              D.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Perdrix
              What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....

              M 1 Reply Last reply
              0
              • PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote on last edited by
                #7

                Deadly serious! Dom is Polish for house.

                0 dom贸w
                1 dom
                2 domy
                5 dom贸w
                21 dom贸w
                22 domy

                etc..

                D.

                jsulmJ 1 Reply Last reply
                0
                • PerdrixP Perdrix

                  Deadly serious! Dom is Polish for house.

                  0 dom贸w
                  1 dom
                  2 domy
                  5 dom贸w
                  21 dom贸w
                  22 domy

                  etc..

                  D.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Perdrix @JonB Similar in Russian:
                  0 Domow
                  1 Dom
                  2 Doma
                  3 Doma
                  4 Doma
                  5 Domow
                  6 Domow
                  21 Domow
                  22 Doma

                  I know, in English you do not even differentiate between "Du" and "Sie" (German) :-D

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  JonBJ 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Perdrix @JonB Similar in Russian:
                    0 Domow
                    1 Dom
                    2 Doma
                    3 Doma
                    4 Doma
                    5 Domow
                    6 Domow
                    21 Domow
                    22 Doma

                    I know, in English you do not even differentiate between "Du" and "Sie" (German) :-D

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @jsulm
                    OMG. But this is not practical! If I want to ask you about the cows in the field, and I want to speak very correct Polish, I have to first count to check whether there are 21 or 22 or 25 of them....!

                    jsulmJ 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @jsulm
                      OMG. But this is not practical! If I want to ask you about the cows in the field, and I want to speak very correct Polish, I have to first count to check whether there are 21 or 22 or 25 of them....!

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @JonB Only if you want to tell the exact number of cows :-)
                      Yeah, some languages have their specialities.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • JonBJ JonB

                        @Perdrix
                        What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....

                        M Offline
                        M Offline
                        mchinand
                        wrote on last edited by mchinand
                        #11

                        @JonB said in Handling plurals with no numbers inthe text?:

                        @Perdrix
                        What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....

                        Somewhat similar in English are the endings of ordinal numbers. 1st, 2nd, 3rd, 4th, ...11th, 12th, 13th,... 21st, 22nd, 23rd, 24th,..., etc.

                        JonBJ 1 Reply Last reply
                        0
                        • M mchinand

                          @JonB said in Handling plurals with no numbers inthe text?:

                          @Perdrix
                          What? Are you serious?? You have to count how many in ranges to decide how "plural" they are??? Surely you can't have a different word-plural for if it's between 2 and 4 in each ten.....

                          Somewhat similar in English are the endings of ordinal numbers. 1st, 2nd, 3rd, 4th, ...11th, 12th, 13th,... 21st, 22nd, 23rd, 24th,..., etc.

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #12

                          @mchinand
                          Oh, yes, kind of, I see. Just I don't have to count how many cows :)

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SimonSchroeder
                            wrote on last edited by
                            #13

                            This got a little side tracked. But, I think I have another solution to offer.

                            In the original code you could actually write tr("%nLight Frames", fileCount). Then you would also need an English translation. The English translation file also just needs the translations for where you are using these plurals because everywhere else it will fall back to the language in the source code (which happens to be English 馃槉). Any translation would certainly drop the %n, but could use it to differentiate the plurals.

                            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