Локализация, общо взето, е процесът на снабдяване на даден софтуер с потребителски интерфейс на различни езици. Във FreeCAD можете да зададете езика на потребителския интерфейс през Редактиране → Предпочитания → General. FreeCAD използва Qt за да поддържа потребителски интерфейс на множество езици. На системи Unix/Linux, FreeCAD използва по подразбиране потребителските регионални настройки на вашата система.
Едно от много важните неща, с които потребителите могат да допринесат за FreeCAD (ако например нямат умения за програмиране), е да помогнат за превода на различните му аспекти (изходен код, уики, уебсайт, документация и др.) на друг език. Ето начините да направите това.
FreeCAD използва система за съвместно превеждане онлайн на трета страна, наречена Crowdin.
Той е платен софтуер, но безплатен за FOSS проекти. По-долу са дадени инструкции как да го използвате:
Note: Подробности за това как да използвате crowdin можете да намерите на страницата Crowdin Administration.
Посетете Превеждане на външни работни маси.
Започвайки от FreeCAD 0.20, следните променливи могат да бъдат добавени ръчно към раздела BaseApp/Preferences/General на файла user.cfg, за да помогнат с разработването на нови преводи:
AdditionalLanguageDomainEntries - за напълно нови езици за FreeCAD, които още не се поддържат от програмния код, можете да използвате това потребителско предпочитание, за да добавите към списъка на наличните езици. Форматът за езици е "Language Name"="code"; например:
<FCText Name="AdditionalLanguageDomainEntries">"Esperanto"="eo";"French"="fr";</FCText>
AdditionalTranslationsDirectory - добавяне на допълнителна директория към FreeCAD да търси *.qm файлове. Това място ще има приоритет прад $userAppDataDir/translations и $resourceDir/translations. Например:
<FCText Name="AdditionalTranslationsDirectory">C:/Users/FreeCADUser/TestTranslations</FCText>
Това уики е хранилището за много съдържание, по-голямата част от което изгражда ръководството за ползване. Можете да прегледате документацията, започвайки от Главна страница, или да разгледате Справочника към ръководството за потребителя.
За да превеждате уикито, трябва да имате разрешения за редактиране; вижте How can I get edit permission on the wiki?.
Също така трябва да имате достатъчно познания за езика за маркиране в уики и да следвате общите насоки за стайлинг, описани на Уики страниците.
Когато уикито се премести от SourceForge, Yorik инсталира MediaWiki's Translation extension, което улеснява превода на страници. Предимствата на разширението за превод са, че заглавието на страницата вече може да бъде преведено, той следи преводите, той уведомява дали оригиналната страница е актуализирана и поддържа преводи в синхрон с оригиналната английска страница.
Инструментът е документиран в Help:Extension:Translate и е част от MediaWiki Language Extension Bundle.
За да започнете бързо да подготвяте страница за превод, моля, прочетете примера Page translation example. Двойка тагове трябва да обхванат цялата страница, за да активират системата за превод:
<translate> ... </translate>
Страницата също трябва да бъде маркирана за превод.
За да видите пример за това как работи инструментът за превод, посетете Main Page. Ще видите автоматично генерирана езикова лента в горната част. Кликнете върху български, и линкът ще ви отведе до Main Page/bg. Точно под заглавието "Главна страница", можете да прочетете Тази страница е преведена версия на главната страница на страницата и преводът е XX% пълен, XX е текущият процент на превода. Кликнете върху "Превод" в горната част на страницата, за да започнете помощната програма за превод, за да актуализирате, коригирате и прегледате съществуващия превод.
Ако отидете на Main Page/bg, ще забележите, че вече не можете да редактирате страницата директно, като щракнете върху маркерите [Edit], а горната връзка "Редактиране" е заменена от връзката "Превeждене", която отваря помощната програма за превод.
При добавяне на ново съдържание първо трябва да се създаде английската страница, след което да се преведе на друг език. Ако някой иска да промени или добави съдържание в страница, първо трябва да промени страницата на английски език.
Ако не сте сигурни как да продължите с преводите, не се колебайте да помолите за помощ в Development → Wiki subforum или в specific language subforum във форума FreeCAD.
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.
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.
| 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").
Page Naming Convention
#REDIRECT [[About_FreeCAD/fr]]
{{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. |
Translation of the FreeCAD website is now done through Crowdin. The file is named homepage.po.
This section is for developers who want to add localisation to their code.
These are the parts to the FreeCAD translation process:
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.
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
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.
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')