UIおよびヘルプファイルのコンテンツガイド

    From The Document Foundation Wiki
    This page is a translated version of the page UI and Help files Content Guide and the translation is 65% complete.
    Outdated translations are marked like this.
    Other languages:

    このガイドでは、UIおよびヘルプファイルの構成要素のうち、翻訳する必要があるものや、.poファイル内の変数やxml要素といったような翻訳不要ものについて説明しています。

    ユニーク(一意)な用語

    翻訳にあたって、ユニーク(一意)でないといけない用語があります。 ユニークでない場合には、製品が壊れたり、データ喪失などのリスクをユーザーに負わせることがあります。そのようなものを以下にあげます。

    • Style名 sw/source/ui/utlui.poファイルにあるようなもの
    • Calcの関数名(STRLIST_FUNCTION_NAMEなど) formula/source/core/resource.poファイルにあるもの
    • 数学記号 starmath/source.poファイルにあるもの。なお数学記号にはスペースを含めないよう気をつけてください。perthousandper thousandと翻訳したり、noelementno elementと翻訳してはいけません。
    • オンラインヘルプの索引項目 例えば<bookmark_value\>Editing;Help Files\<\/bookmark_value\>のようなものは、同じファイル内でなくても索引項目の表示に問題を生じる恐れがあります。
    • Windowsインストーラーの文字列におけるthe | symbol

    UIファイルの変数と記号

    LibreOfficeはソースコードの各所で様々な技術を組み合わせて使用しているため、UIファイルの変数や記号について厳格なルールを述べるのは難しいところです。これは、いくつかのルールを書き留める試みです。

    • 一部のファイルには、文字列の最後に|が含まれています。省かれるとインストーラーでランタイムエラーが発生するため、この記号は必須です。instsetoo_native/inc_openoffice/windows/msi_languages.poでの例を示します。
    Up one level|
    Create New Folder|
    
    • $%は大抵の場合、ユーザーインターフェイスで置換して表示される変数を表します。$や%に続く単語や数字は翻訳してはいけません。例を示します。
    %PRODUCTNAME                 ''This will display the name of the product''
    Change object title of %1    ''%1 will be replaced by the name of the object''
    Internal error $(ARG1).      ''$(ARG1) will be replaced by the internal error number''
    
    ですが次の文字列のように$が通貨記号として使われている場合、それは変数ではなく、状況に応じて通貨記号を自由に翻訳して構いません。
     Returns the price per $100 face value of a security with an odd last period
    
    • \nはUIでの改行を表します。翻訳でうまく改行位置が合うよう文字列を整理することになりますが、削除はしないでください。でないとダイアログボックスで文字列が切り捨てられてしまいます。例を示します。
    #1 Verify Impress is running \n
    #2 For Bluetooth user, enable "Preferences"-"LibreOffice Impress"-"General"-"Enable remote control"\n
    #3 For WiFi user, tick "Preferences"-"LibreOffice"-"Advanced"-"Enable Experimental Features" \n
    
    • {x}('x'は数)は、Impress Remoteアプリで使用される変数です。変更してはいけません。
    • <X>(Xは大文字の単語)は、大抵の場合、翻訳されるべきでない変数です。<FIELD>、<FIELDNAME>、<LOGICOPERATOR>そして<VALUE>などがその例です。疑問がある場合は、l10n@global.libreoffice.orgメーリングリストで具体的な事例について相談してください。
    • [n](nは数)は、最終的な文字列で値が展開されるパラメーターを表します。数は変更したり翻訳してはいけません。
    • [x](xは単語で、おそらく末尾が数字です)は、多くの場合、最終的な文字列で値が展開されるパラメーターを表します。その名前は触れたり翻訳してはいけませんが(例 [ProductName])、実際には翻訳しないといけない文字列である場合がたまにあります(例 オートコレクト設定のユーザーインターフェイスにおける[M]や[T])。疑問がある場合は、l10n@global.libreoffice.orgメーリングリストで具体的な事例について相談してください。
    • {xxx}(xxxは文字列)は、その中に含まれる[parameter]値が表示時点で値を持たない場合に割愛される文字列の部分を示します。
    例を示します。
     The file [2][3] is being held in use {by the following process: Name: [4], ID: [5], Window Title: 
     [6]}. Close that application and retry.
    
    この場合、変数[5]または[6]のいずれかが表示時点で値を持たなければ、"by the following process: Name: [4], ID: [5], Window Title: [6]"の部分は省略され表示されません。その場合、最終的な文字列は意味をなさなくなるかも知れませんが、それは別の問題です。:-)

    ヘルプファイルのXML要素

    ヘルプファイルにはXML要素がたくさん含まれていて、初心者に翻訳を難しく感じさせがちです。あなたが翻訳する際に疑問を抱かないよう、ここで詳しく説明します。要素は時に他の要素の中に入れ子になっている場合があることに注意してください。要素が持つ属性についても各要素の項で説明します。

    これら要素を扱う最良の方法は、要素の一部を置き忘れたりタイプミスしたりしないよう、それらを翻訳にコピー&ペーストすることです。そして、入れ子になっている要素も考慮しながら、開始タグと終了タグに挟まれた内容を翻訳します。

    <ahelp></ahelp>

    これは、ヘルプディレクトリに存在する要素です。ただしそこに含まれる情報は、LibreOfficeのオプション設定でそれが有効化されている場合に、詳細ヒントとしてUIに表示されます。この要素は<ahelp>詳細ヒント</ahelp>です。例を示します。

    <ahelp hid=\".\">This menu contains commands for editing the contents of the current document.</ahelp>

    この要素には2つの属性があります。翻訳する必要はありません。

    • hid(上の例のとおり)
    • visibility

    <alt></alt>

    この要素は、グラフィックに代替テキストを付与します。多くの場合、<image>要素の中へ入れ子にされます。例を示します。

    <alt id=\"alt_id3159119\">Icon</alt>

    • ここでは「Icon」という単語を翻訳する必要があります。ほかは不要です。
    • ローカライズされたグラフィックスでは xml-lang=\"en-US\" も含みます。この場合、en-USは翻訳言語のISOコードに置き換える必要があります。

    <bookmark_value></bookmark_value>

    この要素は、オンラインヘルプの索引項目として使われます。セミコロンで区切られた最初の単語は主要な見出し語です。2番目の単語は第2レベルの見出し語を表します。例を示します。

    <bookmark_value>page styles; headers</bookmark_value><bookmark_value>page styles;footers</bookmark_value>
    <bookmark_value>headers; defining</bookmark_value><bookmark_value>footers; defining</bookmark_value>
    <bookmark_value>file names in headers/footers</bookmark_value><bookmark_value>changing;dates,automatically</bookmark_value>
    <bookmark_value>dates;updating automatically</bookmark_value><bookmark_value>automatic date updates</bookmark_value>

    • 異なる意味をもつ原文の単語に対し、翻訳言語ではそうでないことがたまにあります。headertitleのように。もしそういう、<bookmark_value>Header;Title</bookmark_value>のような項目を見つけた場合は、翻訳から削除して構いません。何の効果もないので。
    • 大抵の場合、同じ項に複数の項目がまとめられています。
    • ヘルプディレクトリに同様の項目が2つあってはいけません。ヘルプUIの索引表示を壊してしまいます。

    <caseinline></caseinline>

    この要素は、プラットフォーム(Windows、Linux、Mac)に応じて内容を切り替えます。表示されるテキストが変わります。多くの場合、<switchinline>または<defaultinline>要素の中へ入れ子にされます。例を示します。

    Press <switchinline select=\"sys\"> <caseinline select=\"MAC\">Command</caseinline><defaultinline>Ctrl</defaultinline></switchinline> and click the tab of the sheet where you want to insert the contents.

    • この例では、2つのcaseinlineタグに挟まれたCommandだけ翻訳する必要があります。翻訳言語においてキーボードでCtrl以外のキーを用いる場合は、<defaultinline>タグに属するものながら、そこも変える必要があります(キーに「Strg」と書かれているドイツ語のように)。
    • この要素には1つの属性があります。上の例のとおり、selectがそれです。この属性は翻訳する必要はありません。

    <defaultinline></defaultinline>

    この要素には、プラットフォームに応じて内容が切り替わる場合にデフォルトで表示されるテキストが入っています。前の要素で見たように、多くの場合、<switchinline>および<caseinline>要素と共に入れ子になります。例を示します。

    Press <switchinline select=\"sys\"> <caseinline select=\"MAC\">Command</caseinline><defaultinline>Ctrl</defaultinline></switchinline> and click the tab of the sheet where you want to insert the contents.

    • この要素には属性がありません。

    <embedvar></embedvar>

    この要素は、タグ間にローカライズが必要な内容を持ちません。ですがやはり入れ子にされていることがあります。例を示します。

    <embedvar href=\"text/scalc/00/00000004.xhp#optional\"/>

    • この要素には1つの属性があります。上の例のとおり、hrefがそれです

    <emph></emph>

    この要素は、タグに挟まれた文字列を強調します。ですので、挟まれた内容は常に翻訳する必要があります。例を示します。

    Choose <emph>Format - Merge Cells - Merge and Center Cells</emph>

    • この要素には属性がありません

    <image></image>

    この要素は、ファイルに埋め込まれた画像のためのものです。それ自身はローカライズ可能な内容を持ちませんが、ローカライズ可能な文字列を含む<alt>などの他の要素が常に入れ子になっています。例を示します。

    <image id=\"img_id3153714\" src=\"sc/res/sf01.png\" width=\"0.1665in\" height=\"0.1665in\"><alt id=\"alt_id3153714\">Icon</alt></image>

    この例では、Iconを翻訳する必要がある<alt></alt>要素が入れ子になっていることがわかります。

    この要素には翻訳不要な4つの属性があります。

    • idは、画像の参照を表します
    • srcは、画像の所在場所を表します
    • widthは、画像の幅を表します。使われる単位が違っているかも知れませんが(例えばcm)、画像の表示には影響しません
    • heightは、画像の高さを表します。ここで使われる単位も違っているかも知れません

    <item></item>

    この要素は、タグに挟まれた内容に特殊な書式を適用します。

    例を示します。

    To accept the completion, press <item type=\"keycode\">Enter</item> or a cursor key.

    この例では、キーボード項目を強調するために特殊な書式が適用されていることがわかります。

    In <item type=\"menuitem\"><switchinline select=\"sys\"><caseinline select=\"MAC\">
    %PRODUCTNAME - Preferences</caseinline><defaultinline>Tools - Options</defaultinline>
    </switchinline> - $[officename] - General </item>you can set from which year a two-digit number entry is recognized as 20xx.

    この一層複雑な例では、メニュー項目を強調するために特殊な書式が使用されていることがわかります。

    • typeはこの要素唯一の属性です。強調する項目のタイプを決定します。

    <link></link>

    この要素は、他のヘルプファイルやWebへのリンクを表します。例を示します。

    <variable id=\"datedif\"><link href=\"text/scalc/01/func_datedif.xhp\">DATEDIF</link></variable>

    この例では、scalc/01/func_datedif.xhpは表示される内容の所在場所です。翻訳する必要があるのはDATEDIFだけです。

    <link href=\"text/scalc/main0210.xhp\" name=\"Page View Object Bar\">Page View Object Bar</link>

    この例では、name属性の後の内容も翻訳する必要があります。

    この要素には4つの属性があります。

    • hrefは、ファイルへの参照です。ローカライズ可能な内容はありません。
    • nameは、全く使用されていない属性です。ローカライズしても何の効果もありません。
    • targetは、Webコンテンツに関するものである場合のターゲットです。ローカライズ可能な内容はありません。
    • typeは、表示される内容のタイプです。ローカライズ可能な内容はありません。

    <switchinline></switchinline>

    <caseinline></caseinline>要素と<defaultinline></defaultinline>要素で上述したように、この要素は、プラットフォーム(Windows、Linux、Mac)に応じて内容を切り替えます。それ自身は翻訳可能な内容を持ちませんが、常に今しがたの入れ子要素を含んでいます。例を示します。

    Press <switchinline select=\"sys\"> <caseinline select=\"MAC\">Command</caseinline><defaultinline>Ctrl</defaultinline></switchinline> and click the tab of the sheet where you want to insert the contents.

    • selectは、唯一の属性です。ローカライズ可能な内容はありません。

    <variable></variable>

    この要素は、ファイル内で再利用される内容を決定します。タグに挟まれた内容はローカライズする必要があります。例を示します。

    <variable id=\"kopfundfusszeilentext\"><ahelp hid=\".uno:EditHeaderAndFooter\">Allows you to define and format headers and footers.</ahelp></variable>

    この要素には2つの属性があります。

    • idは変数名で、翻訳してはいけません。その名前は内容の種類を示すかも知れませんが、残念ながら大抵の場合、ドイツ語です。
    • visibilityの内容は翻訳不要です。

    .poファイルの検索と管理

    There are several operations that you can execute directly on your .po files. They are text files and some scripts such as the translate toolkit can be used to manipulate them.

    As the Search field on Weblate is not very effective, using the grep command line instructions under Linux will give you much more significant results when you search for a string in multiple files. This part contains a brief description of some scripts, and examples with grep and sed commands to help you to manipulate your files.

    You have first to download the files from Weblate and use the cd command to be in the directory you want to work on (ui or help).

    Translate Toolkit

    Most of the time the Translate Toolkit packages are available for your distro. In case it is not or it is an old version, you can get it from here [1]. If you have any problems installing or using those scripts, do not hesitate to ask for help on the l10n mailing list.

    Several scripts from the Translate Toolkit are implemented in Weblate, like the Failing Checks, which allow you to check your translation. Some, however, may be relevant for you:

    • poterminology lets you extract a terminology file from the .po/pot files. Before beginning a translation project, it is a great help to have the most important or ambiguous words filled and translated in a glossary. You will be able to upload this file under a Weblate project too. The syntax and options are explained on the site.
    • posegment will help to increase the quality of your TM by segmenting the po files based on sentence level. The syntax and options can be found on the site.
    • pocompendium let you create one big po file from a directory of po files. This is useful if you have for example have split a large file to distribute it to a team of translators. The syntax and options are explained on the site.
    • posplit let you extract three .po files respectively containing translated strings, untranslated strings and fuzzy strings. The syntax and options are explained on the site.

    Using grep to find strings

    The grep command is used under Linux, macOS or Unix-like systems to search through text files, or to search the given file for lines containing a match to the given strings or words. The command will display the line matching the search.

    • The simplest syntax is:
    grep 'word' filename.po
    
    Example:
    sophie@sophie:~/libo_ui-fr$ grep 'Browse' accessibility/source/helper.po
    
    returns
    msgid "Browse"
    
    Here we are telling the grep command to find the word Browse in the helper.po file, which is in the subdirectory source of the accessibility directory.
    • This is not very useful, because you have to know the directory where the string is located, while LibreOffice has so many. So we will add an option that will look recursively into all the directories, contained in the main one. This is the -r option.
    The syntax is:
    grep -r 'word' directory
    
    Example:
    sophie@sophie:~/libo_ui-fr$ grep -r 'Browse' accessibility/
    
    returns
    accessibility/source/helper.po:msgid "Browse" 
    
    this looks easier! The output gives you the path to the string
    • To force to ignore the case of the word (for example to search case-insensitive for Browse, browse or BROWSE), you will add the -i option. The syntax is:
    grep -r -i 'word' directory
    
    • Now, we want to retrieve the line number of the string in the output too. This is the -n option
    The syntax is:
    grep -r -i -n 'word' directory
    
    Let me show you an example on our own directory with all the options we know:
    sophie@sophie:~/libo_ui-fr$ grep -r -i -n 'Browse' accessibility/
    
    the output is:
    accessibility/source/helper.po:23:"RID_STR_ACC_NAME_BROWSEBUTTON\n"
    accessibility/source/helper.po:25:msgid "Browse"
    
    You can see, that the second entry contains the word to translate.
    • If you want your search to match only the string you have entered, you can add the -w option. For example to search for is and not retrieve this or his, etc.
    • If you want to search for several words matching only what you have entered, the syntax is:
    egrep -w -r -n 'word1|word2' directory/
    
    Example:
    sophie@sophie:~/libo_ui-fr$ egrep -w -r -n '~File|_File' sw/
    
    the output is:
    sw/uiconfig/swriter/ui.po:313:msgid "_File System"
    sw/uiconfig/swriter/ui.po:1649:msgid "_File name"
    sw/source/ui/frmdlg.po:563:msgid "~File name"
    sw/source/ui/misc.po:591:#~ msgid "~File system"
    sw/source/ui/dialog.po:169:msgid "~File name"
    sw/source/ui/index.po:522:msgid "~File"
    
    Note: we use egrep to match a particular regular expression. The e is for extended grep but you can use the -E option for that as well: grep -E -r -n 'word1|word2' directory/
    • If you have an escaping character in your search, like an apostrophe (e.g. child's book in English or l'objet in French), the simplest way to overcome that is to enclose the word to search with double quotes instead of single ones, like in this example:
    sophie@sophie:~/libo_ui-fr$ grep -r -n "l'objet" sw/
    sw/source/ui/utlui.po:4106:msgstr "Cliquer sur l'objet"
    sw/source/ui/utlui.po:4133:msgstr "Souris sur l'objet"
    sw/source/ui/utlui.po:4151:msgstr "Souris quitte l'objet"
    sw/source/ui/utlui.po:4626:#~ msgstr "Renommer l'objet : "
    sw/source/core/undo.po:641:msgstr "Supprimer l'objet"
    
    • the usual regular expressions applied to grep (*: match zero or more of the preceding character or expression ; ^: match expression at the start of a line, as in ^A, etc.)

    Using sed to modify your files

    Like grep, sed is a powerful command that let you modify the content of your .po files very easily. Sed stands for Stream EDitor. For example, if you want to substitute Header by Title on a file, the syntax will be:

    sed 's/Header/Title/g' <file.po
    
    • first you have the name of the command s for substitute
    • then you have the original word separated by / delimiters
    • after that the word to substitute to the original
    • g is used for global and will substitute all the occurrences in the file, and not only the first occurrence of the searched word
    • then the file where the substitution takes place
    • note the presence of the single quotes too.

    Sed uses regular expressions to manage the instructions, but the syntax will still remain the same as above. We will not detail all the syntax of the lines given bellow, but they are quite simple expressions you can use safely on your files.

    • Remove comments from a file
    Example of the file where you want to remove the # my comment comment in the utlui.po
    # my comment
    #. dnChg
    #: 04180400.xhp 
    
    Enter the following in the sw/source/ui directory:
    sophie@sophie:~/libo_ui-fr/sw/source/ui$ sed '/^#\ /d' utlui.po > tt
    
    that will create the file "tt" in that directory, containing the strings where all the "#" at the beginning of the line (^) followed by nothing are deleted (the d in the syntax).
    To get the tt file turn into utlui.po again:
    sophie@sophi:~/libo_ui-fr/sw/source/ui$ mv tt utlui.po
    
    and now it's a cleaned file!
    • Indicate the line of substitution

    Taking again our first example, you want to work only on a given line, 306 here:

    sed '306 s/Header/Title/g' <file.po
    

    so now you know how to grep first on the file to find the string and then use the sed command to correct it

    • you will find more information on the gnu site about the delimiters, the regular expressions and syntax.

    Localization