久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

Gallery: 本地化:修訂間差異

來(lái)自站長(zhǎng)百科
跳轉(zhuǎn)至: 導(dǎo)航、? 搜索
Gallery:Localization移動(dòng)到Gallery:本地化
無(wú)編輯摘要
第1行: 第1行:
= Localizing Gallery 2 =
= Gallery2的本地化 =


== Overview ==
== 綜述 ==


Gallery is internationalized.? Instead of containing language specific
Gallery是國(guó)際化的。不對(duì)特定語(yǔ)言文本消息的包含,
text messages, it tracks text in a special way so that it can be
取而代之地,它使用特殊的方法追蹤文本
extracted and translated into other languages.? Users will see a
以進(jìn)行抽取并翻譯成其他語(yǔ)言。用戶則會(huì)看見
version of the text that has been converted into their own language.
文本被翻譯成他們使用的語(yǔ)言版本。


In order for the users to see a localized version of Gallery's text,
為了能夠讓用戶看到Gallery文本的本地化版本,
somebody must first translate the text messages that Gallery is going
就需要先將這些Gallery要顯示的文本消息進(jìn)行
to display.? This process is called "localization".
翻譯。此過(guò)程就被稱為"本地化"。


Here we try to outline how you can create and maintain localization
這里我們嘗試說(shuō)明一下如何創(chuàng)建并維護(hù)G2中本地化
files for the content in G2.? It's not a particularly difficult thing
文件的內(nèi)容。這并不是特別困難的任務(wù),
to do but it requires us to keep the various files up to date whenever
但要求無(wú)論何時(shí)基礎(chǔ)內(nèi)容有改變,我們都要保證
the underlying content changes.? Luckily we have tools that will aid
各類文件的更新度。我們挺幸運(yùn)的,因?yàn)橛羞@樣的工具能
in this process.
協(xié)助我們完成此類操作過(guò)程。


== Requirements ==
== 要求 ==


In order to really do this effectively, you need to have a few tools
為了能夠有效率地進(jìn)行,你需要在計(jì)算機(jī)上
installed on your machine.? I've only tested this process on a FreeBSD
安裝一些工具。我僅在FreeBSD
box, but my guess is that you won't have too much difficulty on Linux,
box中做了測(cè)試,但我想如果用在Linux,Solaris或其他Unix類系統(tǒng)
Solaris, or other Unix variants.? You may have difficulties following
上也不會(huì)太麻煩。在Windows上可能會(huì)有些難度,
along on Windows, but it should be possible.
但也是有可能實(shí)現(xiàn)的。
The following should be installed and in your PATH:
以下為必須安裝,并在你的路徑中:


; gettext : http://www.gnu.org/software/gettext/
; gettext : http://www.gnu.org/software/gettext/
; gmake (or make): http://www.gnu.org/software/make/make.html
; gmake (或make): http://www.gnu.org/software/make/make.html
; php binary : http://php.net
; php二進(jìn)制: http://php.net
; perl : http://perl.com
; perl : http://perl.com


'''Note''': if you're using FreeBSD then you want to use ''gmake'' instead of ''make'' since FreeBSD's default make is not GNU compatible.
'''''':如果你使用FreeBSD,并希望能取代''make''而使用''gmake'',因?yàn)镕reeBSD的默認(rèn)不與GNU兼容。


You also need the current G2 files to create up-to-date translations.? It is best to work from current SVN or a nightly snapshot.? The developer version of the latest G2 release will also work, but some of the strings for translation may be out of date.
你還需要用當(dāng)前G2文件創(chuàng)建最新的翻譯。就目前的SVN或nightly快照版的運(yùn)行情況都不錯(cuò)。最新的G2開發(fā)者版本也能運(yùn)行,但某些翻譯的字串可能有些過(guò)時(shí)了。


== Creating a new localization ==
== 本地化的新建 ==


Look around the Gallery distribution and you'll find a bunch of directories called "po".? ("po" is a gettext term that stands for "portable object").? Here's one way to find them:
瀏覽一下Gallery就能發(fā)現(xiàn)不少名為"po"的目錄。("po"是一gettext術(shù)語(yǔ),即"可移植對(duì)象(portable object)")。以下為找到它們的一個(gè)方法:


<pre>
<pre>
find . -type d -name po <-- you type this
find . -type d -name po <-- 輸入這個(gè)


