Language Switcher WordPress Plugin
No longer maintained!
Note from Jennifer Hodgdon, the plugin author: As of April 2010, this plugin is no longer being maintained. Please read this news posting for more details.
The Language Switcher plugin does work fine for WordPress 2.9.x. If you are attempting to use the Language Switcher on a later version of WordPress and it needs updates, or if you would like more features, and you have funding for your project, you (or a group of users) could consider hiring Poplar ProductivityWare to update the plugin. Or, you can modify it yourself (it is open-source software licensed under the GNU Public License). Or, if you or someone you know would like to take over maintenance of this plugin, please let me know.
If you don't want to use the Language Switcher plugin, the qTranslate plugin for WordPress may be a good alternative. I haven't tried it, but someone recommended it to me as a good alternative in May of 2010.
Translations of this site are available (not sure how up-to-date they are, so use at your own risk):
The Language Switcher WordPress plugin allows you to create a bilingual or multi-lingual blog or site, using WordPress. The way it works is that you write the content for your site in multiple languages, using special tags to tell the plugin which text goes with which language. You'll also install "gettext" language files to translate the text generated by your theme, other plugins, and WordPress itself into your target languages. The Language Switcher plugin will then let your site viewers choose a language for viewing your site, and put all the text on the screen into the right language.
Unfortunately, setting up a multi-lingual site does take some work. You will need to follow all the steps on this site carefully to get your site functioning properly, and it will require at least a passing knowledge of WordPress and probably HTML. Also, unfortunately many WordPress themes and plugins that other people have written are not set up properly for internationalization and multi-lingual sites with the Language Switcher. Instructions are given on this site on how to fix them, but it will require some PHP programming (or at least PHP editing) to fix some plugins and themes. So, be prepared! The good news is that the core of WordPress has a lot of functionality, and the Language Switcher works well with the core WordPress functionality.
Note: Language Switcher does not do any translations! It just allows you to display text that you have provided, in the language preferred by your site's visitors. There are other plugins that can be used to create multilingual sites that have different approaches, including automatic machine translations. To find other plugins, see the Plugins article at wordpress.org.
Since setting up a bilingual or multi-lingual site is rather complex, this web site is basically a tutorial on how to get your site set up, from start to finish. Please follow all of the instructions on all of these pages!
Terminology note for Windows and Mac users: the word "directory" in this article is the same as "folder" -- a location containing files on a computer.
Installing or Upgrading Blog Software
WordPress Install or Upgrade
The first step in creating a bilingual or multi-lingual site with the Language Switcher is to install or upgrade WordPress. The Language Switcher is mostly compatible with WordPress 2.1.2 and later versions. However, the released versions of WordPress have some little bugs or features that make them not quite compatible with the Language Switcher plugin, so please follow these instructions to install WordPress, or to upgrade to a new version. Important: later on, after using the Language Switcher, please return to this page and follow the instructions below in order to upgrade your bilingual or multi-lingual site to a new version of WordPress.
- Read the instructions in the WordPress Installation Guide or (WordPress Upgrade Guide if you are updating from a previous version). But -- don't follow them exactly yet! Instead, follow these slightly modified steps.
- Download the latest version of WordPress zip file from the WordPress download page. Important: Do not download from any other site! Especially, do not get a version that has been modified for a foreign language. To make a multi-lingual version work, you will need to start with the English-language, standard version of WordPress. If you start with a different version, you will probably encounter problems, because some foreign-language WordPress versions have modified files that are not compatible with multi-lingual operation.
- Unzip the file onto your personal computer.
- If you are installing for the first time, set up your MySQL server as described in the Installation Guide. If you are upgrading, back up your previous MySQL database as described in the Upgrading guide.
- Modify the configuration file (as described in the Installation guide -- if you are upgrading, you can download your previous configuration file from your site).
- If your configuration file (wp-config.php) has this line in it, remove this line -- it seems
to be incompatible with the Language Switcher in some circumstances:
define('ENABLE_CACHE', true);Also, if you are using a language that uses a non-western character set (such as Chinese or Hebrew), you may need to remove these two lines from your configuration file, in order to display those characters:
define('DB_CHARSET', 'utf8');See this page on the WordPress support forum for more information. David, a Chinese/English Language Switcher user also wrote and said that for him, removing those lines didn't work. What worked was changing those lines to match what his database was currently using, which you can find in PHPMyAdmin. The Character Set setting is displayed on the PHPMyAdmin home page (it's usually utf8, I think), and the Collate setting is displayed when you choose a database or database table. If you have a working database table that is able to display your language's characters in PHPMyAdmin, then you should be able to choose that DB_COLLATE setting in the wp-config.php file. For David, the DB_COLLATE setting that worked for Chinese/English was 'utf8_unicode-ci'.
- Download the zip file of WordPress fixes (if any) corresponding to your WordPress version from the downloads section, and install the files into the correct locations (as specified in the README.txt file contained in the fixes zip file).
- If specified in the downloads section for your version, also follow the database fix instructions.
- If you are upgrading, delete the obsolete files from your installation, as specified in the Upgrade guide.
- Upload the entire set of WordPress files to your server (see the Installation Guide for a description of where to put them).
- Run the install.php or upgrade.php file to complete the installation (as described in the installation/upgrade guide).
The next step in creating your multi-lingual site is to install the Language Switcher plugin. After downloading the zip file from the downloads section, follow these steps to install, activate, and set it up:
- Upload langswitch.php (the main plugin file) into wp_content/plugins, in your WordPress installation. If you are using WordPress version 2.6 or later, and have changed the location of your wp_content directory, use that location instead, throughout the instructions below.
- Upload the flag icon files (*.png) into sub-directory "langswitch_flags" of wp-content/plugins, in your WordPress installation. You can add other flags, or substitute other image files, by putting them in this directory.
- If you want to localize Language Switcher so that the administration menus and the title of the language list widget (if you are using Widgets) are displayed in a language besides English, you can use the langswitch.pot file and your favorite localization software to translate Language Switcher. See the translating section for more information; your localization file(s) will need to be named "langswitch-ll.mo", where "ll" is the ISO code of the language you want to use, and they will need to go into sub-directory "langswitch_flags". Several localization files have been provided in the zip file, but they may not be complete or accurate (they came from other plugin users).
- Activate the plugin from your WordPress administration panel. If you need more detailed information on how to manage WordPress plugins, please visit the Managing Plugins page on the WordPress site.
- Enter information about the languages you want to use in your site on the Language
Switcher options page.
- To get to the page in the administration panel, click on "Options" or "Settings" in the top or side menu, and then "Language Switcher".
- Type in the two-letter ISO code for your default language (the one someone will see when first visiting the page) at the top; a table of ISO codes is available at this Wikipedia site (be sure to use the two-letter codes from the first column). Note: If you cannot find an ISO code for your language, you can make one up. The Language Switcher does not care, as long as you use consistent 2-letter codes on the Options screen, when entering multilingual text (see the translating content section), and for the MO file names (see the translating static text section).
- In the table below, enter information about all the languages you will use in your site,
one language per line (including the default language). Fields:
- ISO Code: The two-letter ISO code (or made-up 2-letter code) for the language; for example, "en" for English, and "es" for Spanish (do not type the quotes).
- Language: The name of the language, in that language. For example, for English, type in "English", and for Spanish, type in "español" (without the quotes).
- Flag File: The image file name for the flag you want to use for the language (from the langswitch_flags directory in the plugin distribution). For instance, for English, you could use "en.png" for the English flag, "us.png" for the American flag, etc. Enter the file name without the quotes and without the directory name.
- Time Format: The format you would like to use for time of day for that language, using standard PHP time/date formatting codes found on this PHP documentation page. For instance, to display times in a format like "3:15 PM", you would type in "g:i A", and to use a 24-hour clock, you would use "G:i" (in both cases without the quotes).
- Date Format: The format you would like to use for dates for that language, using standard PHP time/date formatting codes (see above). For instance, to display dates in a format like "25 Dec. 2008", you would type in "j M. Y"; to get something like "12/25/2008", you could use "m/d/Y"; and to have the day before the month, "d/m/Y" (in all cases without the quotes).
- Text Missing Message: The message to display on the screen if an article has no translation for the requested language.
- Click "Update Options" when you have entered all your language information.
- If you want to change some information, enter the new information in the line with the ISO code you want to change, and click "Update Options".
- If you want to delete a language, check the "Delete" box in that row and click "Update Options".
- If you want to add additional languages, type in the information, starting at the first blank line, and click "Update Options".
- If you want to enter more new languages than there are space for, enter as many as you can, click "Update Options", and then more blank lines will appear on the screen. Repeat until all your languages are entered.
- If you do not like the URLs the Language Switcher is producing, or they are not working for you, see the Frequently asked questions section for information on the URL-related options on this screen.
Installing Plugins and Themes
Installing a Theme
The next step in creating your multi-lingual site, unless you happen to like the default WordPress theme, is to find a theme, and install it. Themes can be found in the WordPress Theme Repository and other web sites. Important: Get an internationalized theme, if possible. If you cannot find an internationalized theme that you like, than get an English-language theme. Internationalizing a non-English theme is much more complex than internationalizing an English-language theme, and you will need to have an internationalized theme in order for its text to switch between languages using the Language Switcher. To install a theme:
- Download the theme from the repository, or anywhere you found it. It should come in a zip file.
- Unzip and upload the theme's distribution files into the WordPress "themes" directory on your site, which is under "wp-content" (unless you changed the content directory location, using WordPress 2.6 or later).
- Visit the WordPress administration page, click on "Presentation" or "Design" or "Appearance" (depending on your WordPress version), and activate your new theme by clicking on it.
Installing Other Plugins
The next step is to find and install other plugins; you can look for plugins in the WordPress Plugins List. Besides Language Switcher, which you should have already installed, you should install any other plugins you plan to use at this point. To install a plugin:
- Download the plugin from the plugin's home page (linked from the repository). It should either come in a zip file, or as a bare PHP script.
- Unzip and upload the plugin's distribution files into the WordPress "plugins" directory on your site, which is under "wp-content" (unless you changed the content directory location, using WordPress 2.6 or later). Follow the plugin's instructions -- some plugins go into sub-directories of the plugins directory, and some go directly into the plugins directory.
- Visit the WordPress administration page, click on "Plugins", and activate your new plugin.
The next page on this site is Theme and plugin modifications.
Questions, Comments, and Bugs
Jennifer Hodgdon, the owner of Poplar ProductivityWare and the author of the Language Switcher, would like to thank everyone who has sent in bug reports and suggestions about the Language Switcher. It would not work so well without your help! Language Switcher is based on Polyglot, by Martin Chlupac (the flags came from the Polyglot distribution), which was in turn based on Language Picker (which no longer exists).
The Language Switcher plugin is provided free, with no warrantee and no guarantee of service or support. And as of April 2010, further development on this plugin has been discontinued (please see note at the top of this page for more information).