Localisation/jp

ローカライゼーションとは、複数の言語のユーザーインタフェースをソフトウェアに与える一般的なプロセスです. FreeCADでは、編集→環境設定→アプリケーションを編集するで、ユーザーインターフェイスの言語を設定することができます. FreeCADは、Qtを使用して複数の言語のサポートを可能にしています. Unix / Linuxシステム上では、FreeCADはシステムの現在の地域設定を使用するよう初期設定されています.

FreeCAD翻訳の支援
プログラマ以外の人々がFreeCADのためにできる最も重要な事の一つが、プログラムの翻訳を助けることです. オンライン共同翻訳システムCrowdinの採用により、翻訳作業は以前よりとても簡単になりました.

翻訳するには

* Crowdin上のFreeCAD翻訳プロジェクト・ページへ行ってください * 新しいプロファイルを作成するか、Gmailのアドレスのようなサードパーティのアカウントを使用してログインしてください * 作業したい言語をクリックしてください * ファイルを選択し、ファイルの横にある「翻訳開始ボタン」をクリックします. 例えば、FreeCAD.tsはFreeCADのメインGUIのテキスト文字列を持ちます * 既存の翻訳へ投票や、独自の訳を作成することができます.

注 ：あなたがFreeCADの翻訳に活発に参加しており、次のリリースの開始準備を事前に知って翻訳のレビューを行いたい場合には、以下に登録してください. http://sourceforge.net/apps/mantisbt/free-cad/view.php?id=137

Translating with Qt-Linguist (old way)
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.


 * Open all of the language folders of FreeCAD shown below
 * Verify that a .ts file with your language code doesn't exist ("fr" for french, "de" for german, etc...)
 * If it exists, you can download that file, if you want to modify/review/better the translation (click the file, then download)
 * If it doesn't exist, download the .ts file without language code (or any other .ts available, it will work too)
 * Rename that file with your language code
 * Open it with the Qt-Linguist program
 * Start translating (Qt Linguist is very easy to use)
 * Once it's completely done, save your file
 * send the files to us so we can include them in the freecad source code so they benefit other users too.

Available translation files

 * FreeCAD main GUI
 * Complete Workbench
 * Drawing Workbench
 * Draft Workbench
 * Reverse Engineering Workbench
 * FEM Workbench
 * Robot Workbench
 * Image Workbench
 * Sketcher Workbench
 * Mesh Workbench
 * Test Workbench
 * Points Workbench
 * Raytracing Workbench
 * Part Workbench
 * PartDesign Workbench
 * Assembly Workbench
 * MeshPart Workbench

Prerequisites
To localise your application module your need to helpers that come with Qt. You can download them from the Trolltech-Website, but they are also contained in the LibPack:
 * qmake: Generates project files
 * lupdate: Extracts or updates the original texts in your project by scanning the source code
 * Qt-Linguist: The Qt-Linguist is very easy to use and helps you translating with nice features like a phrase book for common sentences.

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:

TEMPLATE = app DEPENDPATH += .\Icons INCLUDEPATH +=. HEADERS += ViewProvider.h Workbench.h SOURCES += AppMyModGui.cpp \ Command.cpp \ ViewProvider.cpp \ Workbench.cpp TRANSLATIONS += MyMod_de.ts
 * 1) Automatically generated by qmake (1.06c) Do 2. Nov 14:44:21 2006
 * 1) Automatically generated by qmake (1.06c) Do 2. Nov 14:44:21 2006
 * 1) Input

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 AppGui.cpp. In our example this would be AppMyModGui.cpp. There you add the line new Gui::LanguageProducer("Deutsch", _de_h_data, _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:   Draft_fr.qm 

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 most up-to-date and interesting material is gathered in the manual. 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). Look at other already translated pages to see how they did it.

Then, once you translated a page, you must add to the original English page a link to your translation, so readers know that there is a translated version available, using the template. Look at how other translators did it to do the same.

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.

Three templates are commonly used in manual pages. These 3 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)
 * Template:Docnav : it is the navigation bar at the bottom of the pages, showing previous and next pages
 * Template:Languages : this template must be placed on original pages, to indicate the reader that a translation exists. The localised version must in return be placed on the translated page, to link to the original English page.
 * Template:en : there is one of these for each language. They must be placed inside the language template.

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 "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr.
 * The page About FreeCAD/fr is the page with content
 * The page À propos de FreeCAD contains this code:
 * 1) REDIRECT About FreeCAD/fr
 * In the About FreeCAD/fr page, the Docnav code will look like this:

If you are unsure how to proceed, don't hesitate to ask for help in the forum.