The internationalization of FreeCAD makes heavy use of the internationalization support of Qt. More...
The internationalization of FreeCAD makes heavy use of the internationalization support of Qt.
For more details refer to your Qt documentation.
To integrate a new language into FreeCAD or one of its application modules you have to perform the following steps:
First you have to generate a .ts file for the language to be translated. You can do this by running the lupdate tool in the bin path of your Qt installation. As argument you can specify either all related source files and the .ts output file or a Qt project file (.pro) which contains all relevant source files.
To translate the english string literals into the language you want to support you can open your .ts file with QtLinguist and translate all literals by hand. Another way for translation is to use the tool tsauto from Sebastien Fricker.This tool uses the engine from Google web page (www.google.com). tsauto supports the languages
The .qm file should now be integrated into the GUI library (either of FreeCAD itself or its application module). The .qm file will be embedded into the resulting binary file. So, at runtime you don't need any .qm files any more. Indeed you will have a bigger binary file but you haven't any troubles concerning missing .qm files.
To integrate the .qm file into the executable you have to create a resource file (.qrc), first. This is an XML file where you can append the .qm file. For the .qrc file you have to define the following curstom build step inside the Visual Studio project file:
Command Line: rcc.exe -name -o "$(InputDir)qrc_$(InputName).cpp" Outputs: qrc_.cpp
For the gcc build system you just have to add the line <resourcefile>.qrc to the BUILT_SOURCES sources section of the Makefile.am, run automake and configure (or ./confog.status) afterwards.
Finally, you have to add a the line
Q_INIT_RESOURCE(resource);
where resource is the name of the .qrc file. That's all!