Multilingual

Posted in work with tags , .

May 27, 07

Comments

Trackback

I always keep my words, since I am a gentle man :-) , and most importantly, F1 Monaco finished for a long time :-p

This post is about a plugin of wordpress, which is the best blogging system of the world. And I have composed a static page for this plugin: http://www.imluke.net/ideas/mlpost.htm. That should be where you find the usage/download/install instruction of my plugin.

And in this post, I just want to have a brief explanation of the making of this plugin. If you are still interested, read on please.

It was 1 year ago when I started this journey: A little bit forward. I lurked around to look for a simple and extendable blog system before that. One day I clicked a button on my dreamhost CP occasionally and the blog was there. I tried and found that it’s good enough for me, and I was happy with the fully customizable theme. After that I made some plans to modify my blog.

After some bad attempts, I managed to write this plugin to add a language meta to a post. From the functionality aspect, it’s really simple: add a meta to a post. But for me, it’s my first plugin, thus it’s complicated. It contains 7 PHP functions, 6 wp action hooks and lots of remarks. It even selects and stores data to database… What a magic!:-)

Oooooooook, Is it useful? The answer is “Yes” for someone. After your post have a language tag, it will have a language attribute (lang=”XXXX” xml:lang=”XXXX”) in its surrounding HTML tag which is presented to the visitors browser. Although the visitor can’t see any difference in most of the case, it do helps the browser to present your article properly. … Check W3C’s explanation if you don’t know what I am talking about.

I want to do more with this language tag in the future. See, filter posts by language, add translation to a post. You can see in the end of this post there is and background tells you it’s written in English. It is a CSS trick that takes advantage of language attribute.

div.post[lang="en"] {
	background: url(../../../plugins/Multilingual/images/post-en.gif) bottom right no-repeat;
}

What’s next? For me, I am still waiting for WP’s approval to get this plugin listed on Wordpress official plugin list, although it seems to be failed until now. I will still work on this anyway to get it really useful. For you, my friend, please leave a comment to tell me what you think about this. I need your support to get it forward.

Ooooooooooops! Quite a long article…



9 Responses to “Multilingual”

  1.   国产WordPress插件大集合 by 王标个人博客

    [...] 插件名称(Plugin Name):Multilingual Posts 插件作者:Luke (http://www.imluke.net) 插件版本:20070527 适用WP版本: 2.0+???(只在2.2下测试过) 插件介绍:为文章跟page添加语言属性标签(html里面的lang属性) 插件页:http://www.imluke.net/ideas/mlpost.htm 插件帮助:直接联系我就好了,呵呵。不过一般不读站内邮件的。如果有问题可以在这里留言:http://blog.imluke.net/76_multilingual.html [...]

  2. Confused

    I am trying to install “multilingual” and have found that the file names in the instructions do not match the files in the download. Am I missing something here?

  3. Luke

    Thank you for your interest in my plug-in.
    This plug-in is now hosted on WP server, and the download is linked to that site. I got a official name: “multilingual-posts”.
    By using the SVN system to publish my releases, all the files are compressed in a zip file called: “multilingual-posts-XX.zip” where XX stands for the version. And when you extract it, a folder called “multilingual-posts” will be created. You can copy folder “multilingual-posts” to your plug-in folder, instead of “Multilingual” in the instruction.
    So the instruction is wrong now. I will change it in the next release. Thank you very much for your questioning.

  4. Andrew

    A useful addition to this plugin would be optionally add a dir attribute to an element when you add a lang attribute. Since sometimes changing language also requires changing the text direction.

    Andj.

  5. Luke

    Thanks for your suggestion.
    Since Chinese and English are all ltr, I didn’t notice there is a direction problem between languages.
    I will look into this and, hopefully it can be added in the next release – if I have time to work on this plugin these days.

  6. francisco

    Thanks for your attention.

    I wish to use the plugin, but i need to understand better what is the exactly function.

    I want to create a blog in two languages, for example spanish/english, and blog it from the same dash board.

    could it be possible?

  7. Luke

    My plugin just add a tag that tells browser what language a post is written.
    I don’t know what does “blog from the same dashboard” mean. If you want to write articles in many languages in one wordpress install, it’s possible even without my multilingual-posts plugin – just install a Spanish wordpress.
    I am currently blogging in both Chinese and English while my plugin is disabled most of the time. In fact, I call my pluin “a piece of sh*t”. It’s problematic for my in many aspect: styling, standard validations and so on.

  8. Carol

    Hello there! Im so envious when wordpress bloggers can type in both chinese and english. I want to achieve that too; but it seems like no matter what i do, it doesnt work.
    No matter how much i type in chinese or selecting the options in the post with your plugin, wordpress automatically converts all the chinese words into question marks.

    Ive tried changing the config and putting a chinese .mo file too; but still all the words change to question marks! I’d really hope you can give me some tips!

    Anyway; thanks for the hardwork :D Nice plugin thou it didnt work for me

  9. Luke

    My plug only wrap a html language tag to the post (currently only this, although many interesting features planed). It might help some browser to render the content batter. But in most cases, it is useless. Sorry.
    Your problem seems to be a configuration problem or db problem. To support Chinese, check the following settings:

    In wordpress settings, set settings->reading->Encoding for pages and feeds to UTF-8
    In wp-config.php, add this line: define('DB_CHARSET','UTF8');
    Make sure your db charset is set to UTF-8

    Using UTF-8 encoding, you can use almost every language in your post.
    One of my posts might help: http://www.imluke.net/blog/102_wordpress-database-utf8wordpress-database-utf8.html


Reply