Help:Extension:Translate/Unstructured element translation/ja

This page explains how to make translation of customised wiki interfaces messages a bit more manageable, with the Translate extension. It applies to any part of the wiki which you want to automatically provide in the user's interface language. The most typical example is the sidebar, because there can be only one, but the same method can be used for the main page, if you want to have all translations of it under the same title, or even for templates.

This method is applicable also to wiki content where full page translation just doesn't fit, like pages heavy in markup or templates, whose markup you don't want to expose to translators. This all revolves around interface messages, or the magic word, that allows you to include interface messages anywhere where you can write wikitext. This magic word allows to automatically substitute the interface message, whether standard, customised or new, in the user interface language.

ウィキの本文にもウィキのインターフェイスの自動地域化の機能を適用できますが、インターフェイスの言語を既定の言語から変更できない匿名利用者の問題は解決できません. 下記の Language Selector 拡張機能にある注釈をご覧ください.

ページの翻訳と比較して、この手法にはいくつかの難点があります:


 * 1) MediaWiki developers usually discourage the usage of  because it fragments the cache. Instead of storing one cached rendered version of a page, when  is used it needs to be cached potentially in hundreds of different languages.
 * 2) It is harder to setup, requiring access to wiki configuration.
 * 3) There is no automatic tracking of outdated translations and completion statistics might be off when new messages are added or deleted.
 * 4) Only wiki administrators can add messages to the message groups and translate them. This means that the system is suitable only for pages which don't change often, or administrators will have a lot of work.

The good thing is that it works most of the time and you can still get the job done. There are two tutorials that provide examples of the common use cases. Before that there is section which details how to set up a message group, something which is always needed when using this method.

セットアップ
サーバー管理者はこの手順を完了する必要があります. 以下のスニペットを LocalSettings.php に追加する必要があります. The message group id,, must be unique, so don't reuse the same id for multiple groups. The second parameter to the, refers to the Mediawiki:Sidebar-messages page. The label is shown in dropdowns and other places where you can select a message group. The description is shown in Special:Translate. Those are the values you can and should change to what suits your wiki when adding a new custom message group.

地域化されたサイドバーのチュートリアル
We assume that the setup step has already been done. Then you should follow the sidebar customisation guide carefully. Let's assume the following simple sidebar was created: And MediaWiki:Sidebar-commonpages contains, while MediaWiki:Sidebar-faq contains.
 * sidebar-commonpages
 * FAQ|sidebar-faq

Then all we need to do is to go to MediaWiki:Sidebar-messages (or whatever was defined in the previous step) and write there: sidebar-commonpages sidebar-faq つまり、これは名前空間名「MediaWiki:」を除いたシステムメッセージ名を、空白で区切って列挙したものです.

Then go to Special:Translate/wiki-sidebar (or whatever was defined in the previous step; see Special:Translate for the list of defined groups). Now it is possible to translate the messages into other languages. Since all the messages are in the MediaWiki namespace, only a wiki administrator can edit the list of messages and actually translate them.

地域化されたメインページのチュートリアル
Another use case is a page with lots of markup or templates. See the main page of translatewiki.net for example. The advantage of this method is that the language automatically appears in the user's interface language. The drawback is that to change the language in which the page is displayed, the interface language must be changed.

作業手順は前述のチュートリアルと同様です:


 * 1) Setup a new message group.
 * 2) Take a wiki page.
 * 3) Replace each translatable part with  and move the content to MediaWiki:Mainpage-messagename.
 * 4) Go to MediaWiki:Mainpage-messages (or what was defined in the setup) and add the message names there separated by whitespace.
 * 5) You are done. Go to Special:Translate to translate the main page.

Here is an example. Let's say Main Page contains:  is a community for chefs and bakers that love chocolate. We currently have full of chocolate. そしてこれを以下のように変更します: 

Create MediaWiki:Mainpage-slogan with the content: is a community for chefs and bakers that love chocolate. Create MediaWiki:Mainpage-pagecount with the content: We currently have full of chocolate. Create MediaWiki:Mainpage-messages with the content: mainpage-slogan mainpage-pagecount これで完了です! 新しいメッセージを、いつでも追加/除去できます.

言語の選択
利用者がページの言語を切り替えるのに個人設定を変更する必要があるだけでなく、匿名の利用者はインターフェイスの言語を変更できずに常にウィキの既定の言語を使用することになります. 匿名の利用者に言語を変更する方法を提供しない場合、このシステムで翻訳したページは既定の言語で表示されます.

幸運なことに解決策があります. UniversalLanguageSelector 拡張機能を使用すると、利用者の好みの言語を推測でき、利用者が手動で他の言語を選択したり、その設定を Cookie に保存することもできます. これには (ほぼデバッグのみに使用する)  パラメーターのようなトリックは不要です.