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

編輯“Gallery:本地化

跳轉(zhuǎn)至: 導航、? 搜索
警告:您沒有登錄。如果您做出任意編輯,您的IP地址將會公開可見。如果您登錄創(chuàng)建一個賬戶,您的編輯將歸屬于您的用戶名,且將享受其他好處。

該編輯可以被撤銷。 請檢查下面的對比以核實您想要撤銷的內(nèi)容,然后發(fā)布下面的更改以完成撤銷。

最后版本 您的文本
第1行: 第1行:
= Gallery2的本地化 =
= Localizing Gallery 2 =


== 綜述 ==
== Overview ==


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


為了能夠讓用戶看到Gallery文本的本地化版本,
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
翻譯。此過程就被稱為"本地化"。
to display.? This process is called "localization".


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


== 要求 ==
== Requirements ==


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


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


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


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


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


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


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


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


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


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


; 語言代碼:
; Language codes:
: 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:
: 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)


在大多數(shù)情況下,你只需要語言代碼即可,如德語就是"de"。要為多個國家中提供特定國家語言的翻譯,你可以使用這樣的代碼格式,xx_XX,例如"pt_BR"表示葡萄牙語/巴西。如果你確定該用哪一個,包括語言和國家。如果你發(fā)現(xiàn)已有你使用語言的翻譯的話,請接著看 [[#本地化的維護|本地化的維護]]。
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|Maintaining a localization]].


一旦選好了代碼,就需要為你的代碼新建一個.po
Once you've chosen the code, you need to create a new .po file for
文件。假定你選擇是的"de"。那么對各po目錄,
your code.? Let's assume that you chose "de".? For each po directory,
你需要做的是:
you need to do this:


<pre>
<pre>
第75行: 第75行:
</pre>
</pre>


