How to Import from qTranslate to WPML

You’ll find 2 famous plugins to create multilingual WordPress website: WPML and qTranslate. I’m using qTranslate for this blog as I posted before but I changed to WPML. I will share the reason why I left qTranslate and how to import to WPML.

[adA-en]

What is the Difference?

Save as the Same Post or Not

qTranslate places different languages in one post. WPML saves different languages in different posts. That’s why all language pages are saved with the same post ID with qTranslate but WPML is not.

The Way to Translate Theme Files

qTranslate uses this tag to translate strings:

<?php _e("<!--:en-->English<!--:--><!--:ja-->日本語<!--:-->"); ?>

and WPML uses WordPress default tag:

<?php _e('Hello World!','themename'); ?>

If you use qTranslate, you need to write all languages in the same line which makes theme files messy.

Price

qTranslate plugin is absolutely FREE! It’s easy to start to create multilingual website. But WPML isn’t free. “Multilingual Blog” for your personal blog is US$29 and “Multilingual CMS” for client website is US$79. You can install and use WPML on any number of sites and they offer 30 days money back guarantee. Please have a look WPML Purchase page for more information.

I’ve Got a Problem!

It was getting harder to connect to this blog especially when I posted new articles these days. It seemed it was not because of my web server. Then I checked which plugins are slowing down by P3 (Plugin Performance Profiler).

qTranslate

Then… You’ll see most of runtime is taken by qTranslate.

qTranslate Loading Time

It took about 0.8 sec only qTranslate. You’re a criminal!

Switch to WPML

So I decided to WPML which I’m using for my portfolio website. Free plugin qTranslate Importer which WPML team developed allows a complete uninstall and cleanup of qTranslate meta-tags or importing translations into WPML. The best way to do this conversion is to disable, qTranslate, enable WPML and the qTranslate Importer and let it do everything automatically. Please follow these steps:

  1. Disable qTranslate and enable WPML and the qTranslate Importer plugin
  2. Backup your database
  3. Click on the ‘Start’ button

htaccess

Once the import completes, you’ll see lots of text in a text field. Copy everything from the .htaccess rewrite-rules box and add it to your site’s .htaccess file.

See qTranslate Importer – WPML for more details!

Set Up WPML

I think you don’t need to change so much on your WordPress dashboard if importing is completed properly. Check if there is no problem on posts, pages, categories and tags to make sure.

Translate Theme Files

This is what I took time the most. Please follow step by step guide below.

1. functions.php

Open a functions.php in your theme folder and add following line. “themename” should be your theme name. Create functions.php if you can’t find it.

load_theme_textdomain('themename',dirname(__FILE__));

2. Replace Strings

For example, if you want to display “English” on your English page and “日本語” on Japanese page, qTranslate tag should be:

<?php _e("<!--:en-->English<!--:--><!--:ja-->日本語<!--:-->"); ?>

Replace this line with following WordPress default tag:

<?php _e('English','themename'); ?>

Change “themename” to your using theme name.

3. Create .po File

.po is a file containing the instance of translated strings for a single language based upon a POT file. Open text editing tool like Text Edit or Notepad and create new file. File name will be “ja.po” if you want to translate to Japanese. Then write these text.

msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "English"
msgstr "日本語"
msgid "Hello"
msgstr "こんにちは"

msgid is the source message and msgstr is the translated message.

4. Convert to .mo by Poedit

The file that you have to upload to your server is .mo file which is an optimized machine-readable binary file. Let’s download Poedit that can convert from .po to .mo automatically. Simply open .po file on Poedit and save it. You’ll see “ja.mo”file is created! Put ja.mo to your theme folder.

Are You Lazy?

WPML String Translation 画面
If you bought “Multilingual CMS” ($79), you can use WPML String Translation. Static texts in PHP files can be translated right from within the WordPress Admin. It will be a great option to save your time!

Conditional Tag

If you need to change contents by language, you can use following code:

<?php if (ICL_LANGUAGE_CODE=='en') { // English ?>
     Display English
<?php } else { // Japanese ?>
     日本語を表示
<? } ?>

Result

WPML

Sitepress… is WPML. WPML still has large percentage, however an entire plugin road time is decreased by half!

WPML Loading Time

qTranslate took 0.79 sec, but WPML takes 0.26 sec!

Wrapping Up

I recommend to use qTranslate only if you have a small site because it takes time to road even if it’s easy to manage. But the best way is to test both plugins by yourself. I hope your blog will be translated to many languages and spread the world!

シェアする

コメント

“How to Import from qTranslate to WPML” への1件のコメント

  1. I am going to give it a go. I hope it is easy as yours seems to have gone.

ニュースレター

Web制作の最新情報やWebクリエイターボックスからのお知らせ、中の人の近況等を定期的にお送りいたします。 ぜひご登録ください!もちろん無料です! :)