Optimizing Global Translator Plugin for WordPress

By | 27/10/2008

UPDATE: Version 0.2 released

In the new theme designed for Gibni.com, one of the main goals is to attain maximum speed and shorter page loading times. This post is for people who have the basics of website optimizations. In this post, I’ll discuss a very popular WordPress Plugin, Global Translator, made by www.Nothing2Hide.net, which is used to provide translated version of your blog to visitors. This plugin improved a lot over time, and it gives better and better results after each upgrade. Latest version till date is 1.0.7.1, which is a stable version.

In the process of optimizing my website, I found out that this plugin consumes a large amount of loading time and keeps pages in a loading state for a long period of time, and it makes many connections busy between the client and the server to download all the flag pictures to the client’s computer. This slows down the page as there’s a limited number of simultaneous connections allowed between the client and the server. On the other side, this increases the ‘account hits’ on shared hosting plans.

To make the plugin and the page load and respond faster, I’ve thought of a solution, which is: instead of the plugin sending multiple small image files, it should send a merged image file containing all the required flag images and generate an image map to build the links.

First of all, I’ll stick to a specific model, which is a single line bar. The functions are easy to understand an you can build any shape you want.

Now I’ve to edit Global Translator’s core to give flag images to the merging script. and then create an image map for the translator bar.

After a lot of tests, I finally figured it out! You can find the code for ‘translator.php’ in the Page.

My modified PHP, will generate a fresh PNG file upon user request and store it in the root directory and then creates an image map to create the links for the translator. The good news is everything remains dynamic and if you change the combination of translations available, the PNG and Image Map will change automatically too!

There are still improvements to be done, for example, forcing the code to create the PNG file in the plugins directory and not the site root! So, if you have any ideas, just let me know!

Category: Ramblings Tags: , ,

About Gi

I love new technologies and try to use them in my everyday life. Since many years ago, I write about these technologies, and provide solutions to the issues people might get using the new world. I tested and experienced the solutions I provide. I love helping people, and that's why my publications have been free until now.

5 thoughts on “Optimizing Global Translator Plugin for WordPress

  1. Janine

    Unfortunately, anyone who reads a translated version of your blog will think you don’t know how to write. These automatic translation tools can sometimes give you an idea of what the blog is about but they are not able to correctly translate the inherent ideas.

    Reply
  2. Gi

    @Janine: I agree with you about the translated versions of the site, and I advised visitors to try to read the articles in their original language (which mainly is English or French for the moment), and visitors should know that translated versions are there only for the sake of giving the general idea of a post to a person who cannot understand any of the main languages. So I’d like to apologize to non-english speaking visitors who find errors in the translated versions. I do not control or write translated versions and they are processed by automatic scripts.
    Thanks.

    Reply
  3. Rajesh

    Hello GI, This improvement in Global translator plugin is very good. Now 1.0.9.1 version is released. can you pls update your plugin so i can use it at my site.

    Why dont you share it with n2h so it will be shared with all the community

    Great improved my site performance a lot when i tested it.

    Thanks
    Rajesh

    Reply
  4. yudi

    i already use this plugins in my site..it’s very slow generate the pages, i have 1100 pages and 100 pages only translate in one week..anyone have solutions?

    Reply
  5. Marty Rydzewski

    Good work buddy, continue the good work.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge