Wordpress ing text tutorial

Source: Internet
Author: User
First, let's take a look at Chinese: 1. what is Chinese? As we all know, Chinese is to translate non-Chinese into Chinese. in China, it is called Chinese or localized globally. it is easier to understand and use non-Chinese languages. 2. wordpress localization mechanism and localization software for WordPress plug-ins, we recommend that you first understand before using PoEdit for localization:

1. what is Chinese?As we all know, Chinese is to translate non-Chinese into Chinese. in China, it is called Chinese or localized globally. it is easier to understand and use non-Chinese languages.

2. wordpress localization mechanism and localization softwareFor WordPress plug-ins, we recommend that you use PoEdit for localization. It is also possible to directly modify the source code, but if you do not pay attention to the encoding format, it may cause garbled code on the plug-in settings page. In addition, after the plug-in is upgraded, the old file will be overwritten by the new file, and the localization will disappear ...... These problems are generally not solved when you use PoEdit. download the Chinese version of PoEdit and install it after the download. the installation process is omitted...
WordPress adopts the GNU gettext mechanism for localization. The key lies in the two functions "_ e and __』. PoEdit recognizes and extracts the strings in the two functions, and then you only need to enter the Chinese statements corresponding to those strings, and the others are handed over to PoEdit, all translated statements are in. in the po file. Why not? It doesn't matter. next we will begin to turn to Chinese.

The following describes the theme or plug-in of Chinese wordpress.
1. open PoEdit and go to the File> create a message directory document to create a po file. some themes or plug-ins that come with the. po file can directly use PoEdit to open the translation. the setting interface is as follows:


2. in the pop-up setting interface, there are three tabs:Engineering Information,Path,KeywordsA. Engineering Information: There is nothing to do with this. set the project name and source language at will, which is generally the topic or plug-in name. other options can be ignored. Next, select the path and click next.


B. Path: In Basic pathEnter the complete directory path of the topic or plug-in folder in the input box. for example, in the local WAMP environment, the plug-in location is: C: \ wamp \ www \ wp-content \ plugins must be written into code-snippets. Enter C: \ wamp \ www \ wp-content \ plugins \ code-snippets
Click New projectIn PathEnter a dot (.) below to scan the current directory and sub-directory in the basic path. Do not rush to confirm this step after processing. select the keyword and click next.


C. Keywords: Click New project, Add new keywords _ EAnd __The default three keywords can be retained or deleted, as you like.
Why do we need to add two keywords _ e and _? as mentioned above, PoEdit uses _ e and _ to identify and extract the strings in the two functions that call them, if you forget it, please look back.


D. click OK to enter the name of the po file to be created. the default value is default. po, we generally change it to the topic or plug-in name-zh_CN.po, for example, my Chinese plug-in name is code-snippets, then change to code-snippets-zh_CN.po, save to the ages folder. Click save.


PoEdit starts to scan all the php files in the target path you set. if you set it correctly, you will get the number of new strings. click "OK.


3. here, the. po file is basically created, because many themes or plug-ins do not have their own. po files. Now we can start localization.

4. Save the. po file after translation. the. mo file is automatically generated when PoEdit saves the. po file, and. mo is the. po file after compilation. At this point, our localization is complete. Finally, we can add:
A. If you translate the topic, find the functions. php file in the topic directory, in the last line?> Add
Function theme_init (){
Load_theme_textdomain ('your topic name', get_template_directory ());
}
Add_action ('init ', 'theme _ init ');
B. If you translate the plug-in, find the php file in the directory where the plug-in is located, and add
Load_theme_textdomain ('Plug-In name', 'fill in the directory path of the plug-in translation file ');The path to the plug-in translation file is/wp-content/plugins/your plug-in name/ages/
If your plug-in translation file is placed in the plug-in directory, the path is/wp-content/plugins/your plug-in name/
Now, the localization of WordPress is over. it is a little more detailed than other Chinese tutorials on the internet. of course, not everyone thinks this tutorial is easy to understand, however, when I learned about WordPress localization, I understood and tried localization in this way. If you still don't understand it, I won't sort out the tutorial. please search baidu or google again and believe you can find a better Chinese tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.