xLanguage (Wordpress Plugin)
Monday, January 21st, 2008
這個WordPress plugin使你能夠用多種語文來寫Blog,同時讓讀者選最適合的語文版本來看。若你想完全將你的Blog本地化成多種語文,這個Plugin應該能應付閣下的要求。
xLanguage使你能夠在以多種語言來寫Blog,同時讓讀者選擇他們想看的語言版本。這Plugin的功能可應用在Blog post、頁面、標籤、分類等等。讀者的選擇亦會對MO翻譯檔有效。
這Plugin是以高度自訂化為設計大前題,歸根究底,閣下想架起一個多語Blog為的大概都是想給讀者一個度身訂造的環境吧?所以,語文設定的彈性是超高的,可容許不同語言交叉重疊。所有使用者介面的部份都已獨立出來,可通過Theme檔來直接重載,而絲毫不動Plugin檔。
本Plugin的工作原理是利用W3C標準的<span lang=”..”>標籤把不同語言的段落標籤好,被存取時則利用XML parser按讀者需要的取出來。這Plugin也照顧到Permalinks和RSS feed。至於單行的資料例來Post的標題等等,只需利用一個簡單的方式改寫就可以實現多語功能。
讀者的語言偏好是首先從瀏覽器設定測出來,繼而透過Cookie保存。本Plugin也提供了Widget和Template函數,方便讀者轉換顯示語言。
這繼續參閱安裝程序、使用手冊、畫面截圖、同類比較和己知問題。若你覺得這個Plugin有用的話,請考慮支持一下吧。
若你有想要的Template functions,或者有任何可以改進本Plugin的想法的話,請不要客氣,盡情提出吧!
Notice
If you hit the following error message after installation:
can not redeclare class xLanugagePlugin on line 996 in xlanguage.php
Resetting the xLanguage configuration would help. To do that, please go to “Settings -> xLanguage -> Options” in the Admin control panel, Scroll to the very bottom and reset it.
This is a known problem but I can never reproduce this so have no idea how to fix it. Any volunteer in helping me is very welcome!
Change Log
v2.0.1 (r84024)
- New features: Now you can hide those post written in foreign that reader can’t read. See the updated user guide in the next few pages.
- Now it’s easier to put the flag icons! See the updated user guide in the next few pages.
- Support Wordpress 2.7.0
v1.3.3 (r44242)
- #9 is regressed causing xLanguage installation dead on arrival. Now fixed together with #10.
- This new version should solve the v1.3.2 installation problem.
v1.3.2 (r44032)
- #9 is fixed - xLanguage should be usable in WP-MU now.
v1.3.1(r43326)
- #8 is fixed - The static homepage bug introduced in v1.3.0.
v1.3.0 (r42456)
- New feature #4 is implemented. In addition, to http://example.com/page/something/lang/en, now it could be http://example.com/lang/en/page/something.
- No other bug is fixed.
Licensing
This plugin by Sam Wong is licensed under the CC-GNU GPL.

































































中文
粵語
January 8th, 2009 at 1:35
Hi Raúl. No there is no way to remove /lang/ yet, but this is surely one of the most popular requests and I am listening.
Category and tag: use the single line mode, like how you write post title. that is, separated by |. Use single line mode on the “Name”, while keeping using simple english for the “Slug”. For posting under new tag, please tag your post with a correct slug first then go back to the management interface to modify the name into multilanguages.
January 8th, 2009 at 1:27
Hi Sam!
First off all, regards for the plugin.
I’m trying to get rid easily from that ugly “/lang/” in the permalinks. Can you help?
Also I’ve found nothing in the usage guide refering to categories or tags. How can i define the language for those?
Many thanks in advance and best regards.
PS.: Don’t you have a forum or something where to support?
January 7th, 2009 at 7:20
Hello Dear Sam,
Please don’t forget about me… I’m still struggling with the _ES -es thing (see comment #348 above). Is there something I can do to help solving this? I’ve seen some people having the same problem.
THANKS A MILLION!
January 7th, 2009 at 5:57
Hi Sam,
I’ve noticed a problem after upgrading to WP 2.7 and unfortunately xLanguage 2.0.1 doesn’t solve it: on my blog front page I have links to the various language versions (<a href=”/lang/en”> et cetera) and clicking them now says 404 not found!
A workaround was to go to xLanguage’s preferences and change permalink style from prefixing to postfixing. For me it’s not really a big issue. However, due to the warning about postfixing not working with paged comments and other plugins, and because other users upgrading will likely see this I thought you would like to know..
January 7th, 2009 at 4:50
Ooops, writing my mail and seeing your mail again I figured out that I have to rename my files to de-de.png, de-de-active.png sorry etc. now it works thanks!
January 7th, 2009 at 4:45
Hi Sam,
well for example the german flag is here: http://www.yogie.de/wp-content/themes/yogie-mod/view/xlanguage/images/de.png and there is also de-active.png, en.png and en-active.png.
In my settings I use de-de and en-us as locale codes…
How should the permissions of the images look like?
January 7th, 2009 at 4:23
Andy: sorry I (half accidentally half intentionally) changed the default template.
Please use the old template to restore the previous look and feel.
The template of the previous version could be downloaded at http://plugins.trac.wordpress.org/browser/xlanguage/tags/1.3.3/view/xlanguage
Put it (other_post_lang.php) into /wp-content/themes/_YOUR_THEME_/view/language (create the folder as needed)
Louis: Removing the /lang/ this is not possible just yet. Stay tuned.
Yogie: Please do me a flavor in checking a few things. 1. The filename is correct, “xx” is corresponding to your language code, and it is CASE Sensitive. 2. The files are uploaded with correct permission. For example, here is my files structure under /themes/.
hellosam1/view/xlanguage/images
hellosam1/view/xlanguage/images/en-active.png
hellosam1/view/xlanguage/images/en.png
hellosam1/view/xlanguage/images/zh-active.png
hellosam1/view/xlanguage/images/zh-hk.png
hellosam1/view/xlanguage/images/zh.png
hellosam1/view/xlanguage/images/zh-hk-active.png
January 6th, 2009 at 23:26
Hello,
First, thanks for for this good and really extensive plugin !
I’d like to know how I can delete le word “lang” in my url,
to have this
http://www.example.com/fr/date/post
instead of this
http://www.example.com/lang/fr/date/post
Thanks
January 6th, 2009 at 22:38
Well to me simply adding the xx.png and xx-active.png files will not work
I added them into /wp-content/themes/”mytheme”/view/xlanguage/images/ and also into the plugin folder - No Success!
January 6th, 2009 at 21:48
Hi again.
I have had a bit of time to re-read your new instructions for installation and have discovered that I had to recreate the view/images folder inside my theme. This now works to show the flags (but the flags only) whereas before it showed “[flag] Other language name” etc.
Where can I add the code so I can show the language name and the flag?
thanks,
Andy