Jump to content

TDF Wiki/多言語対応

From The Document Foundation Wiki
(Redirected from Multilingual Wiki/ja)
This page is a translated version of the page TDF Wiki/Multilingual and the translation is 59% complete.

このページは、TDF Wikiにある多言語Wikiコンテンツに関するものです。

情報
新しく作成されたページには OrigLang タイプの翻訳を使用しないでください。現在、MediaWiki Translate extension に移行中です。

背景

ここにあるものは、このWikiの全ての編集者にとって重要な事項です。Wikiにページを追加する前に、必ず読んでください。

翻訳の問題と不完全な翻訳

現在、Wiki内の翻訳可能なページのほとんどで翻訳機能が使用されています。この機能を使用すると、古い翻訳が含まれている段落が自動的に強調表示されます。このようなページでは、不完全な翻訳を削除するのではなく、保持することをお勧めします。他の翻訳者の作業について質問がある場合は、その翻訳者のユーザーページを表示して、「この利用者にメールを送信」機能を使用して他の翻訳者に連絡することができます。変更に関するリクエスト、提案、またはアイデアに対して幅広いフィードバックが必要な場合は、localization mailing list に参加してください。ローカリゼーションチームとネイティブ言語チームを代表して感謝します。

特定言語にフォーカスした内容

特定言語のみの内容や、翻訳ではないページのことです。これらは大文字の言語コードを名前にしたページのサブページとします。

例:


 https://wiki.documentfoundation.org/DE/Team
 https://wiki.documentfoundation.org/DE/Veranstaltungen
 ...
 https://wiki.documentfoundation.org/FR/Documentation/Publications
 

全体にフォーカスした内容

英語ページと、これを他言語に翻訳したページのことです。翻訳されたページは、言語コードを使ったサブページとします。翻訳はTranslate 拡張機能を通じて行います。

ページを翻訳可能にするには、次の手順に従います。

  1. 翻訳が必要なコンテンツを <translate></translate> ブロック内に配置する
  2. ローカルの翻訳可能なページにリンクする場合は、Special:MyLanguage 接頭辞を使用します。
  3. 言語メニューブロック <languages/> を追加
  4. ページを保存したら、上部にある「このページを翻訳対象としてマークする」というリンクをクリックします。
  5. すべてが正常であることを確認し、下部にある「このバージョンを翻訳対象としてマークする」ボタンをクリックします。

ページが翻訳対象としてマークされると、翻訳拡張機能により、 <!--T:1--> の形式で、翻訳可能な文字列を示すマーカーが自動的に追加されます。自動的に文字列に分離されるようにするには、テキストのブロックを空白行で囲む必要があります。文字列を強制的に分離するには、さらに <translate></translate> ブロックを追加できます。特に、箇条書きまたは番号付きリストに注意してください。

ソースページでコンテンツを追加または変更すると、ページの上部に次のように表示されます。This page has changes since it was last marked for translation。 "marked for translation" リンクをクリックすると、最初の翻訳用マークと同じプロセスに従って、翻訳システムが最新の状態になります。

ヒント

In an ideal situation, translators should see a minimal amount of wiki markup. Having markup for a table or a template in the translatable string is frustrating and confusing for the translator. Try to leave such markup outside the <translate></translate> blocks.

The page title is made translatable by default, but you can control this with the checkbox "Allow translation of page title" when marking a page for translation. The page title is the first translatable string in the list of strings. In the translation system and interface, the string has a name like "Translations:Faq/General/127/Page display title/ru" while the other string names have numeric identifiers like the "4" in "Translations:Faq/General/127/4/ru".

Sometimes there is a need to give a page a display title that is different from the name in the page path. Note that this is not recommended and should be avoided. In these cases, use the Rename template like so: {{Rename|My new name}}. The template will make sure there are no errors in the translated pages regarding the title.

You can do a partial update of a translation while still leaving the status as outdated by clicking the downward-pointing triangle next to the translation unit name and selecting Show in wiki editor. You will be taken to a separate editing page where you can make your changes and save them while leaving the !!FUZZY!! special word at the start of the text intact.

Sometimes you need to access the English wiki source without the <!--T:1--> markers. This can be done by adding /en at the end of the page path and then editing the source. This will allow you to copy a page structure into a new page (such as Release notes).

When working on a page with many translation blocks, it sometimes happens that you make a mistake with opening or closing translate tags. In a situation like this, the page preview will show all the translate markup alongside the content. Clicking Save changes has a suprisingly useful effect, however: instead of saving, it will display a reduced view of the source text, helping you to find your error.

If you have blocks that only contain a single number, you can use the magic word {{formatnum:1234}} instead of a translate block. The number will automatically be formatted to non-Western styles, when needed. It is best to use the NOSEP parameter for whole numbers to prevent showing thousand separators as they can confuse readers. For decimal numbers it is best not to use NOSEP, because it would skip the localisation of the decimal separator.

