Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
The network is flooded with various versions of WordPress's Chinese-language tutorials, beginners often do not know how to Chinese, veteran although know, but do not bother to write the text to share their experience, I sent the Nets here for the rookie friends to write a Chinese course, I hope the rookie friends help.
In any case, Chinese WordPress, are ça, next from two methods to discuss the Chinese of WordPress.
In our Chinese wordpress theme or wordpress plugin before, we must prepare some more practical tools, so that we can very good Chinese wordpress theme or wordpress plug-ins. The tools we have to prepare are: Wamp, Dreamweaver, Poedit, themes or plug-ins that need to be Chinese. Here is a simple introduction to this software:
Wamp:php Local running environment package, we use this package to build a local PHP environment, install WordPress. The same software also has xampp, Appserv;
dreamweaver:php develop simpler software. Similar software with Zend Studio or eclipsephp, we just use a small subset of its features;
Poedit:wordpress of the theme of the Chinese plug-in;
Styleshop:wordpress an e-commerce theme, Next will take this topic as an example to introduce how to Chinese WordPress theme; I send the download address in the net (http://www.olpie.com/wordpress-themes/ Wordpress-styleshop);
The above need to use the software we are just here to do a simple introduction, if you want to learn more content, you can use Baidu or Google search will be good.
I sent webmaster Olpie has installed on the computer Wamp, Dreamweaver, WordPress and WordPress theme Styleshop, here no longer describes how to install the use. (I sent a tutorial on how to install Wamp and WordPress, interested friends can go and see)
Method One: Directly in the source code to modify;
WordPress Built-in language functions, __ (), _e (), _x (), here we can directly modify the language function here in the English part of its translation into Chinese, the completion of the Chinese work.
For example: __ (' Newer comments→ ', ' styleshop ');
Here we are in the direct replacement of the English part of the same time, we should also consider the HTML tag, can not modify the HTML tag, otherwise it will destroy the integrity of the template.
We can use Dreamweaver to help us quickly locate the parts that need to be localized in order to be able to quickly locate the part that needs to be Chinese. First you need to set up a site, site root directory needs to point to the localization of the WordPress template path, using the shortcut key "Ctrl", select the search range for "The entire current local site", enter the content to search, click "Find All", you can find the content of the rapid positioning, and then the Chinese can be, After the completion of the Chinese to save.
I do not recommend this method here, because for beginners, if the division is not clear which parts need to be Chinese, it is easy to cause errors, and damage the template source code integrity.
Method Two: Use Poedit software to carry on the localization;
1. Language files exist in the template
The general foreign WordPress template, itself contains language pack files, you can find in the Lang or language folder for the existence of a. po,. pot files, if the template exists in the. po,. pot files, We can use the Poedit software to open the translation directly. Copy the En_us.po file in it, paste it into the same folder, name it Zh_cn.po, and then use the Poedit software to directly open it for translation.
After the translation is completed, click on "Ctrl" to save, will be in this folder to form a Zh_cn.mo file, this file is WordPress can identify the language pack. If the WordPress system installs the Chinese language pack, then WordPress will call the Zh_cn.mo file in this folder. This completes the Chinese work of WordPress.
2. Language files are not present in the template
If a language file does not exist in the template, then we need to use the Poedit software to generate the Po file automatically. The specific steps are as follows:
The first step: Open the Poedit file, click "File"-> "new Message directory Document", pop-up dialog box.
Step Two: Enter the text message in the dialog box that pops up:
Some of the tutorials pointed out that some parts do not need to write, but still suggest that everyone write it, to appear more perfect, where the "source code character Set" and "character set" to your use of the WordPress encoding method is related, will generally be UTF-8.
Next find the topic you want to put on the disk in the path of storage, press and hold "CTRL+F4" to select all the path, copy down.
Paste the copied template path to the base path, then click the button at the bottom of the red box "1" To paste the copied link in the lower box;
Then type "__" and "_e" in the following way, as described above.
Then click "OK" and in the pop-up dialog box to find the path to save the disk and the name of the file, click Save.
If this dialog box appears after the save is complete, you need to have the language pack for the WordPress theme to be generated.
Click OK, you can see the graphical interface shown in 1 of method two, then translate and save it step-by-step according to the method, then complete the Chinese work of WordPress.
The translation of the WordPress language pack has been completed, if you log in the background or in front of the view still found that the display is still in English, please do not panic. This is required to open the functions.php file in the template using Dreamweaver and add the following code before the file's last "?>":
function Theme_init () {
Load_theme_textdomain ($domain, $path);
}
Add_action (' init ', ' theme_init ');
Where $domain: The individual is considered to be the unique identifier in the translation, such as "styleshop" in this example. __ (' Newer comments→ ', ' styleshop '), but some people understand the theme path name, not or not.
$path: A path to translate a language pack into a template, which is typically saved in the language or Lang folder in the template.
For example, in the Styleshop template, Load_theme_textdomain () is written in this way. Load_theme_textdomain (' Styleshop ', $template _directory. '/lang '), where $template_directory is the path to the template.
If this site is still not displayed in the foreground or backstage as Chinese, then please check the site root directory of the wp-config.php file, find "define (' Wplang ', ')", and rewrite it as "define (' Wplang ', ' zh_cn ');", Then the website will show you Chinese language.
If you appreciate your own Chinese works found some places are still not perfect, the only reason is that Poedit software did not find, or the need to translate the part does not use "__" or "_e" function to standardize. Then you can use the Dreamweaver software to search the site directory files to find the part that needs to be Chinese. Then use the function "__" or "_e" specification or direct modification.
At this point on the WordPress template or WordPress plug-in Chinese tutorial has been completed, if you find that there is still a problem in the use process, still can not help you out of the dilemma, then please contact the author.
Copyright to even send the net all, even send Web site: http://www.olpie.com/