站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
建站程序
开发
服务器
办公软件
开发教程
服务器教程
软件使用教程
运营教程
热门电子书
WordPress教程
宝塔面板教程
CSS教程
Shopify教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Files For Direct Translation
”
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
== 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默认情况下,显示为美式英语,WordPress本质上能在任何语言中使用,或者'本地化'(更多的信息,请看看[[WordPress:WordPress in Your Language|英语外其它语言的WordPress]])。WordPress主要使用Gnu gettext系统实现本地化(更多的信息,请看看[[WordPress:Translating WordPress|翻译WordPress]])。在gettext系统中,WordPress PHP文件产生的文本信息在look-up函数中运行,这个函数使用文件中默认英语单词和词组的非英语对等翻译。对于WordPress的大部分内容,gettext能够很好的操作翻译内容,但是WordPress中的少数内容不能够使用gettext翻译。这篇文章解释了这些内容为什么不能够使用gettext翻译以及怎样将WordPress的这些部分本地化。 == Where gettext Doesn't Work == == gettext不能够操作的内容== 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主要的自述文件—这是个静态的HTML文件,而不是个PHP文件,因此不能够在gettext函数中运行。 * A few error messages are generated very early in the WordPress loading cycle, before gettext is loaded. *在WordPress载入时,gettext还没有载入的时候,产生了一些错误信息。 * 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函数,这些函数在用户的浏览器上运行(与PHP不同,PHP在网络服务器上运行),因此没有gettext。 == 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的部分国际化或者本地化,你需要使用已更改的版本替换英语版本,在以更改的版本,英语文本已经替换为你的母语文本。你需要翻译的文件如下: 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 [http://wordpress.org/download/release-archive/ Release Archive], or if you want to get down to even more detail, the [http://trac.wordpress.org/browser/ Trac Browser] (a browser for the SVN source-code repository for WordPress). 注意:如果你计划发行你的本地化文件供他人使用,注意是哪个版本的WordPress!你需要了解你翻译的WordPress对应的是哪个版本的WordPress,或者为不同版本的WordPress发行不同版本的文件。你可以在[http://wordpress.org/download/release-archive/ 版本归档]中找到不同版本的WordPress,如果你希望了解更加详细的信息,[http://trac.wordpress.org/browser/ Trac 浏览器](WordPress SVN源代码库浏览器)。 == List of Files to Translate == == 需要翻译的文件列表 == === Core files (up to WP 2.5) === === 核心文件 (直到WP 2.5) === * <tt>readme.html</tt> - 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. * <tt>readme.html</tt> -这是个静态的HTML文件,而不是PHP文件,因此不能够在gettext函数中运行。整个文件都需要翻译。 * <tt>wp-blog-header.php</tt> - only the error for non-existent <tt>wp-config.php</tt> needs to be translated. * <tt>wp-blog-header.php</tt> -只有不存在的<tt>wp-config.php</tt>的错误,需要翻译。 * <tt>wp-settings.php</tt> - some <tt>die</tt> commands could happen before the gettext engine is loaded, so they need to be translated. * <tt>wp-settings.php</tt> - 载入gettext引擎之前,会出现一些命令,因此这些命令需要翻译。 * <tt>wp-config-sample.php</tt> - see below. * <tt>wp-config-sample.php</tt> -请看看下面的。 * <tt>wp-admin/install.php</tt> - only the error for non-existent <tt>wp-config.php</tt> needs to be translated. * <tt>wp-admin/install.php</tt> -只有不存在的<tt>wp-config.php</tt>的错误需要翻译。 * <tt>wp-admin/setup-config.php</tt> - 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. *<tt>wp-admin/upgrade.php</tt> - only the warning message at the top of the file needs to be translated. * <tt>wp-admin/setup-config.php</tt> -这是自动产生wp-config.php的脚本,而且这个脚本独立于WordPress之外运行,没有gettext。整个文件都需要翻译。 *<tt>wp-admin/upgrade.php</tt> -只有文件顶上方出现的警示信息需要翻译。 *<tt>wp-includes/functions.php</tt> - there's a database error message at the end of the file that needs to be translated. *<tt>wp-includes/functions.php</tt> -文件的结尾部分出现有数据库错误信息,这个信息需要翻译。 *<tt>wp-includes/wp-db.php</tt> - database error messages need to be translated, because database loading happens early in WordPress loading. *<tt>wp-includes/wp-db.php</tt> -需要翻译数据库错误信息,因为数据库载入发生在载入WordPress的早期。 === Core files (WP 2.6) === === 核心文件 (WP 2.6) === * <tt>readme.html</tt> - 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. * <tt>readme.html</tt> -是个静态的HTML文件,而不是PHP文件,因此不能够在gettext函数上运行。整个文件需要翻译。 * <tt>wp-config-sample.php</tt> - see below. * <tt>wp-config-sample.php</tt> -请看看下面的。 * <tt>wp-admin/setup-config.php</tt> - 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. * <tt>wp-admin/setup-config.php</tt> -这是自动创建wp-config.php的脚本,因为独立与WordPress之外运行,没有gettext。整个文件都需要翻译。 === 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:<br/><tt>define ('WPLANG', <nowiki>''</nowiki>);</tt><br/>to<br/><tt>define ('WPLANG', 'bg_BG');</tt><br/>if you are using the <tt>bg_BG</tt> locale 翻译PHP命令中的指示(这样不说英语的人,能够了解怎样配置WordPress),将WPLANG变数设置为正确的locale。例如更改:<br/><tt>define ('WPLANG', <nowiki>''</nowiki>);</tt><br/>to<br/><tt>定义 ('WPLANG', 'bg_BG');</tt><br/>如果你正使用 <tt>bg_BG</tt> locale。 Replace 'put your unique phrase here' with a similar phrase in your language. Then, in wp-content/languages/<your-locale>.php put: 将'在这里放上你的唯一的词组'更改为你的母语中对应的词组。然后,在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: <tt> [...]<br /> define('AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');<br /> define('SECURE_AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');<br /> define('LOGGED_IN_KEY', 'вашата супер-ултра-уникална фраза сложете тук');<br /> [...] </tt> dist/wp-content/languages/bg_BG.php: <tt> <?php<br /> $wp_default_secret_key = 'вашата супер-ултра-уникална фраза сложете тук';<br /> ?><br /> </tt> dist/wp-config-sample.php: <tt> [...]<br /> define('AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');<br /> define('SECURE_AUTH_KEY', 'вашата супер-ултра-уникална фраза сложете тук');<br /> define('LOGGED_IN_KEY', 'вашата супер-ултра-уникална фраза сложете тук');<br /> [...] </tt> dist/wp-content/languages/bg_BG.php: <tt> <?php<br /> $wp_default_secret_key = 'вашата супер-ултра-уникална фраза сложете тук';<br /> ?><br /> </tt> === 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文件,因为这些字符串包含在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编写的,因此为本地化使用不同的系统。要本地化TinyMCE,你需要执行以下的操作: * <tt>wp-includes/js/tinymce/langs/</tt> - create and add a file named <tt>ll_cc.js</tt>, where <tt>ll</tt> is the lower-case language code for your locale, and <tt>cc</tt> is the lower-case country code. For example, the <tt>bg_BG</tt> locale files should be named <tt>bg_bg.js</tt>. This file should contain the translations of strings in <tt>en.js</tt> (text for buttons and descriptions). * <tt>wp-includes/js/tinymce/langs/</tt> -创建并且添加名称为<tt>ll_cc.js</tt>的文件,<tt>ll</tt> 是你的locale的小写字母语言代码,<tt>cc</tt>是小写字母国家代码。例如,<tt>bg_BG</tt>本地化文件应该命名为<tt>bg_bg.js</tt>。这个文件应该在<tt>en.js</tt>中包含了字符串的翻译(按钮和描述的文本)。 * Several sub-directories of TinyMCE also have language directories, where you will need to do the same type of translation of their text: *TinyMCE的几个子目录也有语言目录,你需要同样地翻译这些文本: **<tt>wp-includes/js/tinymce/plugins/wphelp/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/directionality/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/spellchecker/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/autosave/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/wordpress/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/paste/langs/</tt> **<tt>wp-includes/js/tinymce/langs/</tt> **<tt>wp-includes/js/tinymce/themes/advanced/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/wphelp/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/directionality/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/spellchecker/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/autosave/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/wordpress/langs/</tt> **<tt>wp-includes/js/tinymce/plugins/paste/langs/</tt> **<tt>wp-includes/js/tinymce/langs/</tt> **<tt>wp-includes/js/tinymce/themes/advanced/langs/</tt> **Possibly others, if you have different TinyMCE plugins or themes -- search your TinyMCE directory structure for other <tt>langs</tt> directories. **也许还有其它的,如果你有不同的TinyMCE插件或者主题—为其它的<tt>langs</tt>目录,搜索你的TinyMCE目录结构。 === Default theme === ===默认主题 === The Default WordPress theme is entirely in English. All of its files (contained in <tt>wp-content/theme/default</tt>) need to be translated. You may also want to provide other themes for your locale. 默认WordPress主题完全是用英语写的。所有这些文件(包含在<tt>wp-content/theme/default</tt>中)需要翻译。你可能也想为你的locale提供其它的主题。 Besides the English-only version of the default theme, a gettext one also exists. It can be found in the [http://svn.automattic.com/wordpress-i18n/theme/ theme folder of the wordpress-i18n svn repository]. 除了英语版本的默认主题之外,还有个gettext版本的。可以在[http://svn.automattic.com/wordpress-i18n/theme/ wordpress-i18n svn 库主题文件夹]中找到。 === Do not translate === === 不要翻译 === *<tt>license.txt</tt> - Should be kept in place for legal reasons. A translated version can be added to the archive. *<tt>license.txt</tt> -因为合法性需要存在在WordPress中。可以将翻译的版本添加到归档上。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)