This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

GNOMEアプリケーションの地域化

そんなにGNOMEを翻訳したいですか?

はじめに

GNOMEのプログラムは、地域化できることを意図して書かれています。これは、(物理的に)異なる場所で異なった振るまいをするようにプログラムを増強できることを意味します: アメリカで印刷される紙は、ヨーロッパで印刷される紙とはサイズが異なります; 気温は、場所に応じて華氏や摂氏という単位で表示されます; そして、ユーザが見るプログラムの言語は、ユーザの母国語である可能性があります。

翻訳は、この地域化の手順において主要な部分です。GNOMEの翻訳の過半数は、ボランティアベースでネイティブスピーカたちによって行われています。彼らは、オリジナルの英語の文に適切な翻訳を提供し、この情報を含んだファイルをGNOME Git リポジトリに追加します。それによってソフトウェアの次のリリースに新しい言語が含まれます。

このドキュメントは、GNOMEの翻訳手順に関与する方法について説明しようとしています。

あなたのチームの検索

まず最初に既にあなたの言語で誰かが作業していないか?です。もしそうならば、彼らはGNOME翻訳プロジェクトのチーム一覧に記載されているでしょう。最初の一歩は、彼らに連絡することです。あなたは、利用可能な言語の一覧も見てみたいかもしれません。

地域化したい言語のチームを見つけたにも関わらず彼らから返事がない場合、GNOME国際化メーリングリストに連絡してください。誰かが、何をすればよいか助言してくれるでしょう。

もし、あなたの言語のチームがない場合も先ほどのメーリングリストに連絡してください。その場合には、その言語のコーディネータとなるよう招待されるでしょう。

活発なチームと接触することに成功した場合、おそらく次の節を飛ばし、『翻訳』という節に移動できます。

チームの創設

あなたの言語のチームがなければ、潔くチームを開始しそのコーディネータを買ってでませんか?天晴れです!

コーディネータの役割

チームのコーディネータとして、チームの主要な担当者としてチームの他の翻訳者を組織する責任があります。これは、複数の翻訳者が同時に同じファイルの翻訳を試みることを未然に防止することを含みます。

コーディネータは、GNOME国際化メーリングリスト(gnome-18n)に参加する必要があります。これは、すべてのGNOME翻訳者に強く推奨される事ですが、コーディネータには必須です。

もし、チームの何人かのメンバーがGitのアクセス権を持っていてもそれはあなたになるでしょう。アカウントが適格になる前に最初にいくつかの翻訳に貢献する必要がありますが。詳しくは、アカウントの要求をご覧ください。 もし、あなたがGitのアクセス権を持っていないならば、各チームメンバーがあなたに翻訳を送り、それらをGitのアクセス権を持った誰かに転送し、その誰かがそれらをコミットするでしょう。これは、すべての正しい翻訳がふさわしい人に適時に渡るようにします。なるべくなら、GNOME's Bugzilla bug tracking systemにて"l10n"プロダクト("l10n"は"localization"という用語の略語です)のあなたの言語のコンポーネントに対し、バグレポートを作成してこれを行ってください。そして、このバグレポートに翻訳を添付してください。それから、このバグレポートに誰かを指名して、その翻訳をコミットするように頼んでください。

当初、少なくともあなたのチームに属するバグは、あなたの宛名に来ます。(あなたの翻訳が使われるようになるまでに多くのバグを受け止る可能性はありません。)前述のようにあなたの言語は、Bugzillaでそれ自身のコンポーネントを有しています。翻訳のバグは、"l10n"プロダクトに対して提出されるでしょう。アイディアを得るためにGNOME BugzillaにあるL10Nの概要ページをご覧ください。

しばしば、コーディネータは、LINGUASファイルの更新やPOTファイルの生成といった翻訳作業のより技術的な局面に対処することが予想されます。(そのすべてを後述しようと思います。)

あなたの翻訳チームにより多くのメンバーを募集することにも関わるでしょう。それは、あなたのより多くの作業を意味するかもしれませんが、多くの手が翻訳を早めます。

適切な時にコーディネータを辞める事もコーディネータとしての責任です: 例えば、コーディネータに値する努力を捧げる時間がもはやない時です。もし、調整役を実行できないことが分かったならば、あらかじめ代わりをするよう誰かに頼んでください。GNOME国際化メーリングリスト(gnome-18n)にコーディネータの変更をアナウンスするようお願いします。

言語コード

