Good WordPress templates are derived from overseas, so we use templates that are basically in English, today will teach hands-on, the use of the template translated into Chinese, to continue WordPress localization!
Today we took the WordPress default template as an example.
First of all introduce the basic WordPress template files:
- style.css : CSS (style sheet) file
- index.php : home page template
- archive.php : Archive / Category template
- 404.php : Not Found Error Page Template
- comments.php : Message / Reply Template
- footer.php : Footer template
- header.php : Header template
- sidebar.php : sidebar template
- page.php : content page (Page) template
- single.php : Content page (Post) template
- searchform.php : Search form templates
- search.php : search results template
These template files will be called, so these documents should be part of the show, are translated into Chinese.
The header.php in the default template homepage is not needed for translation. We mainly translate the content section, the sidebar section and the footer section, and now we start the translation.
Translation of the index.php file:
Need to translate part of the picture, I’ve marked respectively.
Using Editplus open: index.php and copy the “Read the rest of this entry”, “index.php” in the search, you will find this line of code:
<code><?php the_content(‘Read the rest of this entry »’); ?></code>
Replace <? Php the_content ( ‘Read the rest of this entry & raquo;’);?> With “Read the full text”.
Two, and then search for “Tags” will search for two “Tags”, based on the above experience, you need to modify “Tags” in the brackets “Tags”. Replaced with “label”.
Third, a search for “Posted in” changed to “released”.
Fourth, search for “Comments” will search for 3 “Comments”, and another “Comment” is skipped, you need to modify the two brackets and S, and one without the S, modified to “comment”.
At this point, the picture needs to be translated in places, we have finished the translation, but when you log more than quantity when you show up on a page, go to the second page, which is in the Home logging a hyperlink below to see this: Older Entries, show log on the last page will see the hyperlink below: Newer Entries. In the middle of the page, colleagues can see these two hyperlinks, translated into Chinese is the “earlier log” and “newer log.”
And then save the file, code: UFT-8, overwrite the original index.php, results came out.
The sidebar (sidebar.php) translation:
Save resources. Translation has also been marked accordingly.
Using Editplus open sidebar.php, searching for “Pages” instead of “page”. About the need to modify the background – management – page management, the About changed to “on” on it, after the new page will also be displayed here, remember that the title will use the Chinese on it.
Search “Archives”, modify the “<h2> Archives </ h2>” this, modified to “archive.”
Search for “Categories”, changed to “blog category”.
Search for “Blogroll”, and transformed into a “blogroll”.
Search for “Meta”, changed to “manage”.
“Site Admin” shows the status of the landing, if not landing, the show is “Log in”, not landing in the state, “Log out” is invisible. Their translation needs to design. Po language pack, we will talk later.
Footer (footer.php) translation:
The footer of the default template is fairly simple and does not need to be translated.
I believe that everyone has understood, translation of template is very easy, you can try it yourself, when the translation template, needs to pay attention to two aspects: first, displayed in the English version of the code in the correct location, and second, find the appropriate corresponding to Chinese.
Other pages, I won’t list them all translated, interested friends can try your own translation. If you encounter any problems during the process of translation, please leave a message.