Localisation/hr: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>

<div class="mw-translate-fuzzy">
{{Docnav/hr
{{Docnav/hr
|[[Branding/hr|Markiranje]]
|[[Branding/hr|Markiranje]]
|[[Extra python modules/hr|Dodatni python moduli]]
|[[Extra python modules/hr|Dodatni python moduli]]
}}
}}
</div>

{{TOCright}}
{{TOCright}}

==Overview==
==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 {{MenuCommand|Edit → Preferences → General}}. FreeCAD uses [[wikipedia:Qt (toolkit)|Qt]] to enable multiple language support. On Unix/Linux systems, FreeCAD uses the current locale settings of your system by default.
'''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 {{MenuCommand|Edit → Preferences → General}}. FreeCAD uses [[wikipedia:Qt (toolkit)|Qt]] to enable multiple language support. On Unix/Linux systems, FreeCAD uses the current locale settings of your system by default.


<span id="Helping_to_translate_FreeCAD"></span>
== Pomozite prevesti FreeCAD ==
== Pomozite prevesti 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
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.


<span id="Translate_the_FreeCAD_source_code"></span>
<div class="mw-translate-fuzzy">
=== Kako prevoditi izvorni kod ===
=== Kako prevoditi izvorni kod ===
FreeCAD koristi internetski sustav za internetski prijevod sa trećom stranom pod nazivom [https://crowdin.net Crowdin].
FreeCAD koristi internetski sustav za internetski prijevod sa trećom stranom pod nazivom [https://crowdin.net Crowdin].
</div>

FreeCAD utilizes a third party collaborative on-line translation system called [https://crowdin.net Crowdin].


[[File:Logo-crowdin.png|320px]]
[[File:Logo-crowdin.png|320px]]


It is proprietary software but free to FOSS projects. Below are instructions on how to use it:
It is proprietary software but free to [https://en.wikipedia.org/wiki/Free_and_open-source_software FOSS] projects. Below are instructions on how to use it:


* Go to the [http://crowdin.net/project/freecad FreeCAD translation project page on Crowdin]
* Go to the [http://crowdin.net/project/freecad FreeCAD translation project page on Crowdin]
Line 27: Line 39:
{{Message|If you are actively taking part in translating FreeCAD and want to be informed before next release is ready to be launched, so there is time to review your translation, please subscribe to one of the Crowdin FreeCAD translation teams.}}
{{Message|If you are actively taking part in translating FreeCAD and want to be informed before next release is ready to be launched, so there is time to review your translation, please subscribe to one of the Crowdin FreeCAD translation teams.}}


{{Emphasis|Note:}} Details on how to use crowdin can be found on the [[Crowdin_Administration|Crowdin Administration]] page.

<span id="Translating_external_workbenches"></span>
== Prevođenje vanjskih Radnih stolova ==
== Prevođenje vanjskih Radnih stolova ==


Visit [[Translating_an_external_workbench|Translating an external workbench]].
Visit [[Translating_an_external_workbench|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:

<pre>
<FCText Name="AdditionalLanguageDomainEntries">"Esperanto"="eo";"French"="fr";</FCText>
</pre>

'''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:

<pre>
<FCText Name="AdditionalTranslationsDirectory">C:/Users/FreeCADUser/TestTranslations</FCText>
</pre>

<span id="Translate_the_FreeCAD_wiki"></span>
== Prevedite FreeCAD wiki-stranicu ==
== Prevedite FreeCAD wiki-stranicu ==


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|Main Page]], or have a look at the user's manual [[Online Help Toc|Online Help Toc]].
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|Main Page]], or have a look at the user's manual [[Online Help Toc|Online Help Toc]].


