Qt plural forms not detected on unfinished translations

Hello :wave:

When importing a Qt translation file (.TS), plurals are not detected when using this syntax:

<message numerus="yes">
  <source>String with %n plural(s).</source>
  <translation type="unfinished"/>
</message>

While they are detected when using this one:

<message numerus="yes">
  <source>String with %n plural(s).</source>
  <translation type="unfinished">
    <numerusform/>
  </translation>
</message>

It also seem that Crowdin exports Qt TS files using the first format (at least from what I’ve seen using the Github integration), even when provided the second format as an input, causing big diffs and possibly issues when re-importing the exported files.

I guess plural form detection could be based on the numerus="yes" attribute on the <message> object, rather than the presence of a <numerusform> inside <translation> (at least that’s what it seem to be doing).

Bionus

For reference, here are the full .TS files I just used to reproduce the issue:

Doesn’t work:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
  <context>
    <name>Test</name>
    <message numerus="yes">
      <source>String with %n plural(s).</source>
      <translation type="unfinished"/>
    </message>
  </context>
</TS>

Works:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
  <context>
    <name>Test</name>
    <message numerus="yes">
      <source>String with %n plural(s).</source>
      <translation type="unfinished">
        <numerusform/>
      </translation>
    </message>
  </context>
</TS>

Hi @Bionus ,

Could you please kindly share your source file and translation file? So we could test everything

Hello :wave:

This is the file I used the other day to reproduce the issue:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
  <context>
    <name>Test</name>
    <message numerus="yes">
      <source>String with %n plural(s).</source>
      <translation type="unfinished"/>
    </message>
  </context>
</TS>

Here, String with %n plural(s). is a plural form (from the numerus="yes" attribute) but isn’t detected as such.

This is also the format that is pushed to Github by Crowdin when no translations are set for a plural form.

Hi @Bionus !

As far as I understand you are using GitHub to manage the files. Could you please also share with us the screenshot of how this sting is displayed directly in the Editor?

Thanks!

Sure, although this can also be reproduced by just importing the file as a new source translation. Here’s how the file with only numerus="yes" looks like (translating to French):

only_numerus

And here’s the version with <numerusform/>, which works as expected:

Hi @Bionus,

Indeed, in order for the plurals to be correctly recognized in the Qt TS format, it is necessary to add <numerusform/> attribute to the file. You are welcome to read more details on this file format in our Store.