這將找到該本地化標記的所有文本(tpl文件中的[[Gallery:Tpl_Reference#Gallery_Custom_Tags|{g->text}]],php代碼中的translate()或i18n()),并創(chuàng)建一個即將進行翻譯的po文件。
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)文本編輯器。
A word about text editors.
* 有一些工具可以處理.po文件:
* There are several tools to work with .po files:
** [http://poedit.sourceforge.net/ poEdit](多平臺)
** [http://poedit.sourceforge.net/ poEdit] (Multiplatform)
** [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](多平臺)
** [http://www.gnu.org/software/emacs/emacs.html Emacs with po-mode] (Multiplatform)
** [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] (Multiplatform)
我比較喜歡用XEmacs,因此我會
I personally am a fan of XEmacs so I'll be
在下面的例子中拿XEmacs做例子。如果你有其他編輯器
talking about XEmacs in my examples below.? If you have instructions for
的使用指導,請分享一下。XEmacs的主要模式被稱為"po-模式",如果你安裝了它,在編輯.po文件時就會
other editors, please contribute them.? XEmacs has a major mode called "po-mode" which, if you have it installed, you'll automatically wind up
自動轉(zhuǎn)入。我在這里不準備這么做,但
in if you edit a .po file. I'm not going to go into it here, but try
你可以嘗試一下。
it out if you have it.


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


; Last-Translator
; Last-Translator
:將你的名字及email以此格式輸入:"FirstName LastName &lt;email@address&gt;"
: Put your name and email here in the format: "FirstName LastName &lt;email@address&gt;"
; Language-Team
; Language-Team
: 輸入語言及-翻譯郵件列表,如"German &lt;gallery-translations@lists.sourceforge.net&gt;"
: Put in the language and the -translations mailing list, eg: "German &lt;gallery-translations@lists.sourceforge.net&gt;"
; Content-Type
; Content-Type
: 將此設(shè)置給"Content-Type:text/plain; charset=UTF-8\n"
: Set this to "Content-Type: text/plain; charset=UTF-8\n"
: 我們希望你使用UTF-8字符集。因為它允許我們在同一頁面上對多個語言進行渲染,這對某一語言站點頁面上其他語言的用戶評論是有好處的。
: 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.


這里有[http://cvs.sourceforge.net/viewcvs.py/gallery/gallery2/modules/core/po/de.po?rev=1.13&view=auto modules/core/po/de.po]的完整的header樣例。注意編寫者是如何維護前任翻譯者名單的。
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.
<pre>
<pre>
# 前任翻譯者(迄今所知,如有脫漏,請在此添加):
# Previous translators (as far as known, add yourself here, please):
# - Jens Tkotz <jens@peino.de>
# - Jens Tkotz <jens@peino.de>
# - Ernesto Baschny <ernst@baschny.de>
# - Ernesto Baschny <ernst@baschny.de>
第120行: 第120行:
</pre>
</pre>


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


<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].
In this case, you need to translate only msgstr[0] and comment out or remove msgstr[1].


接著來看看Gallery證書下的語句行:
Then, look at the lines just below the Gallery license:


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


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


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


<pre>
<pre>
#, c-format (<-- 在某些語句行中僅能看到這個)
#, c-format (<-- you'll only see this on some lines)
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
msgstr區(qū)塊中,用引號括起來,例如:
msgstr block, between the quotes, for example:


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


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


<pre>
<pre>
第165行: 第165行:
msgstr "F"
msgstr "F"
</pre>
</pre>
注意提示內(nèi)容不應翻譯或包括在msgstr文本中。你可以使用[http://sourceforge.net/tracker/?func=browse&group_id=7130&atid=582564 翻譯追蹤器(Translations Tracker)]為特殊字串請求額外的提示文本。指定模塊/外觀主題以及msgid。注意<tt>strings.raw</tt>文件列出了用到msgid的文件。
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.


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


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


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


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


在進行一些翻譯之后,來看看效果。運行:
After doing a few translations, try it out to see how it looks.? Run:


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


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


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


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


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


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


現(xiàn)在本地化就應創(chuàng)建號了,你需要將其
Now that you've got your localization created, you need to package
打包并發(fā)送給我們,這樣我們就能將其添入存儲庫。
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:


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


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


<pre>
<pre>
第241行: 第242行:
</pre>
</pre>


這會從你所在的模塊中提取出所有消息
This will extract all messages from the module that you're in and
并更新.po文件。瀏覽.po文件,找到所有具有
update the .po file. Look through the .po file for any blocks that
空msgstr或被標記為"模糊(fuzzy)"的區(qū)塊并更新它們。在它們
have an empty msgstr, or are marked "fuzzy" and update them.? After
被修復之后,移除fuzzy標識。你看到的標識會是如下的
they are fixed, remove the fuzzy tag.? You may find tags that look
樣子:
like this:


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


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


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


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


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


翻譯文件被PHP緩存(這就是其快速的原因)
The translation files get cached by PHP (which is why it's so fast)
因此在重啟web服務器之前,可能無法看到所作的修改。這是
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|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:


; The Gallery translations forums:
; The Gallery translations forums:
第285行: 第286行:
: #gallery on irc://chat.freenode.net
: #gallery on irc://chat.freenode.net


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


{| class="gallery" style="background-color: #eee; width: 800px"
{| class="gallery" style="background-color: #eee; width: 800px"
|-
|-
! align="left" width="200px" | 語言
! align="left" width="200px" | Language
! align="left" | 語言代碼
! align="left" | Language Code
! align="left" | 最后翻譯者
! align="left" | Last Translator
! align="left" | 翻譯者列表
! align="left" | List of Translators
|-
|-
|Afrikaans
|Afrikaans
第326行: 第327行:
|-
|-
|中國
|中國
Chinese [簡體]
Chinese [Simplified]
|zh_CN
|zh_CN
|Wayne Zhang
|Wayne Zhang
第332行: 第333行:
|-
|-
|臺灣
|臺灣
Chinese [繁體]
Chinese [Traditional]
|zh_TW
|zh_TW
|Stephen Chu
|Stephen Chu
請注意,您對站長百科的所有貢獻都可能被其他貢獻者編輯,修改或刪除。如果您不希望您的文字被任意修改和再散布,請不要提交。
您同時也要向我們保證您所提交的內(nèi)容是您自己所作,或得自一個不受版權(quán)保護或相似自由的來源(參閱Wordpress-mediawiki:版權(quán)的細節(jié))。 未經(jīng)許可,請勿提交受版權(quán)保護的作品!
取消 編輯幫助(在新窗口中打開)

本頁使用的模板: