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

Gallery: 本地化:修訂間差異

來自站長百科
跳轉至: 導航、? 搜索
無編輯摘要
第206行: 第206行:
'描述'則應是該語言的本土說法。
'描述'則應是該語言的本土說法。


Now, log onto G2 and in the User preferences (you may need to edit the
現(xiàn)在登入G2,在用戶偏好(你可能需要
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
German。而如果你選擇了它,并以剛才那個用戶的身份登入的話,
translated messages.? Alternatively, add the Language selector block
就能看到消息被翻譯為該語言了。你還可以將語言選擇器區(qū)塊
to your site using Theme settings.
添加到站點中,使用外觀主題設定就可以做到。


'''Note:''' If the language change doesn't take effect, please review the precedence of the [[Gallery: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.
'''注:''' 如果語言修改沒有起效,請回顧一下[[Gallery2:Language_Settings|語言設定]]的優(yōu)先級(會話語言(Session language) > 用戶偏好(user preferences) > 站點范圍的默認語言(site wide default language))。如果有疑慮的話,可以使用語言區(qū)塊或在用戶偏好中反復嘗試。


== 本地化的提交 ==
== 本地化的提交 ==


Now that you've got your localization created, you need to package
現(xiàn)在本地化就應創(chuàng)建號了,你需要將其
it up and send it to us so that we can commit it into the repository.
打包并發(fā)送給我們,這樣我們就能將其添入存儲庫。
The best way to package it is like this:
最好的打包方式如下:


<pre>
<pre>
第231行: 第231行:
</pre>
</pre>


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 [http://sourceforge.net/tracker/?func=browse&group_id=7130&atid=582564 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
你翻譯過的文件會被做成zipfile或tarball。當然使用你自己的語言代碼取代上面的de或nl。接著瀏覽SourceForge 的Gallery項目頁面上的[http://sourceforge.net/tracker/?func=browse&group_id=7130&atid=582564 翻譯追蹤器]并點擊"Submit New"按鈕。將你的翻譯放入"Gallery 2"組中,并將文件加入附件上傳。如果你的翻譯
get committed within a few days, jump on IRC (see [[#Where_to_go_for_help!|help section]]) and talk to us about it.
過了幾天還沒有被采用的話,請上IRC(參見[[#Where_to_go_for_help!|幫助部分]])告知我們。


== 本地化的維護 ==
== 本地化的維護 ==
第241行: 第241行:
</pre>
</pre>


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
并更新.po文件。瀏覽.po文件,找到所有具有
have an empty msgstr, or are marked "fuzzy" and update them.? After
空msgstr或被標記為"模糊(fuzzy)"的區(qū)塊并更新它們。在它們
they are fixed, remove the fuzzy tag.? You may find tags that look
被修復之后,移除fuzzy標識。你看到的標識會是如下的
like this:
樣子:


<pre>
<pre>
第253行: 第253行:
</pre>
</pre>


The "#, fuzzy" means that its fuzzy, but the "#~" means that the
"#, fuzzy"表示它是模糊的,但"#~"表明該
string no longer exists in G2 (we probably deleted or changed it
字串不存在于G2中(我們可能將其刪除或修改了
significantly).? You can delete these entries.
)。你可以刪除這些內(nèi)容.


You should do a quick check that gettext provides to validate your .po file:
你應當快速地做一次gettext提供的檢查,以驗證.po文件:
? msgfmt -v -c --stat de.po
? msgfmt -v -c --stat de.po


When you've got everything right, run:
當一切都設置好后,運行:


<pre>
<pre>
第266行: 第266行:
</pre>
</pre>


The translation files get cached by PHP (which is why it's so fast)
翻譯文件被PHP緩存(這就是其快速的原因)
so you may not see change until you restart your web server.? That's
因此在重啟web服務器之前,可能無法看到所作的修改。這是
annoying, but I haven't figured a good workaround for it yet.
有點麻煩,但我還沒有想出好的解決辦法。


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:
如果你需要幫助,有三個地方可以求助:


; The Gallery translations forums:
; The Gallery translations forums:
第286行: 第286行:


== 翻譯列表 ==
== 翻譯列表 ==
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.
所有可用的Gallery2翻譯,都在此以字母表順序列出了,帶有維護者/作者名單。某些翻譯100%保持更新并且完成,某些則僅完成了2%或過期了。參見 [http://gallery.menalto.com/localization/gallery2 本地化報告]。如果你有G2的開發(fā)者整合包,就可以運行{{exampleurl|/lib/tools/reports/localization.php}}來查看所有已安裝翻譯的狀態(tài)。


{| class="gallery" style="background-color: #eee; width: 800px"
{| class="gallery" style="background-color: #eee; width: 800px"
|-
|-
! align="left" width="200px" | Language
! align="left" width="200px" | 語言
! align="left" | Language Code
! align="left" | 語言代碼
! align="left" | Last Translator
! align="left" | 最后翻譯者
! align="left" | List of Translators
! align="left" | 翻譯者列表
|-
|-
|Afrikaans
|Afrikaans
第326行: 第326行:
|-
|-
|中國
|中國
Chinese [Simplified]
Chinese [簡體]
|zh_CN
|zh_CN
|Wayne Zhang
|Wayne Zhang
第332行: 第332行:
|-
|-
|臺灣
|臺灣
Chinese [Traditional]
Chinese [繁體]
|zh_TW
|zh_TW
|Stephen Chu
|Stephen Chu

2008年10月25日 (六) 15:24的版本

Gallery2的本地化

綜述

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

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

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

要求

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

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

:如果你使用FreeBSD,并希望能取代make而使用gmake,因為FreeBSD的默認不與GNU兼容。

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

本地化的新建

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

find . -type d -name po			<-- 輸入這個

./themes/matrix/po	          	<-- 會看到這個
./lib/tools/po
./modules/core/po
./modules/comment/po
./modules/netpbm/po

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

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

語言代碼
http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC221
(or http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt)
國家代碼
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.

有關文本編輯器。

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

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

Last-Translator
將你的名字及email以此格式輸入:"FirstName LastName <email@address>"
Language-Team
輸入語言及-翻譯郵件列表,如"German <gallery-translations@lists.sourceforge.net>"
Content-Type
將此設置給"Content-Type:text/plain; charset=UTF-8\n"
我們希望你使用UTF-8字符集。因為它允許我們在同一頁面上對多個語言進行渲染,這對某一語言站點頁面上其他語言的用戶評論是有好處的。

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

# 前任翻譯者(迄今所知,如有脫漏,請在此添加):
# - 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"

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

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

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

接著來看看Gallery證書下的語句行:

#, fuzzy
msgid ""
msgstr ""

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

接下來你會看到一系列區(qū)塊:

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

你需要將英語消息的翻譯置入 msgstr區(qū)塊中,用引號括起來,例如:

#, 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值含有有助于進行翻譯的提示信息:

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

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

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

如果你使用XEmacs的MULE(即多語言支持(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)

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

在進行一些翻譯之后,來看看效果。運行:

make install PO=de

它會將你的.po文件編譯到一個.mo文件中,并將其安裝到合適的位置。在修改.po文件之后,對各目錄都要重復此步驟。如果你在創(chuàng)建locale目錄時發(fā)生錯誤,請在運行make之前建立目錄結構(如:modules/mymodule/locale/de/LC_MESSAGES)。

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

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

批注應為該語言的英語說法;語言 '描述'則應是該語言的本土說法。

現(xiàn)在登入G2,在用戶偏好(你可能需要 通過站點管理對用戶進行編輯)中,你應能在下拉列表中看到 German。而如果你選擇了它,并以剛才那個用戶的身份登入的話, 就能看到消息被翻譯為該語言了。你還可以將語言選擇器區(qū)塊 添加到站點中,使用外觀主題設定就可以做到。

注: 如果語言修改沒有起效,請回顧一下語言設定的優(yōu)先級(會話語言(Session language) > 用戶偏好(user preferences) > 站點范圍的默認語言(site wide default language))。如果有疑慮的話,可以使用語言區(qū)塊或在用戶偏好中反復嘗試。

本地化的提交

現(xiàn)在本地化就應創(chuàng)建號了,你需要將其 打包并發(fā)送給我們,這樣我們就能將其添入存儲庫。 最好的打包方式如下:

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

or:

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

你翻譯過的文件會被做成zipfile或tarball。當然使用你自己的語言代碼取代上面的de或nl。接著瀏覽SourceForge 的Gallery項目頁面上的幫助部分)告知我們。

本地化的維護

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

這會從你所在的模塊中提取出所有消息 并更新.po文件。瀏覽.po文件,找到所有具有 空msgstr或被標記為"模糊(fuzzy)"的區(qū)塊并更新它們。在它們 被修復之后,移除fuzzy標識。你看到的標識會是如下的 樣子:

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

"#, fuzzy"表示它是模糊的,但"#~"表明該 字串不存在于G2中(我們可能將其刪除或修改了 )。你可以刪除這些內(nèi)容.

你應當快速地做一次gettext提供的檢查,以驗證.po文件:

msgfmt -v -c --stat de.po

當一切都設置好后,運行:

make install PO=de

翻譯文件被PHP緩存(這就是其快速的原因) 因此在重啟web服務器之前,可能無法看到所作的修改。這是 有點麻煩,但我還沒有想出好的解決辦法。

參見[[#本地化的新建]|本地化的新建]]部分的測試信息,并向我們提交新文件。

何處尋求幫助?

如果你需要幫助,有三個地方可以求助:

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

翻譯列表

所有可用的Gallery2翻譯,都在此以字母表順序列出了,帶有維護者/作者名單。某些翻譯100%保持更新并且完成,某些則僅完成了2%或過期了。參見 本地化報告。如果你有G2的開發(fā)者整合包,就可以運行http://www.example.com/gallery/lib/tools/reports/localization.php來查看所有已安裝翻譯的狀態(tài)。