1

I have a single translator.cpp source file containing a lot of strings. These have been been translated to various languages using Qt Linguist. Now I want to split the single file into multiple files:

Old structure:

class Translator
{
    QString str1 = tr("");
    QString str2 = tr("");
    QString str3 = tr("");
};

New structure:

class Translator1
{
    QString str1 = tr("");
};

class Translator2
{
    QString str2 = tr("");
};

class Translator3
{
    QString str3 = tr("");
};

After splitting the translations are lost. What is the fastest way to split the class while keeping the existing translations?

Regards,

Hyndrix
  • 4,282
  • 7
  • 41
  • 82
  • Do your `Translator` classes really look like that (I'm guessing not :) )? What is the `tr()` context/object? And what do you mean by "lost?" Depending on what exactly is changing, `lupdate` should detect that only the source code has moved but the string hasn't changed. I can't remember now if it will also detect that when switching contexts, but I think so. However the new/updated translation may be marked as "unfinished." So someone typically needs to update the .ts file(s) to verify them. But this could also be done in bulk with search/replace (they're just XML). – Maxim Paperno Sep 08 '19 at 08:44
  • The old translations get marked ```` and the moved translations ``type="unfinished"``. – Hyndrix Sep 08 '19 at 15:31
  • I will just go through all translations and mark them finished. Unfortunately just replacing will not work because there are some real unfinished ones. – Hyndrix Sep 08 '19 at 15:33

0 Answers0