ローカライゼーションとは、ソフトウェアのユーザーインターフェースを多言語で提供するプロセスのことを言います。FreeCADでは、Edit → Preferences → Generalでユーザーインターフェースの言語を設定できます。FreeCADは、Qtの機能を使って多言語対応しています。Unix/Linuxシステム上では、デフォルトはシステムの現在のlocaleになります。
FreeCADへの重要な貢献の一つが、(例えばプログラミングスキルがない場合でも)FreeCADの様々な部分(ソースコード、wiki、webサイト、ドキュメンテーション等々)を別の言語に翻訳することです。ここではその方法について説明します。
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:
Note: Details on how to use crowdin can be found on the Crowdin Administration page.
Visit Translating an external workbench.
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>
このwikiには様々の情報があり、その多くはマニュアルを構成しています。ドキュメンテーションをメインページから閲覧できます。また、ユーザーマニュアルのオンラインヘルプ目次からも読めます。
Wikiを翻訳するには、編集権限が必要です。 wikiの編集権限を取得する方法を参照してください。
Wikiページに記載されているwikiマークアップおよびスタイルガイドラインを十分に理解する必要があります。
SourceForgeからwikiを移行した際、Yorikは、翻訳ページの管理をするためのMediaWiki翻訳拡張機能をインストールしました。翻訳拡張機能の利点としては、ページタイトルを翻訳できること、翻訳の履歴を保存できること、元の言語のページが更新された時にそれを通知できること、元の英語版のページとの同期をとれること、などがあります。
翻訳拡張機能はMediaWiki言語拡張機能バンドルに含まれる機能で、Help:Extension:Translateに解説があります。
翻訳を始めるに際しては、まずはページ翻訳の例を参照してください。翻訳機能を有効にするためには、以下のようにページ全体をタグで囲む必要があります。
<translate> ... </translate>
さらに、そのページを翻訳対象として指定する必要があります。
翻訳機能がどのように動作するのかを確認するために、Main Page(英語)をアクセスしてみてください。自動的に生成される言語バーが丈夫に表示されているはずです。日本語(Japanese)をクリックすると、Main Page/jaが表示されます。タイトル「メインページ(in English "Main Page")の下に、このページはページ Main Page を「翻訳」したものです。翻訳は XX% 完了しています。と表示されているはずです。XXは現在の翻訳率です。上部の「翻訳」を押すと、翻訳のためのツールが起動し、翻訳、修正、レビューができます。
メインページに行くと、[編集]タグをクリックして直接ページを編集することはできず、「編集」の代わりに、翻訳ツールを開く「翻訳」リンクが表示されているはずです。
新しいコンテンツを追加するときは、英語版を最初に作り、その後で別の言語に翻訳しなければなりません。もしあるページの内容を修正あるいは追記したい場合、英語版のページの修正を先に行わなければなりません。
翻訳をどう勧めたらいいのかわからないときは、躊躇せず、FreeCADフォーラムのDevelopment → Wiki subforumまたは言語ごとのフォーラムで質問してください。
「Editor」権限を持っているwikiユーザーは、翻訳ツールを起動して、翻訳を作成し、セーブし、査読することができます。
一方、あるページを翻訳対象に指定できるのは「Administrator」権限を持っているユーザーだけです。翻訳対象として指定されていないページは翻訳拡張機能を利用できず、英語版と正しく同期させることができません。
左のサイドバーも翻訳可能ですが、サイトのこの部分の変更は管理者のみが行えます。詳細はサイドバーのローカライゼーションを参照してください。
新しい翻訳システムにページを切り替えると、最初はすべての旧「手動」翻訳が失われます。翻訳を復元するには、切り替え前に旧テキストのオフラインコピーを保存しておく必要があります。その後、この古い翻訳テキストを新しいシステムの翻訳ユニットに入力できます。また、履歴から過去のバージョンを開き、この方法で古いテキストを取得することもできます。これは、翻訳されたページがあったすべての言語で行う必要があります。
前提として、wikiの基準となるページは英語であり、英語のページを最初に作成しなければなりません。もしページの内容を変更したり追加したい場合、最初に英語のページを編集し、更新が完了した後に、変更点を翻訳ページに反映させてください。
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. |
FreeCADウェブサイトの翻訳はCrowdinで行うようになりました。ファイル名は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')