Important: Please read the Qt Code of Conduct -

Question about translating

  • First I'd like to say I don't really know a lot about the translating, all I know is to put things in tr() macro for translating. But today our dev team had a total mind blown moment at a stand up meeting. Apparently someone believes there is no way to change the original text in the tr() macro and we have to translate the original "stupid" English to proper English. Is there any way to add a custom key to be able to keep the text in the program consistent with changes in the linguist app?

    sorry I don't know more about the translation process, figured I'd ask if the senior engineers here can't find a way to do this I probably shouldn't waste too much time with it. Being new, I'm the only one bold enough to ask dumb questions...

  • You can add a special language file called 'intelligentEnglish' and set in your application to default language file. All string using by tr() macro can 'translate' with this new file.

    Check about the using of qt linguist, lupdate.

  • but there is no way to modify the text in the macro without creating issues with the translation tables

  • What do you mean?

  • in other words someone made a stupid mistake in the original CPP file, or a color was changed so a string needs to be edited. This changes the the translation table, so the only way to edit the original string once several language translations are made, is to add the fixes to an english translation, or a fixedEnglish translation...

    at least this is what one of our developers believe,

  • I didn't get it, too.

    I guess you want to know what happens if the string in the source file has changed, isn't it? If it's so, so there is no problem. Lupdate will not remove the old string, it will update the string. On the other hand, you can leave the source string and correct the string just in the translation file. So if your default/source language english, just add a translation file for english. I do this in these way for german for special characters i.e. "ü,ö,ä a.s.o". So I i can have my source pure ASCII.

  • so if lets say I have a string

    tr("press the blue button"),

    and i translate it in a couple of languages like Chinese and Russian... several months later marketing wants it to be a red button.

    The change is made...

    tr("press the red button") will this create a new translation entry??

    If it does I guess this isn't that big of an issue to just translate the new string, these sentences do have different meaning. But what if no one caught something like a spelling mistake??

    tr("press the bleu button"), even though both the translations are correct spelling, I don't want it to add a new string, I want it to update the old one in linguist, and the best way we figured out to avoid creating a new language, and fixing mistakes.

    I'm not the guy doing the translations, I'm the one fixing the mistakes... inconsistent capitalization, miss spellings, consistencies with dialog ie: making all references like "device", "instrument", "analyzer" to be consistent and all read "analyzer"

    I was wondering if there was a way to name the strings basically, so changes don't create new instances,

  • bq. tr(“press the red button”) will this create a new translation entry??

    No, the string will be updated!!! So it's not a problem. Also you don't have to update the translations but you can, if it's necessary ;-).

  • That's interesting, what happens if it isn't being updated correctly? is there a way to see why or force it? Because I think thats where they got the idea it doesn't. Right now when we change the strings, it creates new string entries to be translated or something.

    I'll probably mess around with how it works in a bit for us, maybe make a installable pirate language.

  • it might help, but we have custom built libraries for WINCE/win32 of 4.7.2, use visual studio 2005, and use the programs that we build, we basically don't install anything, just unpack opensource 4.7.2 and build and set up the file association for files like .ui...

  • A short test, you can see the output, something like that (german output):

    @Bringe 'language_de.ts' auf aktuellen Stand...
    Found 4 source text(s) (4 new and 0 already existing)

    Bringe 'language_en.ts' auf aktuellen Stand...
    Found 4 source text(s) (4 new and 0 already existing)

    'lupdate' beendet
    after changing the string you get something like that:
    @Bringe 'language_de.ts' auf aktuellen Stand...
    Found 4 source text(s) (1 new and 3 already existing)
    Similar-text heuristic provided 1 translation(s)
    Bringe 'language_en.ts' auf aktuellen Stand...
    Found 4 source text(s) (1 new and 3 already existing)
    Similar-text heuristic provided 1 translation(s)

    'lupdate' beendet

    Ok, now I see you problem. Here the "1 new and 3 already existing" is misleading. The new one is the changed one and when you reopen the *.ts file in linguist you will see the new string with the "old" translations. That means the source is updated but the translated strings are the same and they are not removed. So don't worry ;-)

    I hope it helps a bit.

  • If its not working for us like this, in other words, each time we edit the original source file it creates a new entry that isn't linked to our translations... what can we do to fix this?

  • If you want your translations to keep working, you should not change the source files. Instead, make the fix in a "translation" file for the original language. Using such files is useful also for plurals.

  • Moderators

    You could also use "ID-based translations":, too. Although they're not as clean of a solution, IMHO, they are an option.

Log in to reply