始めるにあたって、あなたの言語のコードを見つけ出す必要があるでしょう。これは、2ないし3文字のコードです。多くの一般的な言語は2文字のコードを持つ傾向があり、一方、多くの名もない言語は3文字にはめ込む傾向があります。複数の国で話されている言語において、国を特定する翻訳は、アンダースコアと大文字で2文字の国コードが続きます。アットマークと更なる情報を付け加えることもできます。当面は、国コードは"fr"(フランス語)や"en_GB"(英国で使用されている英語)の様な形式である事を知ってください。

あなたの言語のコードを知らないのであれば、(KDEMozilla及びOpenOfficeといった)他のプロジェクトにおいてあなたの言語での翻訳成果がないか探してみてください — 同じコードが使われている(はず)です。何も見つからないのであれば、GNOME国際化メーリングリスト(gnome-18n)に助けを求めてください。

GNOMEは、ISO規格639(言語コード)とISO規格3166(国コード)で定められた標準コードを使用しています。gnome-i18nのメンバーは、あなたの言語のコードを見分ける手伝いをしてくれるでしょう。

あなたの言語のコードは、地域化を識別するために使われています。例えば、ロケールやファイルの名前です。あなたのコードがあれば、翻訳を開始することができます。

開始するのに必要なもの

あなたの翻訳作業に非常に役立つものが多数あります。

メーリングリスト

ウェブサイト

用語集

An IRC channel

The gettext tools

翻訳

This is where we get down to it. There are about 44,000 distinct strings which are found in the basic distribution of GNOME 2.26. There are a variety of tactics and methods you can employ, but they all boil down to translating all those strings.

異なるアプローチ

There are different ways of translating. Some teams simple parcel out the “po file” to different people and the members work through them with a text editor and return them to the person who can commit them into GNOME. Other teams use web-based systems. All have advantages and disadvantages.

.po file details are at the end of this page as the longest section. You can jump ahead to the section on .po files if you don't intend to use anything else.

Webインターフェース

A web interface generally provides anyone with a list of strings and waits for them to suggest translations for them. Someone periodically sweeps up all the results and feeds them back into Git. The advantage is that only the team co-ordinator and the maintainer of the web interface need to care about how to make .po files. This lets anyone who doesn't have GNOME, a useful editor, or other things help with the translation. One disadvantage is that without being able to see the rest of the file, contributors may not realise how other people are translating applications. If your team is trying to achieve consistency, this can be a problem. Another is that comments from the developer to translators explaining the string are not always shown.

Existing web interfaces include the following:
Prevod
Kyfieithu

poファイル

There is an excellent document available about how to checkout po/ directories, create .pot files, turn them into .po files, and check them back into Git: How to use GNOME Git as a Translator. You must read this. It explains all the details of using the gettext tools. Since this is 90% of working with .po files, you need to know it. We have not repeated it here. We have simply added a few comments which are in addition to it. They do not replace it.

Note that you can obtain .po files from your language's status pages on the GNOME Translation Project website. (See below). Sometimes special characters (non-ASCII) can be garbled doing this, but it is a useful alternative to Git.

A .po file is simply a list of strings from the original program, with spaces for you to put your version in. There is a set of headers at the top, some of which you will have to edit. The Project-Id-Version will become the name of the module. The POT-Creation-Date should be filled in automatically. You must edit the PO-Revision-Date yourself. Language-Team should be your team's language and ideally an email address which will contact one or more of your members. The Content-Type must be UTF-8 and you must make sure that the resulting file is in fact UTF-8 format. On UNIX and UNIX-like systems, the file command will tell you what format it is in. On a machine with all the gettext facilities installed, you can use msgfmt -cv filename.po. If the file is not UTF-8, msgfmt -cv will produce an error message saying so.

You will meet comments in the file. When they say “c-format”, this means that there are strings which the program will fill in itself. For example, the clock applet in gnome-applets has a string to translate of “%H:%M”. You can “translate” this by pasting it straight in. They will be provided by the system clock on the computer. %H is the hours. %M is the minutes.

There is a separate appendix on common C-format strings.

You will also meet messages to translators from the programmer. For example, in gnome-applets, slightly after the message quoted above you will find the comment “translators: reverse the order of these arguments if the time should come before the date on a clock in your locale”.

You will also have to replace menu accelerators: the keyboard shortcuts which can be used instead of clicking on menus. Expect contradictions and collisions in the early days. It is probably most important to do the accelerators for gtk+ first, since they will be in every single GNOME application. Then you can use the remaining letters and try to work out what combinations work the best. Don't worry if you have two or more menu options with the same accelerator. Since version 2.4, GNOME will let you cycle between them.

