Different Languages in WordPress Theme and Admin


In my previous WordPress project, we need to provide contents for Japanese reader. I work with a marketing team who is not familiar with Japanese. They would like to work with Traditional Chinese but the WordPress localization would turn every thing into local language. How to keep theme with Japanese while admin with Traditional Chinese?

I am going to explain bi-language WordPress in the following orders:

  1. Theme in Traditional Chinese while Admin in English
  2. Theme in English while Admin in Traditional Chinese
  3. Theme in Japanese while Admin in Traditional Chinese or Japanese

Download Localized WordPress and Prepare for Installation

You need to download English and localized WordPress from WordPress.org first.

If you cannot find the localized version, you may look up for localized WordPress.org site in WordPress in Your Language and download.

When you are creating the MySQL database for WordPress, please choose utf8_unicode_ci as the [Collation].

For those using AppServ on Windows, please manually change the <directory /> deny from all to <directory /> allow from all in http.conf

Theme in Traditional Chinese while Admin in English

Use plugin to change Admin from Traditional Chinese into English
Use plugin to change Admin from Traditional Chinese into English

1. Install WordPress in Traditional Chinese.

2. Search and install WordPress plugin: Admin in English.

3. Activate this plugin.

If you have more than one admin users with mix favorite language, you may use Admin in English with Switch to let them choose between localized language (in this example, it is Traditional Chinese) or English in admin toolbar.

Plugin Admin in English provides personality for each admin user to choose between localized language and English
Plugin Admin in English provides personality for each admin user to choose between localized language and English

Theme in English while Admin in Traditional Chinese

All theme messages are in English while the admin is with Traditional Chinese.
All theme messages are in English while the admin is with Traditional Chinese.

1. Install WordPress in English.

2. Copy all contents in [languages] folder including itself in localized WordPress (in this example, it is Traditional Chinese) to [wp-content] folder in English WordPress.

3. Search and install WordPress plugin: Admin in English.

4. Replace [en_US] in admin-in-english.php in plugin [Admin in English] by the localized language code (in this example, replaced with [zh_TW]). There is only one two need to be replaced. You may use [Editor] under [Plugins] to edit function.php

If you preferred to provide English in admin for different users, use Admin in English with Switch.

Replace [en_US] in admin-in-english-with-switch.php in plugin by the localized language code (in this example, replaced with [zh_TW]). There is only one needs to be replaced.

Then, replace ‘title’ =>’English’ with ‘title’ =>’Traditional Chinese’. Now the admin toolbar shows “Traditional Chinese” instead.

Then, replace ‘title’ =>’English’ with ‘title’ =>’Traditional Chinese’. Now the admin toolbar shows “Traditional Chinese” instead.

Last, replace ‘title’ => __(‘English’) with ‘title’ => __(‘Traditional Chinese’). Now balloon help shows “Traditional Chinese” instead.

5. Activate this plugin.

Customized Plugin Admin in English provides personality for each admin user to choose between localized language and English
Customized Plugin Admin in English provides personality for each admin user to choose between localized language and English

If you install WordPress in Traditional Chinese, then add following code in function.php in active theme. You may see messages mix with English and Traditional Chinese but it’s not a complete English theme. Messages not defined in theme are already declared as Traditional Chinese by define(‘WPLANG’, ‘zh_TW’) in wp-config.php.

function set_my_locale($locale) {
     $locale = ( is_admin() ) ? "zh_TW" : "en_US";
     setlocale(LC_ALL, $locale );
     return $locale;
}
add_filter( 'locale', 'set_my_locale' );
Theme in mixed languages.
Theme in mixed languages.

Theme in Japanese while Admin in Traditional Chinese or Japanese

Even you are familiar with both language, you may still create different languages for both theme and admin.
Even you are familiar with both language, you may still create different languages for both theme and admin.

If you only know English but need to provide Japanese theme and English / Traditional Chinese switchable admin, things becomes more complex now.

1. Install WordPress in English.

2. Copy all contents in [languages] folder including itself in localized WordPress (in this example, it is Japanese) to [wp-content] folder in English WordPress.

3. Edit wp-config.php in WordPress root folder. Replace define(‘WPLANG’, ”); with define(‘WPLANG’, ‘ja’); Now, both theme and admin becomes Japanese.

4. Copy all contents in [languages] folder including itself in Localized WordPress (in this example, it is Traditional Chinese) to [wp-content] folder in English WordPress.

Now, you will have two language files in [languages] folder. Don’t worry, they use different file names.

5. Search and install WordPress plugin: Admin in English with Switch.

6. Replace [en_US] in admin-in-english-with-switch.php in plugin by the localized language code (in this example, replaced with [zh_TW]). There is only one need to be replaced

Then, replace ‘title’ =>’English’ with ‘title’ =>’Traditional Chinese’. Now the admin toolbar shows “Traditional Chinese” instead.

Then, replace ‘title’ =>’English’ with ‘title’ =>’Traditional Chinese’. Now the admin toolbar shows “Traditional Chinese” instead.

Last, replace ‘title’ => __(‘English’) with ‘title’ => __(‘Traditional Chinese’). Now balloon help shows “Traditional Chinese” instead.

5. Activate this plugin.

When Traditional Chinese is enabled, the admin displays with Traditional Chinese. When it is disabled, the admin displays with Japanese.

More thoughts

What is we have more than two languages in admin? Can we provides more language options for admin? I am currently working on this plugin and shall be available before 2013/12/21.

Also, there is WordPress Multi-Site Installations. If you are managing more than one web site and with different languages, you might be interested in Create A Network.

Reference

  1. WordPress.org
  2. WordPress.org: Codex: WordPress in Your Language
  3. MySQL
  4. AppServ
  5. WordPress 日本語
  6. WordPress.org: Plugin Directory: Admin in English
  7. WordPress.org: Plugin Directory: Admin in English with Switch
  8. Wiki: Balloon help
  9. wpbeginner: How to Find and Translate a Translation Ready WordPress Theme
  10. WPRecipes: How to setup different admin and theme languages on your WordPress blog
  11. CodeBlow.com: wordpress internazionalization – change locale within the theme
  12. WordPress.org: Forums: [resolved] Theme localisation without changing admin panel language (8 posts)
  13. WordPress.org: Installing WordPress in Your Language: Multi-Site Installations
  14. WordPress.org: Codex: Create A Network

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s