WIKI使用導(dǎo)航
站長(zhǎng)百科導(dǎo)航
站長(zhǎng)專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機(jī)
- cPanel
- 網(wǎng)址導(dǎo)航專題
- 云計(jì)算
- 微博營(yíng)銷
- 虛擬主機(jī)管理系統(tǒng)
- 開放平臺(tái)
- WIKI程序與應(yīng)用
- 美國(guó)十大主機(jī)
Gallery: 本地化:修訂間差異
Firebrance(討論 | 貢獻(xiàn)) 小 (Gallery:Localization移動(dòng)到Gallery:本地化) |
Firebrance(討論 | 貢獻(xiàn)) 無(wú)編輯摘要 |
||
第1行: | 第1行: | ||
= | = 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/ | ; gettext : http://www.gnu.org/software/gettext/ | ||
; gmake | ; gmake (或make): http://www.gnu.org/software/make/make.html | ||
; | ; php二進(jìn)制: http://php.net | ||
; perl : http://perl.com | ; 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è)方法: | |||
<pre> | <pre> | ||
find . -type d -name po <-- | find . -type d -name po <-- 輸入這個(gè) | ||
./themes/matrix/po ? ? ? ? ? <-- | ./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 | ||
** | ** 忽略"lib/tools/po"目錄。 | ||
</pre> | </pre> | ||
這些目錄還有翻譯源文件。你要 | |||
使用合適的語(yǔ)言代碼來(lái)新建文件,接著在它們之中 | |||
添入經(jīng)過(guò)翻譯的文本。首先要做的就是從 | |||
下面的兩個(gè)表格中識(shí)別出正確的代碼: | |||
; | ; 語(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) | ||
; | ; 國(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. | ||
有關(guān)文本編輯器。 | |||
* | * 有一些工具可以處理.po文件: | ||
** [http://poedit.sourceforge.net/ poEdit] | ** [http://poedit.sourceforge.net/ poEdit](多平臺(tái)) | ||
** [http://i18n.kde.org/tools/kbabel/ KBabel] | ** [http://i18n.kde.org/tools/kbabel/ KBabel](Unix KDE) | ||
** [http://gtranslator.sourceforge.net/ GTranslator] | ** [http://gtranslator.sourceforge.net/ GTranslator](Unix Gnome) | ||
** [http://www.gnu.org/software/emacs/emacs.html Emacs with po-mode] | ** [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] | ** [http://www.vim.org/ Vim] with [http://www.vim.org/scripts/script.php?script_id=695 PO plug-in](多平臺(tái)) | ||
我比較喜歡用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 | ; Last-Translator | ||
: | :將你的名字及email以此格式輸入:"FirstName LastName <email@address>" | ||
; Language-Team | ; Language-Team | ||
: | : 輸入語(yǔ)言及-翻譯郵件列表,如"German <gallery-translations@lists.sourceforge.net>" | ||
; Content-Type | ; 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)論是有好處的。 | ||
這里有[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> | ||
# | # 前任翻譯者(迄今所知,如有脫漏,請(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> | ||
如果你的語(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> | ||
這樣,你只需翻譯msgstr[0]并注釋掉或移除msgstr [1]. | |||
接著來(lái)看看Gallery證書下的語(yǔ)句行: | |||
<pre> | <pre> | ||
第136行: | 第136行: | ||
</pre> | </pre> | ||
模糊的關(guān)鍵詞告知你區(qū)塊的翻譯 | |||
不完整。但一旦更新了administration entry,就 | |||
可以移除"#, fuzzy"這一行以允許稍后翻譯的 | |||
編譯。 | |||
接下來(lái)你會(huì)看到一系列區(qū)塊: | |||
<pre> | <pre> | ||
#, c-format (<-- | #, 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> | ||
你需要將英語(yǔ)消息的翻譯置入 | |||
msgstr區(qū)塊中,用引號(hào)括起來(lái),例如: | |||
<pre> | <pre> | ||
第158行: | 第158行: | ||
</pre> | </pre> | ||
某些msgid值含有有助于進(jìn)行翻譯的提示信息: | |||
<pre> | <pre> | ||
第165行: | 第165行: | ||
msgstr "F" | msgstr "F" | ||
</pre> | </pre> | ||
注意提示內(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的文件。 | |||
在編輯這些消息之前,你確實(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中去 | |||
<pre> | <pre> | ||
第185行: | 第184行: | ||
</pre> | </pre> | ||
當(dāng)你編輯UTF-8的文件時(shí),會(huì)有一些"u" | |||
出現(xiàn)在屏幕底部狀態(tài)條左側(cè)。使用現(xiàn)有的 | |||
.po文件來(lái)看一看。 | |||
在進(jìn)行一些翻譯之后,來(lái)看看效果。運(yùn)行: | |||
<pre> | <pre> | ||
第195行: | 第194行: | ||
</pre> | </pre> | ||
它會(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ǔ)句: | |||
<pre> | <pre> | ||
第204行: | 第203行: | ||
$defaultCountry['de'] = 'DE'; | $defaultCountry['de'] = 'DE'; | ||
</pre> | </pre> | ||
批注應(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 | 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. | ||
== | == 本地化的提交 == | ||
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. | ||
== | == 本地化的維護(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. | ||
== | == 何處尋求幫助?== | ||
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 | ||
== | == 翻譯列表 == | ||
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)文本編輯器。
- 有一些工具可以處理.po文件:
- poEdit(多平臺(tái))
- KBabel(Unix KDE)
- GTranslator(Unix Gnome)
- Emacs with po-mode(多平臺(tái))
- Vim with PO plug-in(多平臺(tái))
我比較喜歡用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.
Language | Language Code | Last Translator | List of Translators |
---|---|---|---|
Afrikaans
Afrikaans |
af | Renier | Renier |
???????
Arabic |
ar | Mohammad Saleh | Mohammad Saleh |
Български
Bulgarian |
bg | Bisser Dobrev | Bisser Dobrev |
Беларуская
Belarusian |
be | Alex Lavysh | Alex Lavysh |
Català
Catalan |
ca_ES | Roger Cervantes | Juan Vega Aiguadé; Roger Cervantes |
中國(guó)
Chinese [Simplified] |
zh_CN | Wayne Zhang | Wayne Zhang |
臺(tái)灣
Chinese [Traditional] |
zh_TW | Stephen Chu | Stephen Chu |
?esky
Czech |
cs | Jan Korbel | Jan Korbel |
Dansk
Danish |
da | Jens Hyllegaard | Lasse Bang Mikkelsen, Allan Beaufour, Bj?rn Graabek, Jens Hyllegaard |
Deutsch
German |
de | Andy Staudacher | Jens Tkotz, Ernesto Baschny, Frederik Kunz, Georg Rehfeld, Bananeweizen, Moritz Stoltenburg |
Ελληνικ?
Greek |
el | Anthi Andreou | Nikos Batsis, Anthi Andreou |
English [British] | en_GB | Stephen Ryan | Joan McGalliard, Alan Harder, Stephen Ryan |
Espa?ol
Spanish |
es | Oscar Garcia Amor | Oscar Garcia Amor |
Espa?ol de Argentina
Spanish [Argentine] |
es_AR | Alvaro Cortizo | Alvaro Cortizo |
Espa?ol de Mexico
Spanish [Mexican] |
es_MX | Wieland E. Kublun | Wieland E. Kublun |
Eesti
Estonian |
et | poromaan | poromaan |
Euskera
Basque |
eu | Piarres Beobide | Piarres Beobide |
?????
Farsi |
fa | Mohammad Samini | Jalal Kheradmand, Pedram Hayati, Mohammad Samini |
Fran?ais
French |
fr | Arnaud MOURONVAL | Arnaud MOURONVAL |
?????
Hebrew |
he | Guy Sheffer | Guy Sheffer, Omri Amos |
Irish Gaelic
Irish |
ga | Beckett Madden-Woods | Beckett Madden-Woods |
íslenska
Icelandic |
is | Johann S Jonsson | Johann S Jonsson |
Italiano
Italian |
it | Ermanno Baschiera | Ermanno Baschiera |
日本語(yǔ)
Japanese |
ja | Kennichi Uehara | Kennichi Uehara, Yosuke Suzuki |
한국말
Korean |
ko | Juice | Juice |
Latvie?u
Latvian |
lv | Jānis Bai?a | Jānis Bai?a |
Lietuvi?
Lithuanian |
lt | Darius ?itkevi?ius | Darius ?itkevi?ius |
Magyar
Hungarian |
hu | Sandor Dibuz | Gergely D?ms?di, József R.Nagy, Sandor Dibuz |
Nederlands
Dutch |
nl | Marijke van Velsen | Marcel van Groenigen, Kees van den Broek, Arjen Gideonse, B. Scheijgrond, Marijke van Velsen |
Norsk Bokm?l
Norwegian |
no | Sverre M. Vikan | Frode Tviberg, Sverre M. Vikan, Jon Harald Carlsen, Robin Smidsrod (sponsored by Grieg Multimedia AS), Terje Dahl |
Polski
Polish |
pl | Kappana | Sebastian Marek, Kappana |
Português
Portuguese |
pt | Francisco Neto | Hugo Cruz, Francisco Neto |
Português Brasileiro
Portuguese [Brazilian] |
pt_BR | Paulino Michelazzo | Ernesto Baschny, José Ricardo, Celso Reeks, Paulino Michelazzo |
Roman?
Romanian |
ro | Serban Constantintinescu | Serban Constantintinescu |
Русский
Russian |
ru | Ser Moro | Konstantin Ivanov, modus, Ser Moro |
Укра?нська
Ukrainian |
uk | Anton Gladky | Yurii Smetana, Anton Gladky |
Qu?c Ng? (國(guó)語(yǔ))
Vietnamese |
vi | Trung Dong Huynh | Trung Dong Huynh |
Suomea
Finnish |
fi | Jyrki Heinonen | Jussi Karppanen; Erkka Hakkarainen; Jyrki Heinonen |
Srpski
Serbian |
sr | Jozef Selesi | Jozef Selesi |
Sloven?ina
Slovak |
sk | Branislav Hanacek | Branislav Hanacek |
Sloven??ina
Slovenian |
sl | Jure Babnik | Janez Troha, Jure Babnik |
Svenska
Swedish |
sv | Anders Lindquist | Christian Wallin, Mikael Gustafsson, Peter Liversten, Hampus Nygren, Anders Lindquist |
Türk?e
Turkish |
tr | Goker ISIK | Goker ISIK, Roman Neumüller |