You will often come across descriptions for GConf keys. Usually, each key has both a short and a long description. Strings which are key descriptions can be identified by the fact that they come from files with names resembling .schemas.in.h.

When translating key descriptions, be careful with sample key values, which will be enclosed in double quotes. They should not be translated. For example:

#: src/gnome-terminal.schemas.in.h:70
msgid ""
"Default color of terminal background, as a color specification (can be HTML-"
"style hex digits, or a color name such as \"red\")."
msgstr ""
"Rhagosodiad lliw cefndir y terfynell, fel penodid lliw (gall fod mewn hecs-"
"ddigidau fel yn HTML neu fel enw lliw megis \"red\")." 

In the example, “red” is a sample key value, and must be copied verbatim into the translation. Note that because the double quote character is significant in .po files, it is escaped with the backslash.

If you meet English messages which you cannot understand, don't hesitate to file a bug against the application telling the developer of the problem. Please add "L10N" to the "Keywords" field of the bug report form before committing your report. If you meet English messages which you cannot reasonably translate (too complex, not precise enough, etc), file a bug again. Translators as a group file dozens and dozens of these, because translators are the ones who spot them. The earlier you file these the better. When you learn what the message means, you will probably forget about filing the bug. Filing them gets them fixed, and stops other translators having to struggle with the strings.

Don't touch the msgid lines

Do not edit the English strings in the file. If you do that, the programs for merging them into the main application will get confused. Your changes to the English strings will be lost, and your translations may not be incorporated.

変更の処理

Unfortunately, software changes, and that includes changes to the translatable content of the software. Strings get added, strings are changed, and sometimes strings are removed. Fortunately, there are tools and procedures which can help you to keep up with changes to the software you're translating.

The status tables

At the Damned Lies about GNOME website you can get status tables for each language translation in GNOME and for each package. Clicking on Languages gives you a list of all language translations of GNOME. Clicking on any of these shows a page with detailed information on the translation status of each GNOME release and it's corresponding documentation for that language. By clicking on the releases you get a status breakdown by package. These pages for the packages contain links to the latest .pot file and the latest .po file (if a start has been made on the translation). You can download these straight from the status pages instead of using Git. You can't upload them that way, but the download facility is very useful.

And all of this is maintained from version 2.14, and the latest stable release, and for the packages which will become the next stable release. At the time of writing (August 2009), 2.26 was the last stable release and 2.28 is under development.

As soon as translations for your language have been committed to Git, your language will acquire its own section in the status tables. You should probably bookmark the pages relevant to your language. They are very very useful.

Your language page will have a URL of the form http://l10n.gnome.org/languages/XX/gnome-2-26 where XX should be replaced by your language code (lower-case). The above URL is for the upcoming GNOME 2.26. If you want to see the stable release of GNOME, adjust the URL accordingly.

変更されたパッケージの更新

You will generally discover changes when you update your copy of a module in GNOME Git or when you refresh your browser on your status pages. Again, How to use GNOME Git as a Translator is your guide to the necessary Git commands. If you check out the entire module from Git that you want to translate, you can enter the po subdirectory and run intltool-update xx where XX should be replaced by your language code (lower-case). This command will check the entire module for strings and will update your po file to include the latest strings.

Another option: If you know there are more strings to translate, then you need to generate a new .pot file which contains all the strings to translate and then to merge it with your xx.po file which has a less up-to-date set of translated strings. Generate the .pot file with intltool-update --pot. Merge the two together with msgmerge -o new-xx.po xx.po .pot and try very hard to get those in the right order! Then run msgfmt -cv new-xx.po to see how much work remains. If you are lucky, there will be many many “fuzzy” strings: strings which are so similar to already-translated messages that the msgfmt program has suggested that you use the old translation for the new string.

Fuzzy translations are just that

msgmerge gets fuzzy translations wrong from time to time. Every translator has their favourite suggestion which was badly wrong: my (Telsa's) personal favourite is the suggestion that the translation for “Open window” should be used to translate “Close window”...

Go through your new file searching for instances of the string “fuzzy”. If it is in a comment above a translation that looks correct, then remove the word “fuzzy”. If “fuzzy” is the only word on the line, you can safely remove the whole comment. If you do not remove the word “fuzzy” then the translation will not be used. For example:

#, fuzzy
msgid "Blah blah blah."
msgfmt "La la la."

In this case, if you are confident in the translaton, the line with "fuzzy" in it can be removed entirely:

msgid "Blah blah blah."
msgfmt "La la la."

However, you may come across a something like this:

#, c-format, fuzzy
msgid "Very important: %s"
msgstr "Pwysig iawn: %s"

In this case, if you wish to remove the fuzziness, the "c-format" tag must be left intact:

#, c-format
msgid "Very important: %s"
msgstr "Pwysig iawn: %s"

Sometimes a whole set of messages are moved to a new module. This can be particularly disheartening if you had translated them once already and think you now have to do them again. You can save on the work by using the .po file from that module with msgmerge. You can also generate yourself a compendium of messages you have translated which you can keep, edit, and use as a source of suggested translations. You can do this using msgcat, in the form msgcat a.po b.po c.po > compendium. You should check the contents of the compendium before using it for translation, especially for strings of the form “#-#-#-#-#” which indicate conflicts among the original .po files. This feature also means that you can use msgcat to check for inconsistencies among .po files. Once you have created your compendium with msgcat, you can make use of it with msgfmt, as you would any other .po file.

You may find that a whole selection of messages are no longer used in the application. They will be moved down to the bottom of the .po file and left there, commented-out. A # at the start of a line comments it out. It is ignored. Unless there is a very large number of these and they really are getting in the way, do not delete these lines. They may come back into the application. They can also be used by the msgmerge program as a source for finding fuzzy translations. Leave them where they are.

翻訳する最初のパッケージの選択

Here are some factors which may help you decide what to translate first.

It is probably best to pick something very small the first time, in order to get used to the translation tools you are using. It is also useful to pick something which is an application rather than a library. This way, you will be able to run the application and see what it looks like. So a small stand-alone application is a good choice.

Unless you are running GNOME built from Git on your machine, you are likely to have the most recent stable release on it. Therefore, it is a good idea to translate the appropriate version of the application. So if you have bug-buddy-2.26 on your machine, use the 2.26 branch of the bug-buddy module in Git (in most cases the branch is called "gnome-2-26"). If you use a different version, some of the strings will have changed, and when you test it, you won't see all of your translations.

As soon as you test your application in its new language, you will almost certainly notice that common buttons and dialogue buttons are still in English. This is because they come from some of the libraries and are reused all over GNOME. To get those into your language, you will need to look at GTK+, gvfs, glib and gnome-desktop. These files contain some very difficult strings, but you do not need to do them all yet. Just look for the strings which consistently show up in dialogue boxes. This will help immensely.

The GTK+ package is part of a grouping called “GNOME developer platform”. It contains about half of the strings in that group. Once you have translated gtk+ you will see a huge jump in your statistics. When you view the statistics page for your language, the package is called “GKT+, UI Translations”. If your time is very limited, you may consider leaving untranslated those messages that you find unfamiliar (error messages, properties, etc). The GTK+ "stock" translations are used in many applications, and will give you good motivation with minimal work at the start. An example of these “stock” messages (stock: they are reused in many applications) are things like “OK”, “Cancel”, “Open”, “Save”, “Print”, “Warning”, “Undo”, “Preferences” that are used in many applications.

An additional important package is “gnome-menus”. It includes the basic categories that you can see in the Applications system menu, including the “Applications” itself, “Accessories”, “Internet”, “Graphics”, “Office” and so on.

Another very useful and small file to translate is xdg-user-dirs which is outside the GNOME project. This package contains common directories like "Videos", "Pictures", "Documents" etc. It can have a big impact with a small amount of work.

Some strings used in the Epiphany web browser come from Mozilla. So even when you have completed Epiphany, you may occasionally meet messages supplied by Mozilla which are not translated. If there is a Mozilla Language Pack for your language, you won't notice this. If there isn't, there is not a lot you can do about it. (You can persuade a friend that they want to translate Mozilla, of course..)

翻訳する最後のパッケージの選択

Note that the libraries libgnome, libgnomeui, libbonobo, libbonoboui, libgnomeprint, libgnomeprintui, gnome-vfs and libglade are deprecated. They are still shipped in GNOME 2.x and used by a few applications, but newly written code should use the existing replacements instead. The listed libraries will be removed for GNOME 3 which is planned for the year 2010 hence you should give these modules a low priority.

Also the so-called "Development tools" are modules that are needed by software developers only and not by average users. Software developers are often able to speak English hence you should give these modules a low priority.

インストール

If you have a reasonably up-to-date version of GNOME on a computer to which you have root access, you can test your translations on your machine and view them in context. This is strongly to be recommended. The machine will need a message object (.mo) file which you can create with the msgfmt -cv command. Run that on your po file, and you will find a file called messages.mo in the directory. This should be placed in the /usr/share/locale/XX/LC_MESSAGES/ directory (where XX is the code for your locale) and given the name of the program. Examples might be metacity.mo or nautilus.mo. Sometimes the program name requires a version number on it. Unfortunately, there is no easy way to work out what the name of the .mo should be for a given package. You will need to look at already-existing filenames in a sister directory to see what they use and copy those. Have a look around the different locales in /usr/share/locale/ and you should find good examples to copy.

Then run the application. Changing the .mo file will probably cause the application to crash, so save your work first; and if you are putting a gnome-terminal.mo there, make sure you are ready for the crash :) Once the file is in place, the app will be fine. It's just the act of updating the file which can cause problems.

The locale needs to exist

The above will only work if the locale exists on your computer. If it does not, you will need to create it. This is simplest on Debian: there is a command for it. The procedure varies on other distributions, unfortunately, and is well outside the scope of this document. Patches are welcome. :)

Once you have figured out how to install your translations onto a machine, pass the instructions out far and wide to people who might be interested in testing them out. Other people always spot more mistakes than you can. They may also be inspired to help!

テスト

Once you have large parts of your desktop completed, testing becomes vital. This is where you start realising that one of you has used one word for “install” and someone else has used another; or that that word “body” was referring to something other than a human body.

The more testing you can do, or persuade your friends to do, the better.

エディタとその技

A number of editors have special modes for editing .po files, and will drop you into the appropriate mode automatically.

Ensure that your editor is writing in UTF-8 format. If the file is not this format, things in GNOME Git will break.

Editors known to deal with UTF-8 well: Emacs Vim GEdit

For vim, things we have found useful to put into .vimrc are:

set fileencodings=utf-8
" A vim macro that makes control-E copy the msgid to the msgstr:
map <C-E> :s/msgid "\(.*\)"\nmsgstr ""/msgid "\1"<C-V><CR>msgstr "\1"/<CR>

There is a plugin for editing .po files in vim which has several other useful tricks. It is available on the Vim website as, unsurprisingly, po.vim

GNU-Emacs has an entire PO mode.

There is a program called gtranslator which helps you translate applications and which is specifically designed for translating GNOME.

Other people are welcome to fill in more tricks for editors, ideally as dotfile instructions.

その他のヒント

There are some things we have learned from bitter experience, and we are including them here so other people don't do it.

用語集

Git

I18N

L10N

locale

A. Special characters in po files, and one special string

There is a separate appendix about C-format strings. Here is a list of other characters and situations which can cause problems.

Escape-able characters

Formatting marks

Angle brackets and ampersands in GConf files

TRUE and FALSE

There is also one very special string in the .po file: the msgid of translator_credits. This will show up when someone running the application in your language looks at the credits by following the Help->About path in the application. They will see a Translation option. In that will be the contents of this translator_credits. This is where you put your name(s), so the world can see. The typical format is to put a list of names and email addresses on separate lines, with the URL of any team page. For example:

msgid "translator_credits"
msgstr
"Telsa Gwynne <hobbit@aloss.ukuug.org.uk>\n"
"Dafydd Harries <daf@muse.19inch.net>"

Don't forget to do this one :)

B. Some C-format strings to leave alone — or to re-order

This is a brief list of C-format strings you may need to know about.

%s

    #: components/emblem/nautilus-emblem-view.c:834
    #, c-format
    msgid "The file '%s' does not appear to be a valid image."
    msgstr ""

Strings containing such C-format sequnces are marked with the "c-format" tag, like in the example. Be aware that where there are two instances of one of these, they are not necessarily the same string. Another nautilus example:

#: components/hardware/nautilus-hardware-view.c:483
#, c-format
msgid "Uptime is %d days, %d hours, %d minutes"
msgstr ""

If you need to re-arrange them to make them make sense, you can do that. In English, this is common:

#, c-format
msgid "%d out of %d"

This might come out as “10 out of 100”. If your language wants to say “Out of 100, 10”, you can reverse them like this:

#, c-format
msgid "%d out of %d"
msgstr "Out of  %2$d, %1$d"

Original Authors

This guide was originally written by:

Telsa Gwynne

Dafydd Harries

License

This document can be redistributed and/or modified under the terms of the GNU General Public License; either version 2 of the license, or (at your option) any later version. The full text of the license can be found at http://www.gnu.org/copyleft/gpl.html.

Translations

原文(English) Localising GNOME Applications

中文(Chinese) 本地化GNOME应用程序


CategoryGnomeI18n


2024-10-23 11:49