./themes/matrix/po ? ? ? ? ? <-- you see this
./themes/matrix/po ? ? ? ? ? <-- 會(huì)看到這個(gè)
./lib/tools/po
./lib/tools/po
./modules/core/po
./modules/core/po
第49行: 第49行:
./modules/netpbm/po
./modules/netpbm/po


** Ignore the "lib/tools/po" directory.
** 忽略"lib/tools/po"目錄。
</pre>
</pre>


These directories contain translation source files.? You're going to
這些目錄還有翻譯源文件。你要
create new files with an appropriate language code, and then fill them
使用合適的語(yǔ)言代碼來(lái)新建文件,接著在它們之中
with translated text.? The first thing to do is to identify the
添入經(jīng)過(guò)翻譯的文本。首先要做的就是從
correct codes from the following two tables:
下面的兩個(gè)表格中識(shí)別出正確的代碼:


; Language codes:
; 語(yǔ)言代碼:
: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC221
: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC221
: (or http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt)
: (or http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt)


; Country codes:
; 國(guó)家代碼:
: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC222
: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC222
: (or http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html)
: (or http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html)
第77行: 第77行:
This will find all text that is marked for localization ([[Gallery2:Tpl_Reference#Gallery_Custom_Tags|{g->text}]] in tpl files, translate() or i18n() in php code) and create a po file that is ready to be translated.
This will find all text that is marked for localization ([[Gallery2:Tpl_Reference#Gallery_Custom_Tags|{g->text}]] in tpl files, translate() or i18n() in php code) and create a po file that is ready to be translated.


A word about text editors.
有關(guān)文本編輯器。
* There are several tools to work with .po files:
* 有一些工具可以處理.po文件:
** [http://poedit.sourceforge.net/ poEdit] (Multiplatform)
** [http://poedit.sourceforge.net/ poEdit](多平臺(tái))
** [http://i18n.kde.org/tools/kbabel/ KBabel] (Unix KDE)
** [http://i18n.kde.org/tools/kbabel/ KBabel](Unix KDE)
** [http://gtranslator.sourceforge.net/ GTranslator] (Unix Gnome)
** [http://gtranslator.sourceforge.net/ GTranslator](Unix Gnome)
** [http://www.gnu.org/software/emacs/emacs.html Emacs with po-mode] (Multiplatform)
** [http://www.gnu.org/software/emacs/emacs.html Emacs with po-mode](多平臺(tái))
** [http://www.vim.org/ Vim] with [http://www.vim.org/scripts/script.php?script_id=695 PO plug-in] (Multiplatform)
** [http://www.vim.org/ Vim] with [http://www.vim.org/scripts/script.php?script_id=695 PO plug-in](多平臺(tái))
I personally am a fan of XEmacs so I'll be
我比較喜歡用XEmacs,因此我會(huì)
talking about XEmacs in my examples below.? If you have instructions for
在下面的例子中拿XEmacs做例子。如果你有其他編輯器
other editors, please contribute them.? XEmacs has a major mode called "po-mode" which, if you have it installed, you'll automatically wind up
的使用指導(dǎo),請(qǐng)分享一下。XEmacs的主要模式被稱為"po-模式",如果你安裝了它,在編輯.po文件時(shí)就會(huì)
in if you edit a .po file.? I'm not going to go into it here, but try
自動(dòng)轉(zhuǎn)入。我在這里不準(zhǔn)備這么做,但
it out if you have it.
你可以嘗試一下。


Now edit de.po.? It should have the Gallery license at the top.? You'll need to customize these values:
現(xiàn)在我們來(lái)編輯de.po。在其頂部應(yīng)有Gallery的證書。你需要對(duì)以下值做自定義:


; Last-Translator
; Last-Translator
: Put your name and email here in the format: "FirstName LastName &lt;email@address&gt;"
:將你的名字及email以此格式輸入:"FirstName LastName &lt;email@address&gt;"
; Language-Team
; Language-Team
: Put in the language and the -translations mailing list, eg: "German &lt;gallery-translations@lists.sourceforge.net&gt;"
: 輸入語(yǔ)言及-翻譯郵件列表,如"German &lt;gallery-translations@lists.sourceforge.net&gt;"
; Content-Type
; Content-Type
: Set this to "Content-Type: text/plain; charset=UTF-8\n"
: 將此設(shè)置給"Content-Type:text/plain; charset=UTF-8\n"
: We want you to use the UTF-8 character set because it allows us to render multiple languages on the same page which is nice for sites in one language that have user comments, etc in other languages.
: 我們希望你使用UTF-8字符集。因?yàn)樗试S我們?cè)谕豁?yè)面上對(duì)多個(gè)語(yǔ)言進(jìn)行渲染,這對(duì)某一語(yǔ)言站點(diǎn)頁(yè)面上其他語(yǔ)言的用戶評(píng)論是有好處的。


Here's an example of a complete header from [http://cvs.sourceforge.net/viewcvs.py/gallery/gallery2/modules/core/po/de.po?rev=1.13&view=auto modules/core/po/de.po].? Note how the authors have maintained the list of all previous translators as a courtesy.
這里有[http://cvs.sourceforge.net/viewcvs.py/gallery/gallery2/modules/core/po/de.po?rev=1.13&view=auto modules/core/po/de.po]的完整的header樣例。注意編寫者是如何維護(hù)前任翻譯者名單的。
<pre>
<pre>
# Previous translators (as far as known, add yourself here, please):
# 前任翻譯者(迄今所知,如有脫漏,請(qǐng)?jiān)诖颂砑樱?/ins>
# - Jens Tkotz <jens@peino.de>
# - Jens Tkotz <jens@peino.de>
# - Ernesto Baschny <ernst@baschny.de>
# - Ernesto Baschny <ernst@baschny.de>
第120行: 第120行:
</pre>
</pre>


If your language doesn't have plural form like in Chinese or Turkish, you need to change the following line too:
如果你的語(yǔ)言中不包含復(fù)數(shù)詞用法,如漢語(yǔ)或土耳其語(yǔ),就得修改以下語(yǔ)句:


<pre>
<pre>
第126行: 第126行:
?? ? -> Change to "Plural-Forms: nplurals=1; plural=0;\n".
?? ? -> Change to "Plural-Forms: nplurals=1; plural=0;\n".
</pre>
</pre>
In this case, you need to translate only msgstr[0] and comment out or remove msgstr[1].
這樣,你只需翻譯msgstr[0]并注釋掉或移除msgstr [1].


Then, look at the lines just below the Gallery license:
接著來(lái)看看Gallery證書下的語(yǔ)句行:


<pre>
<pre>
第136行: 第136行:
</pre>
</pre>


The fuzzy keyword tells you that the translation of the block is
模糊的關(guān)鍵詞告知你區(qū)塊的翻譯
incomplete. But once that you update the administration entries, you
不完整。但一旦更新了administration entry,就
can remove the "#, fuzzy" line to allow the translation to compile
可以移除"#, fuzzy"這一行以允許稍后翻譯的
later on.
編譯。


Next, you'll see a series of blocks like this:
接下來(lái)你會(huì)看到一系列區(qū)塊:


<pre>
<pre>
#, c-format (<-- you'll only see this on some lines)
#, c-format (<-- 在某些語(yǔ)句行中僅能看到這個(gè))
msgid "a message in english, with %d or %s tags in it"
msgid "a message in english, with %d or %s tags in it"
msgstr ""
msgstr ""
</pre>
</pre>


You need to put the translation for the English message into the
你需要將英語(yǔ)消息的翻譯置入
msgstr block, between the quotes, for example:
msgstr區(qū)塊中,用引號(hào)括起來(lái),例如:


<pre>
<pre>
第158行: 第158行:
</pre>
</pre>


Some msgid values contain hints to assist in translation:
某些msgid值含有有助于進(jìn)行翻譯的提示信息:


<pre>
<pre>
第165行: 第165行:
msgstr "F"
msgstr "F"
</pre>
</pre>
Note that the hint should not be translated or included in the msgstr text.? You can request the addition of hint text for particular strings with the [http://sourceforge.net/tracker/?func=browse&group_id=7130&atid=582564 Translations Tracker].? Specify the module/theme and the msgid.? Note that the <tt>strings.raw</tt> file lists the file(s) where each msgid is used.
注意提示內(nèi)容不應(yīng)翻譯或包括在msgstr文本中。你可以使用[http://sourceforge.net/tracker/?func=browse&group_id=7130&atid=582564 翻譯追蹤器(Translations Tracker)]為特殊字串請(qǐng)求額外的提示文本。指定模塊/外觀主題以及msgid。注意<tt>strings.raw</tt>文件列出了用到msgid的文件。


You really, really, really should put your editor into UTF-8 mode
在編輯這些消息之前,你確實(shí)應(yīng)當(dāng)將編輯器設(shè)為UTF-8模式,
before editing these messages so that your editor can use the right
這樣編輯器才能使用正確的字符集。
character set.? If you can't edit in UTF-8 for some reason, consider
如果你由于某種原因無(wú)法在UTF-8模式中進(jìn)行編輯,
using the GNU "recode" program to convert your translation to UTF-8
請(qǐng)考慮使用GNU的"recode"程序,在提交翻譯內(nèi)容給我們之前,
before submitting it to us (or just send it anyway and we'll recode
將其轉(zhuǎn)為UTF-8(或者直接發(fā)給我們也許,我們會(huì)進(jìn)行重新編碼)。
it).


If you're using XEmacs with MULE (its MULtilanguagE support) you can
如果你使用XEmacs的MULE(即多語(yǔ)言支持(MULtilanguagE)),你可以將一下內(nèi)容添加到
add the following to your ~/.xemacs/init.el
~/.xemacs/init.el中去


<pre>
<pre>
第185行: 第184行:
</pre>
</pre>


Then when you edit a file that is in UTF-8, it'll have a little "u"
當(dāng)你編輯UTF-8的文件時(shí),會(huì)有一些"u"
in left side of the status bar at the bottom of the screen.? Try it
出現(xiàn)在屏幕底部狀態(tài)條左側(cè)。使用現(xiàn)有的
out with an existing .po file to see what it looks like.
.po文件來(lái)看一看。


After doing a few translations, try it out to see how it looks.? Run:
在進(jìn)行一些翻譯之后,來(lái)看看效果。運(yùn)行:


<pre>
<pre>
第195行: 第194行:
</pre>
</pre>


And it will compile your .po file into a .mo file and install it in the appropriate place for the module. Repeat this for every directory where you modified a .po file.? If you get errors about creating the locale directory then try creating the directory structure before running make (example: modules/mymodule/locale/de/LC_MESSAGES).
它會(huì)將你的.po文件編譯到一個(gè).mo文件中,并將其安裝到合適的位置。在修改.po文件之后,對(duì)各目錄都要重復(fù)此步驟。如果你在創(chuàng)建locale目錄時(shí)發(fā)生錯(cuò)誤,請(qǐng)?jiān)谶\(yùn)行make之前建立目錄結(jié)構(gòu)(如:modules/mymodule/locale/de/LC_MESSAGES)。


Finally, you need to edit modules/core/classes/GalleryTranslator.class and in function getLanguageData, add lines like this:
最后,你需要編輯modules/core/classes/GalleryTranslator.class,并在函數(shù)getLanguageData中加入如下語(yǔ)句:


<pre>
<pre>
第204行: 第203行:
$defaultCountry['de'] = 'DE';
$defaultCountry['de'] = 'DE';
</pre>
</pre>
The comment should be the name of the language in English; the language
批注應(yīng)為該語(yǔ)言的英語(yǔ)說(shuō)法;語(yǔ)言
'description' is the name of the language in that language.
'描述'則應(yīng)是該語(yǔ)言的本土說(shuō)法。


Now, log onto G2 and in the User preferences (you may need to edit the
Now, log onto G2 and in the User preferences (you may need to edit the
第215行: 第214行:
'''Note:''' If the language change doesn't take effect, please review the precedence of the [[Gallery2:Language_Settings|language settings]] (Session language > user preferences > site wide default language). In doubt, use the language block or toggle the language in your user preferences back and forth.
'''Note:''' If the language change doesn't take effect, please review the precedence of the [[Gallery2:Language_Settings|language settings]] (Session language > user preferences > site wide default language). In doubt, use the language block or toggle the language in your user preferences back and forth.


== Submitting your localization ==
== 本地化的提交 ==


Now that you've got your localization created, you need to package
Now that you've got your localization created, you need to package
第235行: 第234行:
get committed within a few days, jump on IRC (see [[#Where_to_go_for_help!|help section]]) and talk to us about it.
get committed within a few days, jump on IRC (see [[#Where_to_go_for_help!|help section]]) and talk to us about it.


== Maintaining a localization ==
== 本地化的維護(hù) ==


<pre>
<pre>
第273行: 第272行:
See the [[#Creating_a_new_localization|Creating a new localization]] section for testing info, and submit the new files to us.
See the [[#Creating_a_new_localization|Creating a new localization]] section for testing info, and submit the new files to us.


== Where to go for help! ==
== 何處尋求幫助?==


If you need help, there are three places to go:
If you need help, there are three places to go:
第286行: 第285行:
: #gallery on irc://chat.freenode.net
: #gallery on irc://chat.freenode.net


== List of Translations ==
== 翻譯列表 ==
All available Gallery 2 translations, listed alphabetically along with the maintainers / translators. Some translations are 100% up to date and complete, others are only 2% complete or out of date. See: [http://gallery.menalto.com/localization/gallery2 Localization Report]. If you have the developer package of G2, you can run {{exampleurl|/lib/tools/reports/localization.php}} to see the status of all installed translations.
All available Gallery 2 translations, listed alphabetically along with the maintainers / translators. Some translations are 100% up to date and complete, others are only 2% complete or out of date. See: [http://gallery.menalto.com/localization/gallery2 Localization Report]. If you have the developer package of G2, you can run {{exampleurl|/lib/tools/reports/localization.php}} to see the status of all installed translations.



2008年10月24日 (五) 17:17的版本

Gallery2的本地化

綜述

Gallery是國(guó)際化的。不對(duì)特定語(yǔ)言文本消息的包含, 取而代之地,它使用特殊的方法追蹤文本 以進(jìn)行抽取并翻譯成其他語(yǔ)言。用戶則會(huì)看見 文本被翻譯成他們使用的語(yǔ)言版本。

為了能夠讓用戶看到Gallery文本的本地化版本, 就需要先將這些Gallery要顯示的文本消息進(jìn)行 翻譯。此過(guò)程就被稱為"本地化"。

這里我們嘗試說(shuō)明一下如何創(chuàng)建并維護(hù)G2中本地化 文件的內(nèi)容。這并不是特別困難的任務(wù), 但要求無(wú)論何時(shí)基礎(chǔ)內(nèi)容有改變,我們都要保證 各類文件的更新度。我們挺幸運(yùn)的,因?yàn)橛羞@樣的工具能 協(xié)助我們完成此類操作過(guò)程。

要求

為了能夠有效率地進(jìn)行,你需要在計(jì)算機(jī)上 安裝一些工具。我僅在FreeBSD box中做了測(cè)試,但我想如果用在Linux,Solaris或其他Unix類系統(tǒng) 上也不會(huì)太麻煩。在Windows上可能會(huì)有些難度, 但也是有可能實(shí)現(xiàn)的。 以下為必須安裝,并在你的路徑中:

gettext
http://www.gnu.org/software/gettext/
gmake (或make)
http://www.gnu.org/software/make/make.html
php二進(jìn)制
http://php.net
perl
http://perl.com

:如果你使用FreeBSD,并希望能取代make而使用gmake,因?yàn)镕reeBSD的默認(rèn)不與GNU兼容。

你還需要用當(dāng)前G2文件創(chuàng)建最新的翻譯。就目前的SVN或nightly快照版的運(yùn)行情況都不錯(cuò)。最新的G2開發(fā)者版本也能運(yùn)行,但某些翻譯的字串可能有些過(guò)時(shí)了。

本地化的新建

瀏覽一下Gallery就能發(fā)現(xiàn)不少名為"po"的目錄。("po"是一gettext術(shù)語(yǔ),即"可移植對(duì)象(portable object)")。以下為找到它們的一個(gè)方法:

find . -type d -name po			<-- 輸入這個(gè)

./themes/matrix/po	          	<-- 會(huì)看到這個(gè)
./lib/tools/po
./modules/core/po
./modules/comment/po
./modules/netpbm/po

** 忽略"lib/tools/po"目錄。

這些目錄還有翻譯源文件。你要 使用合適的語(yǔ)言代碼來(lái)新建文件,接著在它們之中 添入經(jīng)過(guò)翻譯的文本。首先要做的就是從 下面的兩個(gè)表格中識(shí)別出正確的代碼:

語(yǔ)言代碼
http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC221
(or http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt)
國(guó)家代碼
http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC222
(or http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html)

In most cases you will need just the language code, such as "de" for German. To provide country specific translations for a language used in multiple countries you can use a code in the format xx_XX, such as "pt_BR" for Portuguese/Brazil. If you are unsure which to use, include both language and country. If you find a translation for your language already exists then move on to Maintaining a localization.

Once you've chosen the code, you need to create a new .po file for your code. Let's assume that you chose "de". For each po directory, you need to do this:

make de.po

This will find all text that is marked for localization ({g->text} in tpl files, translate() or i18n() in php code) and create a po file that is ready to be translated.

有關(guān)文本編輯器。

我比較喜歡用XEmacs,因此我會(huì) 在下面的例子中拿XEmacs做例子。如果你有其他編輯器 的使用指導(dǎo),請(qǐng)分享一下。XEmacs的主要模式被稱為"po-模式",如果你安裝了它,在編輯.po文件時(shí)就會(huì) 自動(dòng)轉(zhuǎn)入。我在這里不準(zhǔn)備這么做,但 你可以嘗試一下。

現(xiàn)在我們來(lái)編輯de.po。在其頂部應(yīng)有Gallery的證書。你需要對(duì)以下值做自定義:

Last-Translator
將你的名字及email以此格式輸入:"FirstName LastName <email@address>"
Language-Team
輸入語(yǔ)言及-翻譯郵件列表,如"German <gallery-translations@lists.sourceforge.net>"
Content-Type
將此設(shè)置給"Content-Type:text/plain; charset=UTF-8\n"
我們希望你使用UTF-8字符集。因?yàn)樗试S我們?cè)谕豁?yè)面上對(duì)多個(gè)語(yǔ)言進(jìn)行渲染,這對(duì)某一語(yǔ)言站點(diǎn)頁(yè)面上其他語(yǔ)言的用戶評(píng)論是有好處的。

這里有modules/core/po/de.po的完整的header樣例。注意編寫者是如何維護(hù)前任翻譯者名單的。

# 前任翻譯者(迄今所知,如有脫漏,請(qǐng)?jiān)诖颂砑樱?# - Jens Tkotz <jens@peino.de>
# - Ernesto Baschny <ernst@baschny.de>
...
#
msgid ""
msgstr ""
"Project-Id-Version: Gallery: Core 1.0.32\n"
"POT-Creation-Date: 2003-02-11 03:09-0800\n"
"PO-Revision-Date: 2006-03-05 02:25+0000\n"
"Last-Translator: Frederik Kunz <frederik.kunz@web.de>\n"
"Language-Team: German <gallery-devel@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

如果你的語(yǔ)言中不包含復(fù)數(shù)詞用法,如漢語(yǔ)或土耳其語(yǔ),就得修改以下語(yǔ)句:

"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    -> Change to "Plural-Forms: nplurals=1; plural=0;\n".

這樣,你只需翻譯msgstr[0]并注釋掉或移除msgstr [1].

接著來(lái)看看Gallery證書下的語(yǔ)句行:

#, fuzzy
msgid ""
msgstr ""

模糊的關(guān)鍵詞告知你區(qū)塊的翻譯 不完整。但一旦更新了administration entry,就 可以移除"#, fuzzy"這一行以允許稍后翻譯的 編譯。

接下來(lái)你會(huì)看到一系列區(qū)塊:

#, c-format		(<-- 在某些語(yǔ)句行中僅能看到這個(gè))
msgid "a message in english, with %d or %s tags in it"
msgstr ""

你需要將英語(yǔ)消息的翻譯置入 msgstr區(qū)塊中,用引號(hào)括起來(lái),例如:

#, c-format
msgid "a message in english, with %d or %s tags in it"
msgstr "eine Anzeige auf englisch, mit %d oder %s etikettiert in ihr"

某些msgid值含有有助于進(jìn)行翻譯的提示信息:

#. HINT: Button label for Bold
msgid "B"
msgstr "F"

注意提示內(nèi)容不應(yīng)翻譯或包括在msgstr文本中。你可以使用翻譯追蹤器(Translations Tracker)為特殊字串請(qǐng)求額外的提示文本。指定模塊/外觀主題以及msgid。注意strings.raw文件列出了用到msgid的文件。

在編輯這些消息之前,你確實(shí)應(yīng)當(dāng)將編輯器設(shè)為UTF-8模式, 這樣編輯器才能使用正確的字符集。 如果你由于某種原因無(wú)法在UTF-8模式中進(jìn)行編輯, 請(qǐng)考慮使用GNU的"recode"程序,在提交翻譯內(nèi)容給我們之前, 將其轉(zhuǎn)為UTF-8(或者直接發(fā)給我們也許,我們會(huì)進(jìn)行重新編碼)。

如果你使用XEmacs的MULE(即多語(yǔ)言支持(MULtilanguagE)),你可以將一下內(nèi)容添加到 ~/.xemacs/init.el中去

; Enable Unicode support (via Mule-UCS)
;
(require 'un-define)
(set-coding-priority-list '(utf-8))
(set-coding-category-system 'utf-8 'utf-8)

當(dāng)你編輯UTF-8的文件時(shí),會(huì)有一些"u" 出現(xiàn)在屏幕底部狀態(tài)條左側(cè)。使用現(xiàn)有的 .po文件來(lái)看一看。

在進(jìn)行一些翻譯之后,來(lái)看看效果。運(yùn)行:

make install PO=de

它會(huì)將你的.po文件編譯到一個(gè).mo文件中,并將其安裝到合適的位置。在修改.po文件之后,對(duì)各目錄都要重復(fù)此步驟。如果你在創(chuàng)建locale目錄時(shí)發(fā)生錯(cuò)誤,請(qǐng)?jiān)谶\(yùn)行make之前建立目錄結(jié)構(gòu)(如:modules/mymodule/locale/de/LC_MESSAGES)。

最后,你需要編輯modules/core/classes/GalleryTranslator.class,并在函數(shù)getLanguageData中加入如下語(yǔ)句:

/* German */
$this->_supportedLanguages['de']['DE']['description'] = 'Deutsch';
$defaultCountry['de'] = 'DE';

批注應(yīng)為該語(yǔ)言的英語(yǔ)說(shuō)法;語(yǔ)言 '描述'則應(yīng)是該語(yǔ)言的本土說(shuō)法。

Now, log onto G2 and in the User preferences (you may need to edit the user via the Site Administrator) you should see German appear in the dropdown, and if you select it and log on as that user you'll see your translated messages. Alternatively, add the Language selector block to your site using Theme settings.

Note: If the language change doesn't take effect, please review the precedence of the language settings (Session language > user preferences > site wide default language). In doubt, use the language block or toggle the language in your user preferences back and forth.

本地化的提交

Now that you've got your localization created, you need to package it up and send it to us so that we can commit it into the repository. The best way to package it is like this:

cd gallery2
zip de.zip `find . -name de.po`

or:

cd gallery2
tar czf nl.tar.gz `find . -name nl.po`

This will make up a zipfile or tarball of just your translated files. Obviously, use your language code instead of de or nl above. Then, go to the Translations Tracker on the Gallery project page on SourceForge and click the "Submit New" button. Put your translation in the "Gallery 2" group and don't forget to attach the files (you must check the checkbox for attachment too!). If your translation doesn't get committed within a few days, jump on IRC (see help section) and talk to us about it.

本地化的維護(hù)

cd po
make de.po	(using German as an example)

This will extract all messages from the module that you're in and update the .po file. Look through the .po file for any blocks that have an empty msgstr, or are marked "fuzzy" and update them. After they are fixed, remove the fuzzy tag. You may find tags that look like this:

#, fuzzy
#~ msgid "User"
#~ msgstr "Gebruikersnaam"

The "#, fuzzy" means that its fuzzy, but the "#~" means that the string no longer exists in G2 (we probably deleted or changed it significantly). You can delete these entries.

You should do a quick check that gettext provides to validate your .po file:

msgfmt -v -c --stat de.po

When you've got everything right, run:

make install PO=de

The translation files get cached by PHP (which is why it's so fast) so you may not see change until you restart your web server. That's annoying, but I haven't figured a good workaround for it yet.

See the Creating a new localization section for testing info, and submit the new files to us.

何處尋求幫助?

If you need help, there are three places to go:

The Gallery translations forums
http://gallery.menalto.com/forum/74
The gallery-translations mailing list
http://codex.gallery2.org/index.php/Mailing_Lists
The Gallery IRC channel
#gallery on irc://chat.freenode.net

翻譯列表

All available Gallery 2 translations, listed alphabetically along with the maintainers / translators. Some translations are 100% up to date and complete, others are only 2% complete or out of date. See: Localization Report. If you have the developer package of G2, you can run http://www.example.com/gallery/lib/tools/reports/localization.php to see the status of all installed translations.