[QT/TS] File exporter has issues with plurals!

Just found out today. When Crowdin exports translation to “English, Great Britain” mutation to TS (Qt) file, header in XML looks like this:

<TS version="2.1" language="en-GB" sourcelanguage="en">

but it should look like this:

<TS version="2.1" language="en_GB" sourcelanguage="en">

Notice the “_” (correct) vs “-” (wrong) in language code! Wrong language code (for example “en-GB”) results in pluralisation rules NOT being loaded by Qt runtime and breaks plural strings in applications.

1 Like

Hi @martinrotter,

You are welcome to change the code inside the file with the Resource File Processing App for Crowdin - Simplify Translation Workflow app. It can help you change the code in the way you need it on the export :slight_smile:

Hello, you do not get it.

ALL generated TS FILES are wrong and broken!

Could you please tell us what exactly is broken in the TS files? Did you try to use app to change a language code?

Yes, in the end I use your proposed solution to fix the language codes.

Result can be seen here. New Crowdin updates by martinrotter · Pull Request #1188 · martinrotter/rssguard · GitHub

Problem is that QT is internally using extended language codes with underscore “_” and not with dash “-”.

So if TS file with language=“en-US” gets compiled into QM file and then loaded by QTranslator in QT/c++ source code, QT library does not recognize what actual language the translation is.

Translation gets loaded and user sees translated strings but QT does not load proper pluralisation rules because of unrecognized language. This causes all plural strings to be incorrectly displayed in all QT-based applications for all languages which have extended codes (“en-US”, “en-GB”, “pt-BR”, etc.).

In most file formats, Crowdin uses standard language codes by default. You’re welcome to verify these codes on our reference page here: Crowdin Language Codes

For specific or custom requirements, we offer various additional apps that can modify language codes as needed.