qTranslate is another plugin for multilingual WordPress. It works much differently from WPML. Instead of having different languages in different posts, qTranslate places all languages in the same post.
This importer tool splits the content of different languages to different posts, allowing your site to run with WPML.
The plugin is available from the WordPress plugins repository:
Single-Language Conversion (no WPML, strip all translations)
If you’re using the qTranslate Importer plugin without WPML, the output will be a site with just one language. The conversion process will ask you which language you want to maintain. All other languages will be deleted from the site.
This is useful if you’ve been experimenting with qTranslate and now you want to clean the database from all those language meta-tags.
At the end of the processing, all posts will have just the one language that you choose.
How it works:
- Disable qTranslate and enable the qTranslate Importer plugin.
- Backup your database. Seriously, even if you’re just experimenting, you have to backup your database.
- Go to Settings->qTranslate importer and choose the language that you want to keep.
- Click on the ‘Clean’ button. This will go through all the site’s content and remove the language meta data from the content.
The plugin screen looks like this:
Choose which language you want to keep and accept the two checkboxes. Then, you can start the cleanup.
Multi-Language Conversion (convert from qTranslate to WPML)
If you have WPML, the qTranslate Importer will convert the site from all languages in one post to different languages in different posts. When the conversion is done, you’ll be able to use WPML on the site.
The best way to do this conversion is to disable, qTranslate, enable WPML and the qTranslate Importer and let it do everything automatically.
The import process will:
- Check which languages qTranslate had used and enable the same languages in WPML
- Check which language permalinks you used in qTranslate and choose the same setting in WPML
- Process all posts, taxonomy and custom fields and create separate ones for different languages
- Produce URL rewrite rules that allow you to redirect incoming links to their new URLs
To do this in a safe way, please follow these steps:
- Disable qTranslate and enable WPML and the qTranslate Importer plugin.
- Backup your database. This is critical. You have to do this before running the import.
- Go to Settings->qTranslate importer and review the planned data conversion.
- Click on the ‘Start’ button. This will go through all the site’s content convert it to use WPML.
The import-to-WPML process
The import screen looks like this:
As it runs, you’ll see the progress. Don’t interrupt the import process until it says ‘complete’. The screen should update every few seconds, as it processes 10 posts at a time.
Adding URL redirects
Once the import completes, you’ll see this:
If you can edit the .htaccess file, copy everything from the .htaccess rewrite-rules box and add it to your site’s .htaccess file.
There’s a ‘validate’ button which will read that file and check that you added the rules to the correct location.
Alternatively, you can add the redirect information to your theme. Click on the button to download the PHP file with redirect rules and save it in your theme’s folder.
Then, add the following line to the functions.php file in the theme:
include TEMPLATE_PATH . '/qt-importer-redirects.php';
This is a PHP statement, so it should go inside a <?php … ?> block.
Other texts that you might have to edit manually
Many sites that use qTranslate have used the language meta tags in various places, hard-coded in PHP or in option pages. Once you move away from qTranslate, you’ll need to use different ways to translate these strings.
First, locate them. Go through different admin screens in your theme and plugins that you’re using and see if there are any tags like:
<!–-:en–->English text<!–-:–-><!–-:fr–->French text<!–-:–->
Replace these with just the text in the default language.
Then, you can use WPML’s String Translation module to translate these to any language.