Localisation

Overview
Localisation is in general the process of providing a Software with a multiple language user interface. In FreeCAD you can set the language of the user interface under. FreeCAD uses Qt to enable multiple language support. On Unix/Linux systems, FreeCAD uses the current locale settings of your system by default.

Helping to translate FreeCAD
One of the very important things users can contribute to FreeCAD (if for example they don't have programming skills) is to help translate its different aspects (source code, wiki, website, documentation etc...) in to another language. Here are the ways to do that.

Translate the FreeCAD source code
FreeCAD utilizes a third party collaborative on-line translation system called Crowdin.



It is proprietary software but free to FOSS projects. Below are instructions on how to use it:


 * Go to the FreeCAD translation project page on Crowdin
 * Login by creating a new profile, or using a third-party account (GitHub, GitLab, GMail etc...)
 * Click on the language you wish to translate
 * Start translating by clicking on the button next to one of the files. For example,  contains the text strings for the FreeCAD main GUI.
 * You can vote for existing translations, or you can create your own.

Details on how to use crowdin can be found on the Crowdin Administration page.

Translating external workbenches
Visit Translating an external workbench.

FreeCAD Preferences for Translators
Starting with FreeCAD 0.20, the following variables can be manually added to the BaseApp/Preferences/General section of the user.cfg file to assist with the development of new translations:

AdditionalLanguageDomainEntries - to add entirely new languages to FreeCAD that are not currently supported by the source code, you can use this user preference to add to the list of available languages. The format of the languages is "Language Name"="code"; for example: "Esperanto"="eo";"French"="fr";

AdditionalTranslationsDirectory - add an additional directory for FreeCAD to search for *.qm files. This location will take precedence over $userAppDataDir/translations and $resourceDir/translations. For example, C:/Users/FreeCADUser/TestTranslations

Translate the FreeCAD wiki
This wiki hosts 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.

To translate the wiki, you must have wiki edit permissions; see How can I get edit permission on the wiki?.

You should also have enough knowledge of wiki markup and follow the general styling guidelines described on WikiPages.

Mediawiki Translation Extension
When the wiki moved away from SourceForge, Yorik installed MediaWiki's Translation extension which facilitates translating pages. Advantages of the translation extension are that the page title can now be translated, it keeps track of translations, it notifies if the original page has been updated, and it maintains translations in sync with the original English page.

The tool is documented in Help:Extension:Translate, and is part of MediaWiki Language Extension Bundle.

To quickly get started on preparing a page for translation, please read the Page translation example. Essentially, a pair of &lt;translate&gt; ... &lt;/translate&gt;

tags need to surround the entire page to activate the translation system, and the page needs to be marked for translation.

To see an example of how the translation tool works, visit the Main Page. You will see an automatically generated language bar at the top. Click on Deutsch (German), it will get you to Main Page/de. Right under the title, "Hauptseite" (in English "Main Page"), you can read , XX being the current percentage of translation. Click on "Translate" at the top of the page to start the translation utility to update, correct and review the existing translation.

If you go to Main Page, you will notice that you cannot edit the page directly anymore by clicking the [Edit] tags, and the top link "Edit" has been substituted by the "Translate" link that opens the translation utility.

When adding new content, the English page should be created first, then translated into another language. If someone wants to change or add content in a page, the English page should be modified first.

If you are unsure on how to proceed with the translations, don't hesitate to ask for help in the Development → Wiki subforum or in the specific language subforum in the FreeCAD forum.

Important notes
Every wiki user that has "Editor" permissions is able to launch the translate utility to write, save and review translations.

However, only users with "Administrator" permissions are able to mark pages for translation. A page that is not marked for translation won't make use of the translation extension and won't be correctly synchronized to the English information.

The left sidebar is also translatable, but only Administrators can modify this element of the site. Please follow the dedicated instructions on Localisation Sidebar.

The first time you switch a page to the new translation system, it loses all its old "manual" translations. To recover a translation, you should save an offline copy of the old text before the switch. Then you can use this old translated text to fill in the translation units in the new system. You can also open an earlier version from the history, and get the old text in this way. This has to be done for every language that had a translated page.

Translate the FreeCAD documentation
As per general consensus, the reference page in the wiki is the English page, which should be created first. If you want to change or add content to a page, you should do it to the English page first, and only once the update is completed, port the modification to the translated page.

Translate the FreeCAD website
Translation of the FreeCAD website is now done through Crowdin. The file is named.

Development - How to Add Localisation
This section is for developers who want to add localisation to their code.

Preparing your FreeCAD/master modules for translation
These are the parts to the FreeCAD translation process:
 * extract text strings from source code into *.ts files
 * load *.ts files into FreeCAD Crowdin.
 * translation of strings within Crowdin
 * extract modified/new *.ts files from Crowdin
 * convert *.ts files into *.qm files and update each module's *.qrc file
 * update FreeCAD master

All of the above steps are performed by the "translation scripts" which are run by an administrator periodically.

Preparing your module for translation is quite easy. First, you need to ensure that you have a "translations" directory in. Then open a terminal window (or Windows/OSX equivalent) in your "translations" directory and enter the following command:

This creates an empty translation file. Once this is done, you need to ensure that the translation scripts are updated as in this pull request.

Everything after this is automatic as far as a developer is concerned. The administrator will extract the text strings, the translators will translate them, then the administrator will extract the translations and update FreeCAD/master.

Preparing your 3rd party module or macro for translation
3rd party modules or macros are translated in much the same fashion, except that you must do some of the work yourself. This forum discussion describes the details.

Update: see Translating an external workbench

Older module translation techniques
Localization Older Methods describes the use of translation tools such as Qt Linguist, lupdate, lrelease, pylupdate4, etc in detail. Most of this is no longer required for FreeCAD/master modules, but may be helpful preparing and updating 3rd party modules.

Automating Crowdin Translation Updates
Currently FreeCAD maintainers use the Crowdin API via Crowdin Scripts to pull and push translations in to Crowdin and back in to the Github repo. The Crowdin API gives FreeCAD maintainers the ability to automate aspects of the project's translation workflow, for more info refer to the Crowdin API documentation.

Related Pages

 * Crowdin Administration
 * Crowdin Scripts

Scripting
FreeCAD Scripting Basics.

To get list of languages supported in FreeCAD interface use the method of.

After execution, the will contain a dictionary with the following values:

To get language that is currently used in FreeCAD, use method of.

In resulit, loc is equals:

To convert this value into locale code, use a simple technique:

Resulit is:

To set FreeCAD interface language, use method of.

You can specify the language explicitly:

Or you can set langage directly by locale code: