WordPress on the use of foreign topics for local Chinese

Source: Internet
Author: User

WordPress has very many excellent and professional themes, of course, most of them are non-Chinese

These themes are always some of the English output on the page that cannot be configured via WordPress admin background

At this point you can go to the corresponding code to get rid of those output, but this is always a bit cumbersome and cumbersome, even if you will.

WordPress itself has multi-language version of multi-language pack, the same WordPress theme has and WordPress similar mechanism

WordPress is very easy to open up this set of rules by a third-party open source compilation tool Poedit

You can focus on all the words that need to be translated in the theme, short sentences, incidentally, to play their own personalized creation and customization, rather than to care about where to change, in which file to change, where the call and there is what relevance, do not focus on the structure of the theme frame.

A few specific steps are recorded below:

1.

WordPress language Settings, download the Chinese version of the default is Chinese, no need to set anything, otherwise
Join define (' Wplang ', ' zh_cn ');

2.

Put Zh_cn.mo in Wp-content/languages (Chinese language Pack)
. Mo is a machine-readable binary file that is obtained by compiling a human-readable. po file.

At this time WordPress itself will be Chinese-made.

3.

WordPress to find the corresponding theme of the language pack

Through the root directory of the corresponding topic

Find in functions.php
Load_theme_textdomain (' Zeedynamic_language ', get_template_directory (). '/languages ');
The first parameter is usually the theme name the second parameter is the path of the translated file to be read on the subject of the stitching good

4.

Use Poedit to edit this topic under the configured path (under the theme root directory under the Languages folder). po File

Post-translation compile Save as Zh_cn.mo file under this languages folder

If the subject file is not available. PO functions.php also has no load .... () then add and configure it yourself.

The. po file is written in plain text format and can refer to the. po file under WordPress's own languages

The definition of Note:zh_CN.po file and language must be named according to Gettext language code Gettext Country Code, China will be zh_cn.

Such as

# Translation of4.2. xinchChinese (China) # this file isDistributed under the same license asThe4.2. x Package.msgid""Msgstr"""po-revision-date:2015-06-28 14:22:11+0000\n""mime-version:1.0\n""Content-type:text/plain; charset=utf-8\n""content-transfer-encoding:8bit\n""Plural-forms:nplurals=1; plural=0;\n""x-generator:glotpress/1.0-alpha-1000\n""project-id-version:4.2.x\n"#: WP-signup.php:716MsgId"The site you were looking for, <strong>%s</strong> does not exist."Msgstr"The site you are looking for (<strong>%s</strong>) does not exist. You can create your own blog with this name! "
#: wp-signup.php:714 
MsgId the site you Were looking for, <strong>%s</strong>, does not exist, but can create it now! "
Msgstr " "

#: Wp-signup.php: 708 MsgId " you is Logged in already. No need to register again! " msgstr " you are logged in without having to re-register.

# The path is indicated in the Healthpress-theme theme
#: 404.php:11 healthpress-theme/404.php:11
MsgId "Apologies, the page you requested could isn't be found!"
Msgstr ""

#: 404.php:12 healthpress-theme/404.php:12
MsgId ""
"Try Navigation at the top or Search box to find what is looking"
"For!"
Msgstr ""

WordPress on the use of foreign topics for local Chinese

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.