How is *.ts Crowdin files makes and FEM workbench translation anomaly.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

How is *.ts Crowdin files makes and FEM workbench translation anomaly.

Post by Evgeniy »

It generated by scripts or maked manually? Why strings position aslo not syncronized with sourcecode?
Last edited by Evgeniy on Sat Sep 25, 2021 1:22 pm, edited 1 time in total.
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: How is *.ts Crowdin files makes?

Post by chennes »

The TS files are generated by updatets.py (heads-up that that file is currently being worked on, you can see the PR with the revision in PR 5037).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: How is *.ts Crowdin files makes?

Post by sgrogan »

chennes wrote: Fri Sep 24, 2021 7:03 pm The TS files are generated by updatets.py (heads-up that that file is currently being worked on, you can see the PR with the revision in PR 5037).
After that, they need to be committed to master, correct?
"fight the good fight"
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: How is *.ts Crowdin files makes?

Post by chennes »

There's really a whole process that you can see via the updatecrowdin.py script. The base TS files are created and uploaded to CrowdIn, translators do their thing, then the completed translations are pulled down and committed. I don't know if we commit the first set of TS files, since we use the Python script to push directly to CrowdIn from the local working copy. Yorik or Kunda1 will know.
yorik wrote: *
Kunda1 wrote: *
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: How is *.ts Crowdin files makes?

Post by Evgeniy »

If any text in the *.cpp file is changed? Translate will be lost?
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: How is *.ts Crowdin files makes?

Post by chennes »

Only that single changed string is lost, but yes, my understanding is that if we make any change to a translated string in the source code, translators get prompted to re-translate that string.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: How is *.ts Crowdin files makes?

Post by Evgeniy »

Is it possible to somehow bind strings to some identifiers so that the translation is saved when the source string is changed?


I still don't understand how the strings go from source code into Crowdin

Is there some kind of scanner program of *.cpp *.py *.ui?

If this scaner application exist why are not all the lines available for translation in Crowdin? For example, this piece is not presnted inn Crowdin:

https://github.com/FreeCAD/FreeCAD/blob ... ch.cpp#L50

Code: Select all

    qApp->translate("Workbench", "FEM");
    qApp->translate("Workbench", "&FEM");
    //
    qApp->translate("Workbench", "Model");
    qApp->translate("Workbench", "M&odel");
    qApp->translate("Workbench", "Materials");
    qApp->translate("Workbench", "&Materials");
    qApp->translate("Workbench", "Element Geometry");
    qApp->translate("Workbench", "&Element Geometry");
    qApp->translate("Workbench", "Electrostatic Constraints");
    qApp->translate("Workbench", "&Electrostatic Constraints");
    qApp->translate("Workbench", "Fluid Constraints");
    qApp->translate("Workbench", "&Fluid Constraints");
    qApp->translate("Workbench", "Geometrical Constraints");
    qApp->translate("Workbench", "&Geometrical Constraints");
    qApp->translate("Workbench", "Mechanical Constraints");
    qApp->translate("Workbench", "&Mechanical Constraints");
    qApp->translate("Workbench", "Thermal Constraints");
    ...
    
Where can I view the *.pro files of the FreeCAD project?
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: How is *.ts Crowdin files makes?

Post by chennes »

Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: How is *.ts Crowdin files makes?

Post by Evgeniy »

chennes wrote: Sat Sep 25, 2021 12:33 pm Have a look at https://doc.qt.io/qt-5/qtlinguist-index.html
Better links:
https://doc.qt.io/qt-5/qtlinguist-hellotr-example.html
https://doc.qt.io/qt-5/i18n-source-translation.html

I'm look any doc's about QT translation, but im real not understand:

We have Command.cpp https://github.com/FreeCAD/FreeCAD/blob ... ommand.cpp

And we have updates.py https://github.com/FreeCAD/FreeCAD/blob ... pdatets.py

As far as I understood, lupdate utility used in updates.py should be automatilly extract all translatable strings from Command.cpp and save it in Fem.ts file. And then *.ts must somehow going into Crowdin.

But part of strings from Command.cpp is not presented Crowdin.

My question is: Why?

For this reason, it is not possible to translate part of the commands of the Fem workbench.

For exmple this part is not presented in Fem.ts:
CmdFemConstraintContact::CmdFemConstraintContact()
: Command("FEM_ConstraintContact")
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Constraint contact");
sToolTipText = QT_TR_NOOP("Creates a FEM constraint for contact between faces");
Download fresh Fem.ts file of any language open it in notepad and find "Constraint contact" and you not find anything.
Open Crowdin site and find "Constraint contact" in Fem.ts page and you not find anything.

Accordingly, this command and others too, cannot be translated into other languages.
Why did lupdate skip this?
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: How is *.ts Crowdin files makes and FEM workbench translation anomaly.

Post by chennes »

That's the bug that's addressed by PR 5037 -- because FEM has both Python and C++, only the Python strings were being updated.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply