Lokalisierung
Lokalisierung bezeichnet allgemein den Vorgang, eine Software mit mehrsprachigem Benutzerinterface zur Verfügung zu stellen. In FreeCAD kann die Sprache des Benutzerinterfaces über Edit→Preferences→Application festgelegt werden. FreeCAD benutzt Qt für die Mehrsprachenunterstützung. Auf Unix/Linuxsystemen verwendet FreeCAD die aktuellen locale Einstellungen als Standard.
Bei der Übersetzung von FreeCAD mithelfen
Falls Sie kein Programmierer sind, ist eines der sehr wichtigen Dinge, die Sie für FreeCAD tun können, die Übersetzung des Programm in Ihre Sprache. Durch die Benutzung des gemeinsamen Online Übersetzungssystems Crowdin ist dies nun so einfach wie nie zuvor.
Wie man übersetzen kann
- Gehen Sie zum FreeCAD Übersetzungsprojekt auf Crowdin;
- Melden Sie sie an, indem Sie ein neues Profile erstellen oder einen Account von dritter Seite, wie etwa Ihre GMail Adresse, verwenden;
- Klicken Sie auf die Sprache, an der Sie arbeiten möchten;
- Starten Sie die Übersetzungsarbeit indem Sie auf den Übersetzungsknopf in der Nähe einer Datei klicken. FreeCAD.ts enthält beispielsweise die Textfragmente für das Hauptbenutzerinterface von FreeCAD.
- Sie können existierende Übersetzungen bewerten oder Ihre Eigenen erstellen.
Anmerkung: Wenn Sie aktiv an der Übersetzung von FreeCAD teilnehmen und über die anstehende Veröffentlichung des Programms vorab informiert werden wollen, so dass noch Zeit zum Überarbeiten der Übersetzungen bleibt, abonnieren Sie den folgenden Thread: http://www.freecadweb.org/tracker/view.php?id=137
Übersetzung mit Qt-Linguist (alte Methode)
The following information doesn't need to be used anymore and will likely become obsolete.
It is being kept here so that programmers may familiarize themselves with how it works. |
Available translation files
|
Vorbereitung Ihrer eigenen Module/Anwendungen zur Übersetzung
Vorbedingungen
Um Ihre Anwendung zu lokalisieren, benötigen Sie Hilfswerkzeuge, die mit Qt mit geliefert werden. Sie können Sie von der Trolltech-Website herunterladen aber sie sind ebenfalls bei LibPack enthalten:
- qmake
- erzeugt die Projektdateien
- lupdate
- extrahiert oder aktualisiert die Originaltexte in Ihrem Projekt durch Scannen der Quelltexte
- Qt-Linguist
- Qt-Liguist ist sehr einfach zu benutzen und hilft Ihnen bei der Übersetzung mit netten Funktionen wie etwa einem Phrasenbuch für häufig vorkommende Sätze.
Project Setup
To start the localisation of your project go to the GUI-Part of you module and type on the command line:
qmake -project
This scans your project directory for files containing text strings and creates a project file like the following example:
###################################################################### # Automatically generated by qmake (1.06c) Do 2. Nov 14:44:21 2006 ###################################################################### TEMPLATE = app DEPENDPATH += .\Icons INCLUDEPATH += . # Input HEADERS += ViewProvider.h Workbench.h SOURCES += AppMyModGui.cpp \ Command.cpp \ ViewProvider.cpp \ Workbench.cpp TRANSLATIONS += MyMod_de.ts
You can manually add files here. The section TRANSLATIONS contains a list of files with the translation for each language. In the above example MyMod_de.ts is the german translation.
Now you need to run lupdate to extract all string literals in your GUI. Running lupdate after changes in the source code is allways safe since it never deletes strings from your translations files. It only adds new strings.
Now you need to add the .ts-files to your VisualStudio project. Specifiy the following custom build method for them:
python ..\..\..\Tools\qembed.py "$(InputDir)\$(InputName).ts"
"$(InputDir)\$(InputName).h" "$(InputName)"
Note: Enter this in one command line, the line break is only for layout purpose.
By compiling the .ts-file of the above example, a header file MyMod_de.h is created. The best place to include this is in App<Modul>Gui.cpp. In our example this would be AppMyModGui.cpp. There you add the line
new Gui::LanguageProducer("Deutsch", <Modul>_de_h_data, <Modul>_de_h_len);
to publish your translation in the application.
Setting up python files for translation
To ease localization for the py files you can use the tool "pylupdate4" which accepts one or more py files. With the -ts option you can prepare/update one or more .ts files. For instance to prepare a .ts file for French simply enter into the command line:
pylupdate4 *.py -ts YourModule_fr.ts
the pylupdate tool will scan your .py files for translate() or tr() functions and create a YourModule_fr.ts file. That file can the be translated with QLinguist and a YourModule_fr.qm file produced from QLinguist or with the command
lrelease YourModule_fr.ts
Beware that the pylupdate4 tool is not very good at recognizing translate() functions, they need to be formatted very specifically ( see the Draft module files for examples). Inside your file, you can then setup a translator like this (after loading your QApplication but BEFORE creating any qt widget):
translator = QtCore.QTranslator() translator.load("YourModule_"+languages[ln]) QtGui.QApplication.installTranslator(translator)
Optionally, you can also create the file XML Draft.qrc with this content:
<RCC> <qresource prefix="/translations" > <file>Draft_fr.qm</file> </qresource> </RCC>
and running pyrcc4 Draft.qrc -o qrc_Draft.py creates a big Python containing all resources. BTW this approach also works to put icon files in one resource file
Translating the wiki
This wiki is hosting a lot of contents, the majority of which build up the manual. You can browse the documentation starting from the Main Page, or have a look at the User's manual Online Help Toc.
Translation plugin
When the Wiki moved away from SourceForge, Yorik installed a Translation plugin which allows to ease translations between pages. For example, the page title can now be translated. Other advantages of the Translation plugin are that it keeps track of translations, notifies if the original page has been updated, and maintains translations in sync with the original English page.
The tool is documented in Extension:Translate, and is part of a Language Extension Bundle.
To quickly get started on preparing a page for translation and activating the plugin, please read the Page translation example.
To see an example of how the Translation tool works once the translation plugin is activated on a page, you can visit the Main Page. You will see a new language menu bar at the bottom. It is automatically generated. Click for instance on the German link, it will get you to Main Page/de. Right under the title, you can read "This page is a translated version of a page Main Page and the translation is xx% complete." (xx being the actual percentage of translation). Click on the "translated version" link to start translation, or to update or correct the existing translation.
You will notice that you cannot directly edit a page anymore once it's been marked as a translation. You have to go through the translation utility.
When adding new content, the English page should be created first, then translated into another language. If someone wants to change/add content in a page, he should do the English one first.
It is recommended to have basic knowledge of wiki style formatting and general guidelines of the FreeCAD wiki, because you will have to deal with some tags while translating. You can find this information on WikiPages.
The sidebar (navigation menu on the left) is also translatable. Please follow dedicated instructions on Localisation Sidebar page.
REMARK: The first time you switch a page to the new translation system, it looses all its old 'manual' translations. To recover the translation, you need to open an earlier version from the history, and copy/paste manually the paragraphs to the new translation system.
Remark: to be able to translate in the wiki, you must of course gain wiki edit permission.
If you are unsure how to proceed, don't hesitate to ask for help in the forum.
Old translation instructions
These instructions are for historical background only, while the pages are being passed to the new translation plugin. |
So the first step is to check if the manual translation has already been started for your language (look in the left sidebar, under "manual").
Page Naming Convention
#REDIRECT [[About FreeCAD/fr]]
{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}} The page "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr. |