WIKI使用導(dǎo)航
站長百科導(dǎo)航
站長專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機(jī)
- cPanel
- 網(wǎng)址導(dǎo)航專題
- 云計(jì)算
- 微博營銷
- 虛擬主機(jī)管理系統(tǒng)
- 開放平臺
- WIKI程序與應(yīng)用
- 美國十大主機(jī)
WordPress:Files For Direct Translation
Introduction[ ]
介紹[ ]
Although WordPress displays in U.S. English by default, the software has the built-in capability to be used in any language, or 'localized' (see WordPress:WordPress in Your Language for more information). The main capability for localization in WordPress uses the Gnu gettext system (see WordPress:Translating WordPress for more information). In the gettext system, text messages produced by WordPress's PHP files are run through a look-up function, which finds and uses the non-English equivalent of the default English word or phrase in a file. This works well for most of WordPress; however, there are a few components of WordPress that do not lend themselves to localization with gettext. This article explains why that is the case, and also shows how to localize those components of WordPress.
雖然WordPress默認(rèn)情況下,顯示為美式英語,WordPress本質(zhì)上能在任何語言中使用,或者'本地化'(更多的信息,請看看英語外其它語言的WordPress)。WordPress主要使用Gnu gettext系統(tǒng)實(shí)現(xiàn)本地化(更多的信息,請看看翻譯WordPress)。在gettext系統(tǒng)中,WordPress PHP文件產(chǎn)生的文本信息在look-up函數(shù)中運(yùn)行,這個函數(shù)使用文件中默認(rèn)英語單詞和詞組的非英語對等翻譯。對于WordPress的大部分內(nèi)容,gettext能夠很好的操作翻譯內(nèi)容,但是WordPress中的少數(shù)內(nèi)容不能夠使用gettext翻譯。這篇文章解釋了這些內(nèi)容為什么不能夠使用gettext翻譯以及怎樣將WordPress的這些部分本地化。
Where gettext Doesn't Work[ ]
gettext不能夠操作的內(nèi)容[ ]
There are several components of WordPress that cannot or should not be translated or localized with gettext:
WordPress中有幾個部分,不能夠由gettext翻譯或者本地化:
- The main WordPress README file -- it's a static HTML file, not a PHP file, so it cannot be run through the gettext functions.
- WordPress主要的自述文件—這是個靜態(tài)的HTML文件,而不是個PHP文件,因此不能夠在gettext函數(shù)中運(yùn)行。
- A few error messages are generated very early in the WordPress loading cycle, before gettext is loaded.
- 在WordPress載入時,gettext還沒有載入的時候,產(chǎn)生了一些錯誤信息。
- WordPress includes some JavaScript functionality, which runs on the users' browser (unlike PHP, which runs on the web server), and therefore does not have gettext available.
- WordPress包含了一些JavaScript函數(shù),這些函數(shù)在用戶的瀏覽器上運(yùn)行(與PHP不同,PHP在網(wǎng)絡(luò)服務(wù)器上運(yùn)行),因此沒有g(shù)ettext。
Internationalizing Non-gettext Components[ ]
將非gettext的組成部分國際化[ ]
In order to internationalize or localize components of WordPress that cannot use gettext, you will need to replace the English version of the files with a modified version, where the English text has been replaced by text in your language. A list of the files you will need to translate is below.
為了將WordPress中不能夠使用gettext的部分國際化或者本地化,你需要使用已更改的版本替換英語版本,在以更改的版本,英語文本已經(jīng)替換為你的母語文本。你需要翻譯的文件如下:
One note: if you are planning to release your localized files for use by others, be careful about WordPress versions! You will need to keep track of which version of WordPress they correspond to, or release different versions of the files for different versions of WordPress. You can find different versions of WordPress in the Release Archive, or if you want to get down to even more detail, the Trac Browser (a browser for the SVN source-code repository for WordPress).
注意:如果你計(jì)劃發(fā)行你的本地化文件供他人使用,注意是哪個版本的WordPress!你需要了解你翻譯的WordPress對應(yīng)的是哪個版本的WordPress,或者為不同版本的WordPress發(fā)行不同版本的文件。你可以在版本歸檔中找到不同版本的WordPress,如果你希望了解更加詳細(xì)的信息,Trac 瀏覽器(WordPress SVN源代碼庫瀏覽器)。
List of Files to Translate[ ]
需要翻譯的文件列表[ ]
Core files (up to WP 2.5)[ ]
核心文件 (直到WP 2.5)[ ]
- readme.html - it's a static HTML file, not a PHP file, so it cannot be run through the gettext functions. The whole file needs to be translated.
- readme.html -這是個靜態(tài)的HTML文件,而不是PHP文件,因此不能夠在gettext函數(shù)中運(yùn)行。整個文件都需要翻譯。
- wp-blog-header.php - only the error for non-existent wp-config.php needs to be translated.
- wp-blog-header.php -只有不存在的wp-config.php的錯誤,需要翻譯。
- wp-settings.php - some die commands could happen before the gettext engine is loaded, so they need to be translated.
- wp-settings.php - 載入gettext引擎之前,會出現(xiàn)一些命令,因此這些命令需要翻譯。
- wp-config-sample.php - see below.
- wp-config-sample.php -請看看下面的。
- wp-admin/install.php - only the error for non-existent wp-config.php needs to be translated.
- wp-admin/install.php -只有不存在的wp-config.php的錯誤需要翻譯。
- wp-admin/setup-config.php - this is a script for automatic generation of wp-config.php, and as it runs independent of WordPress, there is no gettext. The whole file needs to be translated.
- wp-admin/upgrade.php - only the warning message at the top of the file needs to be translated.
- wp-admin/setup-config.php -這是自動產(chǎn)生wp-config.php的腳本,而且這個腳本獨(dú)立于WordPress之外運(yùn)行,沒有g(shù)ettext。整個文件都需要翻譯。
- wp-admin/upgrade.php -只有文件頂上方出現(xiàn)的警示信息需要翻譯。
- wp-includes/functions.php - there's a database error message at the end of the file that needs to be translated.
- wp-includes/functions.php -文件的結(jié)尾部分出現(xiàn)有數(shù)據(jù)庫錯誤信息,這個信息需要翻譯。
- wp-includes/wp-db.php - database error messages need to be translated, because database loading happens early in WordPress loading.
- wp-includes/wp-db.php -需要翻譯數(shù)據(jù)庫錯誤信息,因?yàn)閿?shù)據(jù)庫載入發(fā)生在載入WordPress的早期。
Core files (WP 2.6)[ ]
核心文件 (WP 2.6)[ ]
- readme.html - it's a static HTML file, not a PHP file, so it cannot be run through the gettext functions. The whole file needs to be translated.
- readme.html -是個靜態(tài)的HTML文件,而不是PHP文件,因此不能夠在gettext函數(shù)上運(yùn)行。整個文件需要翻譯。
- wp-config-sample.php - see below.
- wp-config-sample.php -請看看下面的。
- wp-admin/setup-config.php - this is a script for automatic generation of wp-config.php, and as it runs independent of WordPress, there is no gettext. The whole file needs to be translated.
- wp-admin/setup-config.php -這是自動創(chuàng)建wp-config.php的腳本,因?yàn)楠?dú)立與WordPress之外運(yùn)行,沒有g(shù)ettext。整個文件都需要翻譯。
wp-config-sample.php[ ]
wp-config-sample.php[ ]
Translate the instructions in the PHP comments (so that someone who doesn't speak English can figure out how to configure WordPress), and set the WPLANG variable to the correct locale. For example change:
define ('WPLANG', '');
to
define ('WPLANG', 'bg_BG');
if you are using the bg_BG locale
翻譯PHP命令中的指示(這樣不說英語的人,能夠了解怎樣配置WordPress),將WPLANG變數(shù)設(shè)置為正確的locale。例如更改:
define ('WPLANG', '');
to
定義 ('WPLANG', 'bg_BG');
如果你正使用 bg_BG locale。
Replace 'put your unique phrase here' with a similar phrase in your language. Then, in wp-content/languages/<your-locale>.php put:
將'在這里放上你的唯一的詞組'更改為你的母語中對應(yīng)的詞組。然后,在wp-content/languages/<your-locale>.php中放入:
$wp_default_secret_key = '<the-translated-phrase>';
$wp_default_secret_key = '<the-translated-phrase>';
For example, here is what the Bulgarian files look like:
例如,這里是保加利亞語文件的樣式:
dist/wp-config-sample.php:
[...]
define('AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');
define('SECURE_AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');
define('LOGGED_IN_KEY', 'вашата супер-ултра-уникална фраза сложете тук');
[...]
dist/wp-content/languages/bg_BG.php:
<?php
$wp_default_secret_key = 'вашата супер-ултра-уникална фраза сложете тук';
?>
dist/wp-config-sample.php:
[...]
define('AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');
define('SECURE_AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');
define('LOGGED_IN_KEY', 'вашата супер-ултра-уникална фраза сложете тук');
[...]
dist/wp-content/languages/bg_BG.php:
<?php
$wp_default_secret_key = 'вашата супер-ултра-уникална фраза сложете тук';
?>
TinyMCE files (up to WP 2.3 only)[ ]
TinyMCE 文件(只直到WP 2.3)[ ]
Note: From WordPress 2.5 on there is no more need for direct translation of TinyMCE files, since their strings are contained within the main WordPress POT file.
注:從WordPress2.5開始,更需要直接翻譯TinyMCE文件,因?yàn)檫@些字符串包含在WordPress主要的POT文件中。
TinyMCE is the HTML editor included in WordPress. It is written in JavaScript, and therefore uses a different system for localization. To localize TinyMCE, you will need to do the following:
TinyMCE是WordPress中包含的HTML編輯器,使用JavaScript編寫的,因此為本地化使用不同的系統(tǒng)。要本地化TinyMCE,你需要執(zhí)行以下的操作:
- wp-includes/js/tinymce/langs/ - create and add a file named ll_cc.js, where ll is the lower-case language code for your locale, and cc is the lower-case country code. For example, the bg_BG locale files should be named bg_bg.js. This file should contain the translations of strings in en.js (text for buttons and descriptions).
- wp-includes/js/tinymce/langs/ -創(chuàng)建并且添加名稱為ll_cc.js的文件,ll 是你的locale的小寫字母語言代碼,cc是小寫字母國家代碼。例如,bg_BG本地化文件應(yīng)該命名為bg_bg.js。這個文件應(yīng)該在en.js中包含了字符串的翻譯(按鈕和描述的文本)。
- Several sub-directories of TinyMCE also have language directories, where you will need to do the same type of translation of their text:
- TinyMCE的幾個子目錄也有語言目錄,你需要同樣地翻譯這些文本:
- wp-includes/js/tinymce/plugins/wphelp/langs/
- wp-includes/js/tinymce/plugins/directionality/langs/
- wp-includes/js/tinymce/plugins/spellchecker/langs/
- wp-includes/js/tinymce/plugins/autosave/langs/
- wp-includes/js/tinymce/plugins/wordpress/langs/
- wp-includes/js/tinymce/plugins/paste/langs/
- wp-includes/js/tinymce/langs/
- wp-includes/js/tinymce/themes/advanced/langs/
- wp-includes/js/tinymce/plugins/wphelp/langs/
- wp-includes/js/tinymce/plugins/directionality/langs/
- wp-includes/js/tinymce/plugins/spellchecker/langs/
- wp-includes/js/tinymce/plugins/autosave/langs/
- wp-includes/js/tinymce/plugins/wordpress/langs/
- wp-includes/js/tinymce/plugins/paste/langs/
- wp-includes/js/tinymce/langs/
- wp-includes/js/tinymce/themes/advanced/langs/
- Possibly others, if you have different TinyMCE plugins or themes -- search your TinyMCE directory structure for other langs directories.
- 也許還有其它的,如果你有不同的TinyMCE插件或者主題—為其它的langs目錄,搜索你的TinyMCE目錄結(jié)構(gòu)。
Default theme[ ]
默認(rèn)主題[ ]
The Default WordPress theme is entirely in English. All of its files (contained in wp-content/theme/default) need to be translated. You may also want to provide other themes for your locale.
默認(rèn)WordPress主題完全是用英語寫的。所有這些文件(包含在wp-content/theme/default中)需要翻譯。你可能也想為你的locale提供其它的主題。
Besides the English-only version of the default theme, a gettext one also exists. It can be found in the theme folder of the wordpress-i18n svn repository.
除了英語版本的默認(rèn)主題之外,還有個gettext版本的。可以在wordpress-i18n svn 庫主題文件夾中找到。
Do not translate[ ]
不要翻譯[ ]
- license.txt - Should be kept in place for legal reasons. A translated version can be added to the archive.
- license.txt -因?yàn)楹戏ㄐ孕枰嬖谠赪ordPress中??梢詫⒎g的版本添加到歸檔上。