原始文献 / 论坛帖 / Re: Bitcoin client and website translation

Re: Bitcoin client and website translation

Bitcointalk · 2010-02-17 19:19:43 UTC

AuthorSatoshi Nakamoto
TitleRe: Bitcoin client and website translation
Date2010-02-17 19:19:43 UTC
ForumBitcointalk · 原文

我更新了 SVN,加了支持翻译的改动。可翻译的字符串都包在 _("") 里,所有平台都用 UTF-8。

程序运行时,会在 EXE 所在目录找这个文件:locale\<langcode>\LC_MESSAGES\bitcoin.mo

<langcode> 是你的系统语言的两位代码,比如"de"或"nl"。

Linux 上还会找:
/usr/share/locale/<langcode>/LC_MESSAGES/bitcoin.mo
/usr/local/share/locale/<langcode>/LC_MESSAGES/bitcoin.mo
(linux 上还有别的标准位置该找吗?)

用 poedit 做 .po 和 .mo 文件的快速步骤:

- 从 SVN 下载比特币源码
- 在 trunk 目录建 locale\<lang>\LC_MESSAGES
- poedit 里,文件->新建目录->路径页
- 点"新建条目"的虚线矩形按钮
- 填"../../..",一定要按回车确认添加路径
- 点确定
- 把文件存为 LC_MESSAGES 目录下的"bitcoin.po"
- 它会扫描源码,找到约 170 个字符串
- 如果什么都没找到,检查目录->设置->路径页,确认"../../.."加上了

翻译完后,把 bitcoin.po(可编辑的目录文件)和 bitcoin.mo(程序用的编译数据)都提交。

英文原文

I updated the SVN with changes to support translation.  Translatable strings are all enclosed in _(""), and we're using UTF-8 on all platforms.

When the program runs, it looks in the directory of the EXE for the file: locale\<langcode>\LC_MESSAGES\bitcoin.mo

<langcode> is the two letter code of the language your OS is set to, like "de" or "nl".

On Linux, it also looks for:
/usr/share/locale/<langcode>/LC_MESSAGES/bitcoin.mo
/usr/local/share/locale/<langcode>/LC_MESSAGES/bitcoin.mo
(are there other standard places it should look on linux?)

Here's a quick walkthrough using poedit to make a .po and .mo file:

- Download the bitcoin sourcecode from SVN
- In the trunk directory, mkdir locale\<lang>\LC_MESSAGES
- In poedit, File->New catalog->Paths tab
- Click the "New item" dotted rectangle button
- Put "../../.." and MAKE SURE TO PRESS ENTER to add the path
- Click OK
- Save the file as "bitcoin.po" in the LC_MESSAGES directory you made
- It should then scan the sourcecode and find about 170 strings
- If it didn't find anything, check Catalog->Settings->Path tab, make sure the "../../.." was added

When you're done translating, commit both bitcoin.po (the editable catalog file) and bitcoin.mo (compiled data used by the program).