Below is an example of a page prepared for translation. Notice the separation of the bulleted list and contents in a table.

 {{TopMenu}}
 {{Menu}}
 {{Menu.Documentation}}
 <languages/>

 <translate>
 == Hello World ==

 * We must take the world as we find it
 * When we are gone, let the world be flooded
 * The world is as fools wish it to be
 * It's a small world!
 </translate>
 <translate>
 * Crows are black the world over
 * He slipped once and all the world knew about it
 * The world is like a market, the one does business and the other does none
 * Huge though the world is, I always miss when I hit at it
 </translate>


 {| class="wikitable"
 |-
 | <translate>Cell content</translate>
 |-
 | {{sometemplate|<translate>Text content for a template</translate>}}
 |-
 | <bdi>{{formatnum:-1.10714871779409}}</bdi>
 |-
 | {{formatnum:110714871779409|NOSEP}}
 |}

 [[Special:MyLanguage/Development/Create_a_Hello_World_LibreOffice_extension|<translate>Tutorial on creating a Hello World extension</translate>]]

 [[Category:Documentation]]
 

As table content can be annoying to prepare for translation, a helper script has been created. Use it by copying a wiki article into a local text file and giving the file name as an argument for the script. The file contents will be rewritten in place. The formatnum magic word will be applied for integer, floating point and complex numbers, if they are the only content in a table cell. The script depends on wikitextparser, regex and wcwidth packages. Click Expand to see the script.


#!/usr/bin/env python3
#
# uses the library https://github.com/5j9/wikitextparser
import sys
import wikitextparser as wtp

def is_float_or_complex(value):
    try:
        float(value)
        return True
    except:
        return False
    try:
        complex(value)
        return True
    except:
        return False

def wrap_translate(string):
    if string.endswith(('}}', '</translate>')) or (len(string) < 2 and not string.isnumeric()):
        return string
    elif string.isnumeric() or is_float_or_complex(string):
        if string.isnumeric():
            format_end = '|NOSEP}}'
        else:
            format_end = '}}'
        # Add bdi element so minuses will stay in place with RTL languages
        if string[0] == '-':
            return ' <bdi>{{formatnum:' + string + format_end + '</bdi> '
        else:
            return ' {{formatnum:' + string + format_end + ' '
    else:
        return ' <translate>' + string + '</translate> '

with open(sys.argv[1]) as f:
    doc = f.read()

p = wtp.parse(doc)
tables = p.get_tables()

for t in tables:
    if t.caption:
        caption = t.caption.strip()
        if len(caption) > 0:
            t.caption = wrap_translate(caption)
    for row in t.cells():
        for cell in row:
            c = cell.value.strip()
            if len(c) > 0:
                cell.value = wrap_translate(c)

with open(sys.argv[1], 'w') as f:
    f.write(p.string)

既に翻訳された内容を新システムに移行する

以前は、TDF wiki はOrigLang と Lang と呼ばれるテンプレートを使って翻訳する方法をとっていました。これらのテンプレートは、元のページと翻訳ページをリンクするメニューを表示します。Lang テンプレートを使って翻訳されたページの一覧は「Template:Lang」へリンクしているページで見られます。同様に、pages with OrigLang template をリストすることができます。

Translate 拡張機能には既に翻訳されている内容を新システムに移行するのを助ける移行ツールがあります。原文と翻訳の(空行で区切られた)ブロックがきちんと一致していれば、移行はとても簡単です。一致していない場合は、入力ボックス間で、文字列をカットアンドペーストして揃える必要があります。

移行は次のように行われます。

  1. After marking a page for translation, wait for some minutes, so the server will have processed the page
  2. Navigate to Special:PageMigration
  3. In the input box, input the language path of the page you want to migrate, like: Mypath/Mypage/de for some imaginary German translation
  4. Click the Import button
  1. Clean up the contents in the input boxes containing the old translations (for example, remove any useless menu templates)
  2. In the column with the translations, you can't leave empty or extra input boxes at the end, so delete them by clicking the trashcan icon next to them
  3. After you cleaned up and put everything in order, click the Save button

Remember that you can always view the old version of a translated page using its View history link and clicking on an old revision.

If you want to view the source of an old revision, copy its link from the history and visit the link after adding this to the end:

&action=edit

Sometimes it does not make sense to use the migration tool. Leaving wiki markup outside the translate elements often confuses the tool. In these cases, the suggestions presented by the translation memory can be more useful.

サイドバーのメッセージ

To translate the messages ”Get Involved” and ”Support LibreOffice!”, you need to send the translations to one of the wiki administrators. The others are system messages which are usually translated in upstream MediaWiki. However, we have a custom copyright notice that is displayed in the footer, so you can filter by "copyright" and translate the entries to your language by clicking the title of the message page.

The translation of the additional Sidebar elements has been set up using the steps in the Translate extension help page for unstructured element translation. The administrators just need to visit Special:Translate/wiki-sidebar in order to translate the messages.

The ”Main Page” and ”Get Involved” links use the Special:MyLanguage prefix, which makes them direct to a translated page, if it is available.