To translate the wiki, you must have wiki edit permissions; see [[FAQ#How can I get edit permission on the wiki?|How can I get edit permission on the wiki?]].
To translate the wiki, you must have wiki edit permissions; see [[Frequently_asked_questions#How can I get edit permission on the wiki?|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|WikiPages]].
You should also have enough knowledge of wiki markup and follow the general styling guidelines described on [[WikiPages|WikiPages]].


<span id="Mediawiki_Translation_Extension"></span>
=== Mediawiki prijevodni dodatak ===
=== Mediawiki prijevodni dodatak ===


Line 47: Line 80:
To quickly get started on preparing a page for translation, please read the [http://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_example Page translation example].
To quickly get started on preparing a page for translation, please read the [http://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_example Page translation example].
Essentially, a pair of
Essentially, a pair of

<pre><nowiki>
<pre>
<translate> ... </translate></nowiki></pre>
&lt;translate&gt; ... &lt;/translate&gt;
</pre><!--using lt and gt so that tags are not recognized-->

tags need to surround the entire page to activate the translation system, and the page needs to be marked for translation.
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|Main Page]]. You will see an automatically generated language bar at the top. Click on [[Main Page/de|Hauptseite]] (German), it will get you to [[Main Page/de]]. Right under the title, you can read <small>{{Emphasis|This page is a translated version of the page Main Page and the translation is XX% complete}}</small>, 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.
To see an example of how the translation tool works, visit the [[Main Page|Main Page]]. You will see an automatically generated language bar at the top. Click on [[Main Page/de|Deutsch]] (German), it will get you to [[Main Page/de]]. Right under the title, "Hauptseite" (in English "Main Page"), you can read <small>{{Emphasis|This page is a translated version of the page Main Page and the translation is XX% complete}}</small>, 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.
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.
Line 59: Line 95:
If you are unsure on how to proceed with the translations, don't hesitate to ask for help in the [https://forum.freecadweb.org/viewforum.php?f=21 Development → Wiki subforum] or in the [https://forum.freecadweb.org/viewforum.php?f=11 specific language subforum] in the [http://forum.freecadweb.org FreeCAD forum].
If you are unsure on how to proceed with the translations, don't hesitate to ask for help in the [https://forum.freecadweb.org/viewforum.php?f=21 Development → Wiki subforum] or in the [https://forum.freecadweb.org/viewforum.php?f=11 specific language subforum] in the [http://forum.freecadweb.org FreeCAD forum].


<span id="Important_notes"></span>
===Važne zabilješke===
===Važne zabilješke===


Every wiki user that has "Editor" permissions is able to launch the translate utility and write, save, and review translations.
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.
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.
Line 69: Line 106:
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.
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.


<span id="Translate_the_FreeCAD_documentation"></span>
== Prevedite FreeCAD dokumentacija ==
== Prevedite FreeCAD dokumentacija ==


Line 81: Line 119:
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").<br />
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").<br />
If not, head to the [http://forum.freecadweb.org/ forum] and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.<br />
If not, head to the [http://forum.freecadweb.org/ forum] and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.<br />
You must then [[FAQ#How_can_I_get_edit_permission_on_the_wiki.3F|gain wiki edit permission]].<br />
You must then [[Frequently_asked_questions#How_can_I_get_edit_permission_on_the_wiki.3F|gain wiki edit permission]].<br />
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: '''go into a red page, and copy/paste the contents of the corresponding English page, and start translating'''.<br />
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: '''go into a red page, and copy/paste the contents of the corresponding English page, and start translating'''.<br />
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use '''a slash and your language code''' in almost all the links. Look at other already translated pages to see how they did it.<br />
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use '''a slash and your language code''' in almost all the links. Look at other already translated pages to see how they did it.<br />
Line 101: Line 139:
|}
|}


<span id="Translate_the_FreeCAD_website"></span>
<div class="mw-translate-fuzzy">
== Prevedite FreeCAD web-stranicu ==
== Prevedite FreeCAD web-stranicu ==
Prijevod web stranice FreeCAD sada se vrši putem [https://crowdin.com/translate/freecad/561/en Crowdin]. Datoteka je nazvana {{FileName|homepage.po}}.
Prijevod web stranice FreeCAD sada se vrši putem [https://crowdin.com/translate/freecad/561/en Crowdin]. Datoteka je nazvana {{FileName|homepage.po}}.
</div>

Translation of the FreeCAD website is now done through [https://crowdin.com/translate/freecad/561/en-en Crowdin]. The file is named {{FileName|homepage.po}}.


== Development - How to Add Localisation ==
== Development - How to Add Localisation ==

This section is for developers who want to add localisation to their code.
This section is for developers who want to add localisation to their code.


=== Preparing your FreeCAD/master modules for translation ===
=== Preparing your FreeCAD/master modules for translation ===

These are the parts to the FreeCAD translation process:
These are the parts to the FreeCAD translation process:
* extract text strings from source code into *.ts files
* extract text strings from source code into *.ts files
Line 118: Line 163:
All of the above steps are performed by the "translation scripts" which are run by an administrator periodically.
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 {{FileName|myModule/Gui/Resources}}. Then open a terminal window (or Windows/OSX equivalent) in your "translations" directory and enter the following command:
Preparing your module for translation is quite easy. First, you need to ensure that you have a "translations" directory in {{FileName|myModule/Gui/Resources}}. Then open a terminal window (or Windows/OSX equivalent) in your "translations" directory and enter the following command:
{{Code|code=lupdate -ts myModule.ts}}
{{Code|code=lupdate -ts myModule.ts}}


This creates an empty translation file. Once this is done, you need to ensure that the translation scripts are updated as in this [https://github.com/FreeCAD/FreeCAD/pull/810 pull request].
This creates an empty translation file. Once this is done, you need to ensure that the translation scripts are updated as in this [https://github.com/FreeCAD/FreeCAD/pull/810 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.
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 ===
=== 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.
3rd party modules or macros are translated in much the same fashion, except that you must do some of the work yourself.
This [https://www.forum.freecadweb.org/viewtopic.php?f=3&t=25180 forum discussion] describes the details .
This [https://www.forum.freecadweb.org/viewtopic.php?f=3&t=25180 forum discussion] describes the details.

Update: see [[Translating_an_external_workbench|Translating an external workbench]]


=== Older module translation techniques ===
=== Older module translation techniques ===

[[Localization Older Methods|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.
[[Localization_Older_Methods|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 ==
== Automating Crowdin Translation Updates ==

Currently FreeCAD maintainers use the Crowdin API via [[Crowdin Scripts|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 [https://support.crowdin.com/api/api-integration-setup/ Crowdin API documentation].
Currently FreeCAD maintainers use the Crowdin API via [[Crowdin_Scripts|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 [https://support.crowdin.com/api/api-integration-setup/ Crowdin API documentation].


== Related Pages ==
== Related Pages ==
* [[Crowdin Administration]]
* [[Crowdin Scripts]]


* [[Crowdin_Administration|Crowdin Administration]]
* [[Crowdin_Scripts|Crowdin Scripts]]

==Scripting==

{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].

To get a dictionary with the languages the FreeCAD interface supports, use the {{incode|supportedLocales}} method of the {{incode|FreeCADGui}} module.

{{Code|code=
locales = FreeCADGui.supportedLocales()
}}

After execution {{incode|locales}} will contain:

{{Code|code=
{'English': 'en', 'Afrikaans': 'af', 'Arabic': 'ar', 'Basque': 'eu', 'Catalan': 'ca', 'Chinese Simplified': 'zh-CN', 'Chinese Traditional': 'zh-TW', 'Croatian': 'hr', 'Czech': 'cs', 'Dutch': 'nl', 'Filipino': 'fil', 'Finnish': 'fi', 'French': 'fr', 'Galician': 'gl', 'German': 'de', 'Hungarian': 'hu', 'Indonesian': 'id', 'Italian': 'it', 'Japanese': 'ja', 'Kabyle': 'kab', 'Korean': 'ko', 'Lithuanian': 'lt', 'Norwegian': 'no', 'Polish': 'pl', 'Portuguese': 'pt-PT', 'Portuguese, Brazilian': 'pt-BR', 'Romanian': 'ro', 'Russian': 'ru', 'Slovak': 'sk', 'Slovenian': 'sl', 'Spanish': 'es-ES', 'Swedish': 'sv-SE', 'Turkish': 'tr', 'Ukrainian': 'uk', 'Valencian': 'val-ES', 'Vietnamese': 'vi'}
}}

To get the current interface language use the {{incode|getLocale}} method of the same module:

{{Code|code=
locale = FreeCADGui.getLocale()
}}

If the current language is English {{incode|locale}} will contain:

{{Code|code=
'English'
}}

To get the corresponding [https://support.crowdin.com/api/language-codes/ language code] you can use use:

{{Code|code=
locale = FreeCADGui.supportedLocales()[Gui.getLocale()]
}}

If the current language is English the result will be:

{{Code|code=
'en'
}}

To set the current interface language use the {{incode|setLocale}} method of the same module. You can specify the language or the language code:

{{Code|code=
FreeCADGui.setLocale('Russian')
FreeCADGui.setLocale('ru')
}}


<div class="mw-translate-fuzzy">
{{Docnav/hr
{{Docnav/hr
|[[Branding/hr|Branding]]
|[[Branding/hr|Branding]]
|[[Extra python modules/hr|Dodatni Python moduli]]
|[[Extra python modules/hr|Dodatni Python moduli]]
}}
}}
</div>


{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
[[Category:Developer Documentation{{#translation:}}]]
[[Category:Developer Documentation{{#translation:}}]]
[[Category:Wiki{{#translation:}}]]
[[Category:Wiki{{#translation:}}]]
{{clear}}

Latest revision as of 10:07, 31 March 2023

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 Edit → Preferences → General. FreeCAD uses Qt to enable multiple language support. On Unix/Linux systems, FreeCAD uses the current locale settings of your system by default.

Pomozite prevesti 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.

Kako prevoditi izvorni kod

FreeCAD koristi internetski sustav za internetski prijevod sa trećom stranom pod nazivom Crowdin.

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 Translate button next to one of the files. For example, FreeCAD.ts contains the text strings for the FreeCAD main GUI.
  • You can vote for existing translations, or you can create your own.
If you are actively taking part in translating FreeCAD and want to be informed before next release is ready to be launched, so there is time to review your translation, please subscribe to one of the Crowdin FreeCAD translation teams.


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

Prevođenje vanjskih Radnih stolova

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:

<FCText Name="AdditionalLanguageDomainEntries">"Esperanto"="eo";"French"="fr";</FCText>

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:

<FCText Name="AdditionalTranslationsDirectory">C:/Users/FreeCADUser/TestTranslations</FCText>

Prevedite FreeCAD wiki-stranicu

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 prijevodni dodatak

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

<translate> ... </translate>

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 This page is a translated version of the page Main Page and the translation is XX% complete, 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.

Važne zabilješke

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.

Prevedite FreeCAD dokumentacija

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.

Old translation instructions

These instructions are for historical background only. Translations should use the new system with the #Mediawiki Translation Extension described above.

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").
If not, head to the forum and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.
You must then gain wiki edit permission.
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: go into a red page, and copy/paste the contents of the corresponding English page, and start translating.
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use a slash and your language code in almost all the links. Look at other already translated pages to see how they did it.
Add a slash and your language code in the categories, like [[Category:Developer Documentation/fr]]
And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.
Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)

  • Template:GuiCommand : is the Gui Command information block in upper-right of command documentation.
  • Template:Docnav : it is the navigation bar at the bottom of the pages, showing previous and next pages.
  • Template:Userdocnavi : gives direct links to the main base pages

Page Naming Convention
Please take note that, due to limitations in the Sourceforge implementation of the MediaWiki engine, we require that your pages all keep their original English counterpart's name, appending a slash and your language code. For example, the translated page for About FreeCAD should be About Freecad/es for Spanish, About FreeCAD/pl for polish, etc. The reason is simple: so that if translators go away, the wiki's administrators, who do not speak all languages, will know what these pages are for. This will facilitate maintenance and avoid lost pages.
If you want the Docnav template to show linked pages in your language, you can use redirect pages. They are basically shortcut links to the actual page. Here is an example with the French page for About FreeCAD.

  • The page About FreeCAD/fr is the page with content
  • The page À propos de FreeCAD contains this code:
#REDIRECT [[About_FreeCAD/fr]]
  • In the About FreeCAD/fr page, the Docnav code will look like this:
{{docnav/fr|[[Online_Help_Startpage/fr|Bienvenue dans l'aide en ligne de FreeCAD]]|[[Feature_list/fr|Fonctionnalités]]}}

The page "Bienvenue dans l'aide en ligne de FreeCAD" redirects to Online_Help_Startpage/fr, and the page "Fonctionnalités" redirects to Feature_list/fr.

Prevedite FreeCAD web-stranicu

Prijevod web stranice FreeCAD sada se vrši putem Crowdin. Datoteka je nazvana homepage.po.

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

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 myModule/Gui/Resources. Then open a terminal window (or Windows/OSX equivalent) in your "translations" directory and enter the following command:

lupdate -ts myModule.ts

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

Scripting

See also: FreeCAD Scripting Basics.

To get a dictionary with the languages the FreeCAD interface supports, use the supportedLocales method of the FreeCADGui module.

locales = FreeCADGui.supportedLocales()

After execution locales will contain:

{'English': 'en', 'Afrikaans': 'af', 'Arabic': 'ar', 'Basque': 'eu', 'Catalan': 'ca', 'Chinese Simplified': 'zh-CN', 'Chinese Traditional': 'zh-TW', 'Croatian': 'hr', 'Czech': 'cs', 'Dutch': 'nl', 'Filipino': 'fil', 'Finnish': 'fi', 'French': 'fr', 'Galician': 'gl', 'German': 'de', 'Hungarian': 'hu', 'Indonesian': 'id', 'Italian': 'it', 'Japanese': 'ja', 'Kabyle': 'kab', 'Korean': 'ko', 'Lithuanian': 'lt', 'Norwegian': 'no', 'Polish': 'pl', 'Portuguese': 'pt-PT', 'Portuguese, Brazilian': 'pt-BR', 'Romanian': 'ro', 'Russian': 'ru', 'Slovak': 'sk', 'Slovenian': 'sl', 'Spanish': 'es-ES', 'Swedish': 'sv-SE', 'Turkish': 'tr', 'Ukrainian': 'uk', 'Valencian': 'val-ES', 'Vietnamese': 'vi'}

To get the current interface language use the getLocale method of the same module:

locale = FreeCADGui.getLocale()

If the current language is English locale will contain:

'English'

To get the corresponding language code you can use use:

locale = FreeCADGui.supportedLocales()[Gui.getLocale()]

If the current language is English the result will be:

'en'

To set the current interface language use the setLocale method of the same module. You can specify the language or the language code:

FreeCADGui.setLocale('Russian')
FreeCADGui.setLocale('ru')