xLanguage (Wordpress Plugin)
Monday, January 21st, 2008
Contents
A WordPress plugin that allows you to blog in multi-language, and users to select which to read. If your want to localize and present your blog in different languages (totally with title, rss, categories working, not just the post) and allows visitors to pick the language they want, this plugin is for you.
xLanguage allows you to blog in different language, and allows user to select which version to read. It works for blog post, page, tags, categories. The user language preferences will also select the right theme and plugins MO files.
Customization is the No. 1 design goal, after all that’s probably the reason why you want to setup a multilingual blog. The language configuration combination is highly customizable to facilitate multiple fallbacks. Every UI is extracted out, which could be optionally overridden by theme design without touching the plugin file at all.
This plugin works by inserting W3C standardized <span lang=”..”> tag in the post content, and a XML parser will be involved to extract them when served, extracting all elements with the matching lang=”..” tag. The permalinks and RSS feeds are also presented correctly. For single line data such as post title, a special but simple syntax is introduced.
The language preference is detected from browser’s preferences, as well as from Cookie if user visited before. Widget and template functions are also provided to allow user to switch the language easily.
Please read on for the installation, complete usage guide, screenshots, comparisons and known problems. If you found this plugin useful, please consider supporting it.
Please feel free to let me know if you need additional template functions, or if you have any idea that could make this a even better plugins for you.
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
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 29th, 2008 at 5:54
I get the following error (top all pages) after installing xLanguage:
Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of xml_set_object(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in /home/../wp-content/plugins/xlanguage/parser.php on line 96
January 29th, 2008 at 8:29
I should have it fixed by now. Would you please verify the v1.0.3 for me please? Many Thanks for reporting.
January 29th, 2008 at 11:00
Thanks. That was the problem… I now have the latest version, and it fixes the problem.
January 29th, 2008 at 11:27
I get a fatal error when activating your plugin,
Parse error: syntax error, unexpected ‘&’, expecting T_VARIABLE or ‘$’ in /mnt/gs02/herd03/28321/domains/blog.tweedledeed.com/html/wp-content/plugins/xlanguage/xlanguage.php on line 607
I am running the newest version of your plugin and the newest version of wordpress. Please email me with any idea you may to why this is. Great looking plugin BTW.
January 29th, 2008 at 23:43
The same problem as Tony have. I am running the newest version of your plugin and the newest version of wordpress and get following error “Parse error: syntax error, unexpected ‘&’, expecting T_VARIABLE or ‘$’ in /home/redbridg/public_html/touree/wordpress/wp-content/plugins/xlanguage/xlanguage.php on line 607″
January 30th, 2008 at 0:28
Fatal error: Undefined class name ’self’ in /home/redbridg/public_html/touree/wordpress/wp-content/plugins/xlanguage/xlanguage.php on line 406
January 31st, 2008 at 6:16
for me this plugin just doesn’t work. I use the latest wordpress, plugin installs fine, languages set up as described, toolbar shows up, but it doesn’t do anything! any ideas?
February 1st, 2008 at 13:11
Nice plugin. I’m trying to make it work with Hebrew (which is Right-To-Left language). I disabled the auto-detection using browser because my site is mainly in Hebrew and detection doesn’t work well. You might want to add an option to disable auto-detection manually.
1. After installing I see that the buttons for RTL/LTR paragraph are missing in TinyMCE which makes it impossible to edit a document in both RTL/LTR languages at the same time. I modified tinymce-plugin.js to add an attribute while setting lang like this:
if (lang == ‘he’)
Do you have an idea why those buttons are gone?
{
e.setAttribute(’dir’, ‘rtl’);
}
else if (lang != ”)
{
e.setAttribute(’dir’, ‘ltr’);
}
It’s too buggy in Firefox (affects unrelated elements). I can’t fix this
2. For some reason I can’t make it work with the “|” splitter. I has to change to another splitter which works.
3. Widgets titles and built-in widget titles aren’t affected by translation for some reason.
4. There’s a need for some function to control translation of themes (with local text)
5. bSuite and InnerIndex (table of contents) cannot work with this plugin. If you can find a solution for auto-generated multi-language table-of-contents (based on tags) it would be great.
6. I’m looking for a way to clean multiple tags in TinyMCE. I find myself looking into the HTML code trying to fix the lang tags because it gets too messy in Firefox after working with a document for some time.
7. Category description isn’t working with the splitter for some reason. It can be used with more than one line but your code checks for “\n” which makes it not work. I had to hack the code like this:
//if (strpos($content, $this->options['split']) !== false && strpos($content, “\n”) === false) {
if (strpos($content, $this->options['split']) !== false && ! (strpos($content, “”) > 0) ) {
I also fixed some other issues with the category description. I use this field for display although it’s not really used by default with WordPress.
It’s got great potential if you can fix the bugs
Thanks!
February 1st, 2008 at 13:23
Missing html tags in my last comment:
5. (based on “” tags)
6. Correction is like this:
if (strpos($content, $this->options[’split’]) !== false && ! (strpos($content, “ “” ”) > 0) ) {
February 1st, 2008 at 23:59
[...] 暂时disable了xlanguage,有一篇一直显示不正常。 我觉得不该用parse xml来作这件事,但我也想不到更好的方法。 var blogurl=”http://leen.name/blog”; var needemail=”"; Name [...]
February 2nd, 2008 at 0:19
Amir:
I will try my best to solve the RTL problem.
Meanwhile, for the plugins/widgets problem, you need to insert the code
apply_filters('language', 'this_is_the_text|to_be_translated');in appropriate place, so xLanguage can filter the content.for Theme Translation, you could use the same apply_filters code at this moment. I will expose a shorter template function in the next version.
February 2nd, 2008 at 1:07
[...] The xLanguage plugin have got quite amount of feedbacks. Many thanks to [...]
February 4th, 2008 at 7:41
I was hoping this plugin is what I need. Sadly, it seems to be incompatible with several other plugins I use. Notably the pictures added on my main page (pure html with Lightbox2) produce “xLanguage parse error: not well-formed (invalid token):” error. Same error is visible on top of my “contact” page with a nice cforms contact form put there. After I turn xLanguage on, the contact form gets duplicated, and the whole page layout gets messy. Any idea how to make it work?
Cheers
February 5th, 2008 at 1:51
Hi,
after clicking activate plugin I’m getting:
Fatal error: Call to undefined function: register_sidebar_widget() in http://www.mydomain.hu/testing/wp-content/plugins/xlanguage/plugin.php on line 500
I use wordpress 2.3.2 and bbsync plugin.
Any suggestions?
February 5th, 2008 at 2:33
I’ve disabled that “xLanguage parse error” by replacing this line in parser.php
//$ret = ‘xLanguage parse error: ‘ . xml_error_string(xml_get_error_code($this->parser)) . ‘:’ . substr($this->content, 17);
$ret = substr($this->content, 17);
It appeared in my website in various places but it’s harmless as far as I can see.
Plug-ins compatibility can be a problem. I already edited some plug-in and others I had to disable (bSuit).
February 5th, 2008 at 14:36
monyoking: That’s very strange. Because register_sidebar_widget() to the way to get the xLanguage widget. On the other hand, can you use any widget on your sidebar? May I suggest you to double check your installation, in particular, make sure the file wp-include/widgets.php is in place.
Amir: it’s because the plugins installed doesn’t produce correct XHTML code, but the parser heavily depends on it. If your website can pass http://validator.w3.org/ XHTML1.0 Transitional with xLanguage turned off, there shouldn’t be any problem. I will include a log in the next version to capture the errors, so user can revisit the problem in the log, instead of showing this embarrassing message.
February 5th, 2008 at 20:12
Hi HelloSam, thanks for the fast reply, widgets.php is in place. I can use sidebar widgets, but I’m using k2 theme too, maybe it has something to do with sidebar widgets.
February 5th, 2008 at 23:47
[...] 多语言网站(尚未测试):http://hellosam.net/project/xlanguage [...]
February 6th, 2008 at 8:08
Mmmh, it seems, that the plugin not only has problem with “invalid” XHTML, but with some kind of characters or gaps in some places too. I can often reproduce Parse errors with the chars “:” or “(” immediately after the Span tag. Can anyone else confirm this behaviour too?
February 7th, 2008 at 5:14
Hi, there is a strange phenomenon after activating the plugin. Some (not all) of my postings are repeatedly displayed.
Using PHP 4. Any idea?
February 7th, 2008 at 23:27
Right. I have receive many reports about the repeat problem and will surely investigate and fixing it in the next update.
February 8th, 2008 at 8:20
Hi HelloSam, nice plugin indeed, works fine with the entry content and category names.
I am writing you because my posts also use the_meta content, but I can´t find the way to use the splitter or your scripts for the post-meta-key, to make them multilanguage too. Any sugestions will be more than welcome. Thanks in advance. And happy chinese new year!
February 8th, 2008 at 16:40
happy new year too! I like your Godess Quan Yin
February 9th, 2008 at 3:50
xLanguage needs K2 sidebar manager support.
February 9th, 2008 at 4:10
[...] no como antes que había uno en inglés (el principal) y otro en español. Ahora, gracias al plugin xLanguage, se puede leer el blog en 2 idiomas, desde los post hasta los [...]
February 10th, 2008 at 1:29
It’s a great plugin! Just what I needed
It took me a while to figure out how to use “apply_filters” to translate certain theme elements.
Here is the full code snippet:
February 10th, 2008 at 1:39
And one more try…
echo apply_filters('language', 'Author|Автор');
February 11th, 2008 at 9:08
If it is of any help, I also get repeat but there seems to be a patern.
example:
posts original
Line 1
Line 2
Line 3
Line 4
Line 5
then repeats
Line 3
Line 4
Line 5
then repeats
Line 4
Line 5
Continues till there is no more lines.
code is (with no tics:
‘Line 1
Line 2
Line 3
Line 4
Line 5′
No other language/translation in code.
Thanks great plugin once this kind of thing is worked out
February 11th, 2008 at 9:11
Sorry,
I hope the code shows up this time.
code would include
just before line 1 and would haveafter line5.February 11th, 2008 at 9:13
OK lol
It has the “span lang=…” before line 1 and “/span” after line 5
February 14th, 2008 at 19:51
Hi Sam, thank you for your great plugin! I wanted to ask you, if there’s any possibility to translate the post_name-field (post slug) with the single-line-filter option? thanks in advance… tommy
February 15th, 2008 at 13:25
Hi Sam, hopefully this will help you to solve the repeat problem. For me it only occurs when the break
tag is being use in the content. whenever there is a repeat line i will see</xLanguagePFebruary 16th, 2008 at 7:15
I am interested in getting this plugin modified for SEO as well, are you interested in upgrading and fixing the bugs for some $ and at the same time having a better language plugin? Please contact me.
February 18th, 2008 at 5:11
[...] Monday, February 18th, 2008 As I have mentioned in the eariler post, I was working to fix some critical bugs and at the same time putting some more features into the [...]
February 18th, 2008 at 7:34
Thanks alot for your plugin!
One question though: Is there a way to stop the plugins work for a certain page?
(One page here (a monoslideshow in it) needs a certain url and gets confused handling “/lang/de” or “/lang/en”.)
cp
February 18th, 2008 at 10:00
[...] This morning, i have an idea. I want to make this site as a multilanguages site. So, i searching for some wordpress plugins. There are a lot of plugins. I am trying to select it. And i get this one. [...]
February 19th, 2008 at 5:17
1. The usage guide has been updated, with lot more information, should worth a read. May I also take this chance to ask you to turn on the Feedback system, if you are using > v1.1.0?
2. There was a deployment bug in v1.1.0 that I should have caught earlier, blocking all new installation. Now fixed.
February 21st, 2008 at 11:06
[...] i want o add plugins for myblog, searching this and that and i found xlanguange plugins form wp in here and there. i try to adding the plugins in wp, but when i activated error appeared. i retried to [...]
February 22nd, 2008 at 17:40
when I add relative URL in tags, the it gets confused with “/lang/en”.
e.g. current url: http://www.abc.com/level2/lang/en
URL in : level2a
The result turns out http://www.abc.com/level2/lang/en/level2a NOT http://www.abc.com/level2/level2a/lang/en
Is it any way or settings I can fix it? Thanks.
February 25th, 2008 at 19:15
hi Sam, thanks for this great tool. In my case it does work well, apart from the small icons next to the language names. They show up only for English. If i add other languages, there is error. Any idea what’s the issue here? please take a look at http://www.yeongumaru.com. Thanks. Dom
February 26th, 2008 at 19:02
Dom: In the plugin package, it includes a PSD file which is used to draw the English icon. You are feel free to use it and draw the others for yourself as you like. It’s just so hard for me to come up with the design for every languages for every blog
February 27th, 2008 at 23:19
Great Plugin!
I still have one small problem. I use the breadcrumb navigation plugin (http://sw-guide.de/wordpress/plugins/breadcrumb-nav-xt/) aswell. Now when displaying the breadcrumbs, I get this effect: “germantitle|englishtitle” instead of either “germantitle” or “englishtitle”
…
Is there a way to solve this problem?
Thanks!
chlori
March 1st, 2008 at 4:12
[...] xLanguage otro plugin muy completo para disponer de tu blog en varios idiomas a la vez, de forma total. [...]
March 1st, 2008 at 20:19
I get this error:
Warning: fopen(/path/wp-content/xlanguage-parser-19824958371540390088.log): failed to open stream: Permission denied in /path/wp-content/plugins/xlanguage/admin.php on line 134 Warning: fclose(): supplied argument is not a valid stream resource in /path/wp-content/plugins/xlanguage/admin.php on line 135
It is a new wordpress installation with no other plugins activated.
March 2nd, 2008 at 12:54
I have fixed the error by chmod. I think the plugin does not work, because I do not see the toolbar for it when I write. And when I create categories and use | I don’t get different versions when I pick language.
Here is my test site: http://d21306.u40.imountain.com/?cat=1&lang=en-us
Thanks
March 7th, 2008 at 13:33
Hi Sam,
great plugin!
but… (you might’ve expected this:-):
how do I manage the tags? I’m using the Configurable Tag Cloud Widget (http://reciprocity.be/ctc/) and like to see the xLanguage also in this tag cloud.
Thanx in advance!
Volker
March 10th, 2008 at 1:17
Hello, works just fine now, but you have forgotten the blogroll categorys. Even if i use “|” for splitting english and german, the Categorys of my Blogroll won’t be translated. I always get both languages…
Thanks, Timo
March 10th, 2008 at 23:19
Great plug in! But I too am having a few problems with the English tags.
Cheers,
Tristan
March 11th, 2008 at 0:40
All your comments are heard. Thank you very much.
Tags is tricky because the way that Wordpress handle it. Please allow some more time for me to find a solution.
Timo: For the blogroll category, opps I have forgot to add it. This can be fixed in the configuration without upgrading. Please go to the Options tab (3rd one) of the xLanguage options page, then add “,link_category” to the Filter Hooks -> text, then the blogroll will be processed automatically.
March 13th, 2008 at 2:41
“For single line content, please adopt the single line filtering mode syntax.” but I don’t see any examples of how to use this “single line filtering mode syntax”.. can you provide an example please?
Thank you!
March 13th, 2008 at 15:22
Absolutely brillian plugin. I just got version 1.1.5 and it installed and configured like a breeze. I’m using it for an international art gallery — latincollector.com. My question for you is about the dates showing up in the archive selector generated using wordpress’s internal wp_get_archives() call, the months I am getting are not coming back in spanish. I can do a kludge fix for this inline, but was hoping it was something the plugin has already covered.
Thanks again! Once I get my check for this job I’ll be sending you a paypal contribution.
March 14th, 2008 at 1:51
Hello Sam
did it possible adaptive plugin for working with SEO TITLE plugin? http://www.netconcepts.com/seo-title-tag-plugin/
Like i understand need add filter, yeah? But where? Can you help?
March 14th, 2008 at 3:31
Another big problem - encoding
like many other i use UTF-8 encoding for wordpress
this mean my files in template save as UTF-8 encoding because they have russian text
So, your plugin output text in ANSI encoding and not UTF, of course last version IE and other browsers understand correct encoding and transform text for correct view but if you look into HTML code you see problem. Of course use not english text - example i have problem with russian.
March 15th, 2008 at 1:46
To use with seo-title-tag is easy, In the line that reads,
… if (function_exists(’seo_title_tag’)) { seo_title_tag(); } …
Change it to
… if (function_exists(’seo_title_tag’)) { apply_filters(’localization’, seo_title_tag()); } …
On the other hand, xLanguage is not aware of the encoding. It is basically doing thing blindly in ASCII (that’s how PHP work), so any ASCII compatible encoding should work, including UTF-8, which is the default. I am pretty sure Russian is covered by the UTF-8, and if you are not using it, I strongly suggest you to.
My blog is running in Chinese and English, absolutely no problem. I don’t think Russian can be more complicated than Chinese in terms of encoding. Please let me know if otherwise.
March 15th, 2008 at 16:09
Ok Sam thanx for SEO title
Now about encoding;
look to HTML sourse at [Link removed per request]
i use editplus editor(editplus.com) for html code and what i see:
Телефоны SEO компании|How to contact
But here can be Телефоны SEO компаний|How to contact
If i disable xlang plugin in html sourse all text and encoding is ok like can be.
Here is 100% problem with encoding
March 15th, 2008 at 22:28
Opps. I think I have made an mistake that you have figured out already.
For seo-title, you should modify the end of seo_title_tag() functions that apply_filters on the $title variable.
like echo wp_specialchars(trim(apply_filters(’localization’, $title)), true)
March 16th, 2008 at 2:47
Sam, thanx for help with Seo title plugin.
Here is manual.
Open seo-title-tag.php and found … echo wp_specialchars(trim($title), true); …(608 line)
replace to:
… echo wp_specialchars(trim(apply_filters(’localization’, $title)), true); …
Now use | like usually for title
March 16th, 2008 at 17:18
xLanguage plugin has greatly helped me, because I’m writing my blog with Chinese, Japanese, and English. I was looking for a plugin like this, I’ve tried gengo and jLanguage, which are not quite satisfying my task. But xLanguage is far more than I can expect a multilingual plugin can be. It solved all my problem once for all. I can see you are thinking deeply for the user’s need. Thank you so much for creating such a excellent plugion for wordpress.
March 17th, 2008 at 3:34
I really like your add-on but I don’t understand one thing: how do I see only the articles available in the selected language. I wrote in two languages but I think it is not quite a good ideea to show all posts for all languges.
March 17th, 2008 at 5:01
Sorin, I am afraid I have to disappoint you. xLanguage cannot do that, and there is no plan in implementing that yet. It need a very great effort to implement–
March 25th, 2008 at 0:48
Hi Sam,
first of all I have to shout out a big THANK YOU for this great plugin! It really fits my needs for multilingual blogging best. Donation will be on the way soon.
With the instructions you gave I was even able to hack the built-in plugins (Meta, Categories, etc.) in wp-includes/widgets.php to become multilanguage. Is there a more generic call to the widget-title somewhere in the plugin-system, so one doesn’t have to add it to every single widget title?
There only remain two problems:
1.) I am using the plugin ‘TinyMCE Advanced’to activate the advanced capabilities of TinyMCE. Unfortunately I can’t add anything to the 2nd toolbar, because then the xLanguage buttons will be wiped out and will only come back when I de-activate and re-activate the TinyMCE plugin.
But that’s only a minor point, more interesting is:
2.) Whatever I do, I can’t get the_date() to be multilanguage. If I deactivate xLanguage and set ‘WPLANG’ in wp-config.php, my monthnames are converted. With xLanguage activated, all language-specific date- & time-settings are ignored, the ones under Options->General always take precedence. I experimented with the filter hooks for xLanguage and by trial-and-error I can confirm that they do what they are supposed to. EXCEPT date_format and time_format which are hooking to pre_option_date_format (pre_option_time_format respectively), I can do with them what I want, nothing changes. Adding the_date() and the_time() as hooks anyplace else also doesn’t solve it. I also tried to this in my index.php:
filter_actions(’localization’,the_date());
but to no avail.
I am suspecting, that since the generation of the date/time is done via a PHP-call, one needs the proper locales server-side.
More so, because the ‘WPLANG’ translation seems to come from a language specific MO file.
I wil further investigate this and would be happy about any feedback from your side.
Keep up the good work!
Cheers, Falk
March 25th, 2008 at 1:32
Hi,
first, thanks for thsi great plugin. But i have a big problem with it. When trying to include so Flash-Content to a post, the xLanguage-Plugin does not work any more. Is there a known issue while combining flash content with the xLanguage Plugin? Is there a workaround to fix this?
Thanks
Thomas
March 25th, 2008 at 10:21
Hi there,
great plugin. Works like a charm, setup was easy and the documentation is well-written.
But I’ve one question: I’d like to use a localized version of the kubrick theme (german). For this, I downloaded the localized version of the kubrick theme from de.wordpress.org, uploaded it, and switched from the normal kubrick theme. Thing is, as long as the xLanguage Plugin is activated, the localisation of the german theme seems to be broken. As soon as I deactivate xLanguage, localisation kicks in.
In the category template (where I started to search for the problem), I noticed this difference:
normal template:
Archive for the ‘’ Categorytemplate with localisation:
the __( function should be part of the gettext framework that is used by Wordpress to translate the contents, but I don’t have any clue how this could interact with xLanguage. Any ideas?
Of course I could “simply” translate the whole theme again, but I’d rather like to use the already translated templates, which would save me a lot of time.
with best regards,
Lars
March 25th, 2008 at 10:23
sorry, looks like the example code got broken. Another try:
normal template:
<h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>template with localisation:
<h2 class="pagetitle"><?php printf(__('Archive for the ‘%s’ Category', 'kubrick'), single_cat_title('', false)); ?></h2>March 25th, 2008 at 21:20
Hi, Sam! I’m curious.. I want my date/timestamps to output from the database in the respective language.
what is the best way to accomplish this?
how can i get your plugin to call setlocale() for the approriate language?
March 25th, 2008 at 21:46
Wow. Here I get a 4, 5 replies in two days about WP_LANG, SetLocale, MO file, __(…) issue. I have to admit that it’s one of the weak area not being tested well, so sorry for the trouble caused.
This plugin is planned and designed to be compatible and actually work well and integrated smoothly with the MO translation, including the month and year date localization. But from the feedback, it turns out it doesn’t work expected. I am sorry that my schedule is a bit tight over this week, but I will surely look into these problems over the weekend to have it solved.
Stay tuned!
March 25th, 2008 at 23:49
Hi Sam,
there’s definitely no need for apologies
You put a fair amount of work into this plugin & right now it is the best at the task of multilanguage blogging in Wordpress. I also have to salute you for the extensive commenting of your code, although I only took a quick glance at it. Right now my priority is finishing the hacking and themeing of my own Wordpress installation (including the attempt to add more formatting options to PHP SmartyPants, underlying of wp-typogrify), but when I’m finished I am more then willing to help you out with any feedback and testing I can provide.
Cheers, Falk
March 26th, 2008 at 12:16
How do I get xLanguage to convert a WP Page?
I wrote my WP Pages in total as a regular php/html page and made them into WP page templates.
In WP, i just created blank PAGES with the approriate php page
if you can imagine it’s a few hundred lines of nested divs, tables, and what not. Two copies pasted one above the other: one French, one English.
they have the tags
andaround the entire nested div structures. like this:french>
french>
english>
english>
but it doesn’t do the trick!
how should i be using this?
March 27th, 2008 at 2:05
Hi Sam
I found a workaround for the_date();
setlocale(LC_ALL, 'fr_FR.UTF8'); //french
echo strftime( '%A, %D', strtotime(the_date('Y/m/d', '', '', FALSE)) );
lol. it works.
of course, you decide how you want strftime to do it’s thing.
i haven’t investigated fully as yet but you may have to use the single line filtering mode syntax to get the date to display grammatically correct for both languages.
if i knew how to ask what the current language was I would do something like this in my header:
if (currLanguage == french){
setlocale(LC_ALL, 'fr_FR.UTF8','FR') //english
}else{
setlocale(LC_ALL, 'en','EN') //english
}
how can i test for the current language?
March 27th, 2008 at 4:22
Hi,
Falk Koziol hinted that he was able to modify the widgets.php file. You would’nt by any chance have an example you could share?
Cheers
James
March 27th, 2008 at 20:44
Falk made a several attempts in posting the comment. I must thank for his effort. But because the system messed up his code somehow, I deleted his comment post on his request.
Animan: use xlanguage_current_language_code(). See xlanguage/template.php for details. (Well, there isn’t many details..just call it and it returns the current lang code)
James: You might want to look at the Page 4, Widget Title Customization. It should have everything you needed.
March 29th, 2008 at 19:14
Hi
Just wanted to thank everyone who took the time to reply. The explanations were clear and I was able to update my widgets.php file without breaking my site!
Cheers again
James
March 30th, 2008 at 6:26
Hello Sam..i have some problems installing this plugin..
i’am using wp v2.3.3
when i want to activate this plugin in the admin screen, it is written “Warning: fopen(/home/a5519167/public_html/wp-content/xlanguage-parser-11270409371712294128.log) [function.fopen]: failed to open stream: Permission denied in /home/a5519167/public_html/wp-content/plugins/xlanguage/admin.php on line 135
Warning: fclose(): supplied argument is not a valid stream resource in /home/a5519167/public_html/wp-content/plugins/xlanguage/admin.php on line 136″
what’s goin on here sam? could you tell me how to fix this problem? thank you very much..
waiting for your reply
March 30th, 2008 at 18:08
@ash-ray: I had the same problem. You can solve it by changing the write access of your wp-content directory, making it writable for the web server.
1. with ssh access:
cd /path/to/your/wordpress/directory
chmod a+rwx wp-content
2. with your ftp program: there should be a possibility to change access rights; there would be rights for read/write/execute
for the user, groups, and others. You would need to set all three rights for all three groups. It would be a good idea to do that NON-RECURSIVE, meaning you only change the directory itself, not all the files within
This should be considered a workaround, as it might not be a good idea to give write access to that directory in general, but it works. Maybe HelloSam can give you a better/securer solution. (I ran into the same problem, btw)
March 30th, 2008 at 18:32
Hi everybody,
Thank you for this interesting plugin, after trying it a little while, I get used to it now.
As anyone (like me) also tried the wordpress 2.5 release ? I have just did it and have a little trouble in the admin part : I cannot see the xLanguage toolbar when writing a post.
Do you have the same problem ? Would you have a little hack to get it back ?
By the way, Sam, if you are in Beijing at the end of the Olympic Games, we’ll be finishing our Paris to Beijing trip by car, we will welcome you
http://challengelogan.free.fr
March 30th, 2008 at 22:17
I’m having the same problem:
Any one have the solution?
Thanks for the plugin!
March 30th, 2008 at 23:23
If anyone has a solution please tell us
April 1st, 2008 at 0:16
Thanks LGW for your instant reply..^_^
You helped me, my problem was solved
but, i have another problem, same with Antonie and Bio, I cannot see the xLanguage toolbar when writing a post..
i need your help buddy, how to fix this problem..
Thank you very much
regards,
April 1st, 2008 at 4:50
It took longer then I expected to make xLanugage to be compatible with WP 2.5. As they have upgraded the TinyMCE from v2 to v3, the whole thing and API is just gone. Anyway, here it is! I didn’t do a full blown test on it yet so be sure let me know if you have catch any functionality bug on WP 2.5. At the meanwhile, the interface surely need some adjustment.
Because of that…I havn’t looked at the date_time, locale problem yet. I will take care of this ASAP. Sorry to have you waited.
April 1st, 2008 at 13:01
Bug report:
After I upgraded to version 1.2.0, the visual editor was disappeared.
Before that in 1.1.5, it’s fine just without xLanguage buttons.
April 1st, 2008 at 13:09
Add some information:
The bug happened in WP2.5, browser is Firefox 3.0 beta5pre
Visual editor disappears when xLanguage is enabled.
Works fine in Opera and other browsers ,though.
Could be a bug of Firefox :b
April 1st, 2008 at 13:46
There is another thing that bothers me is that:
When I deactive and re-active xLanguage again (like plugin automatic upgrade is WP2.5), the permalinks will be broken, and all contents with “lang” in the URL will become 404. It can be recovered by deleting all languages information, and input them again.
Not a serious problem, but please have an eye on it when you have time.
And a question:
Would you please to tell me how can I make xLanguage to filter the content when I’m using self-edited PHP and text and HTML widgets OR K2 sidebar module? I tried to input contents with language span tag but it won’t work. Only the title works, not with”|” but with span tags. It’s confusing me. ^^b
Thank you for updating this plugin in first time when WP is upgraded. And please take your time. Good luck.
April 1st, 2008 at 17:14
extvia: I had the same problem, but it was solved by rebuilding the permalink structure. I did not have to delete any language information. I did however loose the language buttons in the editor, and have not been able to recover them as of yet.
Thank you Sam for a nice plugin
April 2nd, 2008 at 3:01
Two bugs fixed: the JavaScript and Permalinks problem. Could someone check with Firefox 3 for me?
the IE7 coloring has been broken though…I have yet to trace when was it broken.
April 2nd, 2008 at 13:53
Permalink : OK
TinyMCE under Firefox 3.0 beta 5 : OK
Filter works fine widgets, so I use widgets instead.
Thank you very much for the quick respond!
April 2nd, 2008 at 19:37
hi, have you ever thought of including the famfamfam flags into your plugins? have a look here: http://www.famfamfam.com/lab/icons/flags/
i think i’m giving you’re plugin a try since jlanguage seems not to be updated anymore.
werner
April 5th, 2008 at 18:45
I want to make this plugin work.
Perhaps I have a conflict with another pluging? (My setup is quite clean.)
On the first install, I was able to set the first language. Then something went wrong (??) and I can no longer change the setiings in the Admin panel (for the xLanguage).
No longer anything is being written to the database. (I deleted the first entry in hopes of re-installing it.)
Would gladly send you some beer money.
April 6th, 2008 at 6:09
OK, I did make it work, but somehow I had to install WP-SuperCache first.
Thanks for the awesome plugin. As promised, I just bought you a beer. Cheers, yum bui.
April 7th, 2008 at 2:47
I’m having some odd parsing problems with xLanguage using WP2.5 and latest xLanguage. Trying to add a Japanese translation of a post causes a parsing error, but I’ve reviewed the source many times and it’s perfectly valid (and very simple) XHTML. The error details do not point to a tag but shows odd characters that are not in the text, so it looks more like an encoding problem but I don’t know WP and xLanguage well enough to really start investigating it from that angle.. Any help?
(sorry to not point you to the blog, it’s meant to be for the family only)
April 7th, 2008 at 3:40
The bug that caused the_date(), the_time() the working is fixed. More details in the tutorial page.
April 8th, 2008 at 16:24
Hi, Sam
Any ideas where I can find a US English .MO file?
I’ve tried looking everywhere. I thought maybe you know where I can find one.
April 8th, 2008 at 22:39
Hi
I update the plugin to the latest version and get the following error on my widget page: %BEG_OF_TITLE% %END_OF_TITLE% in place of where the list of widgets should appear.
If I deactivate the plugin I do not have the error
Tks
James
April 9th, 2008 at 17:15
Hi! Quite perfect and useful plugin.
How can I make Xlanguage compatible with Cforms ][ (http://www.deliciousdays.com/cforms-plugin/) plugin?
I did not find the codes you mentioned in Filter Hook Section.
Thank you,
Luca
April 10th, 2008 at 1:01
I’m trying to make this work. I created french and english. I tried using the | to write wome french|english parts but I can’t test the english part.
Am I suppose to see some link or dropdown list on my site which offers the reader two languages?
Guess I’m missing something hehe.
April 10th, 2008 at 1:24
Daniel, you will at the very least add the xLanguage widget to your sidebar.
Then you might want to do some theme customization as mentioned in the usage guide (2).
April 11th, 2008 at 21:57
I use wordpress 2.5 (downloaded it today) I am trying to make xlanguage to work. I have activated the plug-in and added two languages. When I create a new post nothing appears, there is nothing extra in the tool bar. I think that I followed the instructions, but, obviously I have done something wrong.
Do I have to add .MO files at all?
The only thing I want is to have the possibility to write the post in three languages, and the possibility of the reader to switch to the one it suits them better.
I hope someone can give me a hand, thanks in advance.
Sam, do you have Paypal?
April 11th, 2008 at 22:35
I still can’t figure out how to “add the xLanguage widget to my sidebar”. Do I have to edit some of the Word Press source files?
Sorry if I sound noobie… in fact I am
April 12th, 2008 at 9:52
[...] an existing CMS is a difficult thing, since there are so many text-based elements to deal with. xLanguage provides a simple method for posting multilingual content. The user writes all the content into one [...]
April 12th, 2008 at 16:43
Like Guillermo, I also upgraded to 2.5, and the xLanguage toolbar doesn’t show in the “create new post” window.
April 12th, 2008 at 23:19
Well I’ll be darned. It wasn’t working with FF this morning, and I tried IE7 and it worked. Now it also works with FF. Weird, but as long as it works I’m happy!
April 13th, 2008 at 4:09
Hi
your wp plugin looks great. i have been experimenting with it and i was wondering if it is possible to set the language to be shown like this:
“domain.com/lang/en/content.html”
instead of:
“domain.com/content.html/lang/en”
…would contribute if this is possible
April 19th, 2008 at 3:50
Hi there,
first of all, big kudos on the plugin you released. Its great!!
Im looking at the files, and i cant seem to find WidgetHelloSam, which widget extends… could you tell me where i could find the file? I do get an error sometimes where such file couldnt be found…
regards.
April 20th, 2008 at 16:30
Man, your plugin works great.
It took no time to change from polyglot to xlanguage
April 25th, 2008 at 1:51
Hi,
I love your plugin a billion!! Unfortunately the single line filtering mode doesn’t work with “Wordpress Navigation List Plugin NAVT”
–> http://wordpress.org/extend/plugins/wordpress-navigation-list-plugin-navt/
Many greetings
Igor
April 25th, 2008 at 2:37
can you combine xlanguage with a dropdown menu plugin?
April 25th, 2008 at 4:27
Hallo there, thanks for plugin.
I’m trying to use last version of xlanguage on wp 2.5.
I can correctly add languages and tag content but on the pages / post I can’t see any way to change language…can you help me?
Best regards.
Fabri.
April 25th, 2008 at 4:56
Sorry I had to add Language list.
Here is an issue: If I write a page and correctly tag it into my 3 langs I cannot set it as “Front page displays” as a static page.
When I surf http://www.mydomain.com the language list is “www.mydomain.com/?lang=en” and “www.mydomain.com/?lang=fr” and “www.mydomain.com/?lang=it” but when I click on one of these links, I get “Not Found Sorry, but you are looking for something that isn’t here.”
Any help appreciated.
Best regards.
April 25th, 2008 at 13:27
@Fabri
Click on Settings in the Dashboard and select PermaLinks. Make sure that the “Default” option is selected. I have noticed that if I change it to anything other than Default I run into the same problems you are describing. Hope this is helpful.
Kamal
April 27th, 2008 at 0:07
Hi,
Just came across your mod. It definitely looks great, and I’m planning to use it. But I was just wondering if your latest version is also compatible with version 2.51 of wordpress. On the wordpress plugin website it says only compatible to wordpress 2.5.
Hope to hear something from you soon.
Thanks again for offering such a wonderful mod. Keep up the great work :).
April 27th, 2008 at 3:39
Hi !
Thank you very much for your work and great plugin. I found it very usefull and flexible.
I don’t seem to find a way to make it work for the text widget aereas, (I wnt this free text I put on the sidebar to be localised as the rest of the blog). is there any way to do this ?
Thank you very much in advance
April 27th, 2008 at 9:07
Found another interesting plugin, which you might want to consider to copy some features from:
http://www.qianqin.de/qtranslate/
Instead of tagging the language in the text box. Why not make tabs so each has its own input box for the language? See the example in the mod I mentioned above.
April 27th, 2008 at 17:06
@niki:
qtranslate has lot of javascript errors on wp 2.5
April 28th, 2008 at 8:54
There’s a bug making posts show both languages at the same time. It’s caused by the following phrases:
*p align=”center”**/p*
OR
*p align=”right”**/p*
OR
*p align=”left”**/p*
(replace the * with appropriate brackets)
I had to mass replace them all using SQL and problem was solved. It happens when there’s no text between the opening “p” and the closing “p”. TinyMCE sometimes generates them so it can be a pain if you don’t know how to deal with it. I’ve just had some time to upgrade to v1.3.0 (not fixed) You’re doing great work here Sam.
April 28th, 2008 at 21:36
Thanks for reporting and the comments.
I will look into the bugs you guys reported but I am afraid it might take some time.
April 30th, 2008 at 17:08
Hi Sam,
Great plugin! My only question is if there is any way that you can tag a whole Post so that the Post will not show up at all if another language then the one that the Post is written in is selected? For example, lets say that I have English and Spanish on my site. I write a Post and tag the text/html in it as English. Then I do not want that Post to show up at all if I have Spanish selected as current language. Is there any way to do this at the moment or will I have to add some kind of php-parser that checks if a post contains the current selected language? Is it only me missing something? Or if not, do you have any hints on how I could solve my problem?
April 30th, 2008 at 22:54
Hi Sam,
while using Static Page with xlanguage, WP tries to load the post instead of page after clicking on the dedicated page link.
With Version 1.2.4 it works fine.
Thanks,
Igor
May 1st, 2008 at 3:12
Hi There,
First of all, great work that you’re doing!
I’m trying to use your plugin but I’ve come across to some issues and although I’ve read your guide many times, I can’t figure that out.
2- My template has the following code to create the menu:
<li class="current_page_item" ><a href="/">Home
How can I change the “Home” option if it is hard coded? This option is not coming from WP so I can’t use the plugin as the guide describes.
Thanks and any help is appreciated.
Marc
May 1st, 2008 at 4:16
Hi Sam
I’m trying to set up a bilingual blog (welsh and english) and your plug in looks like its going to be invaluable.
I’ve installed the plugin and amended the theme to include the language choice in the sidebar, but I’m a little confused as to how to get a different template to display according to the language selected. I’m guessing that I build this into my theme, with different header and footer files for each language. I can put those together, but how do I get Wordpress to identify the chosen language?
Any help would be much appreciated.
many thanks
May 2nd, 2008 at 4:50
I think I have the same question as Stef.
The WP theme that I’m using has some words hard coded for example, take a look at the right hand side nav with the tabs:
http://freshnews.premiumnewstheme.com/
How can I translate the tabs (Popular, Comments, Featured, Tabs) ?
Should I create a diff theme with the words translated for each language?
Thanks!
Marc
May 2nd, 2008 at 5:30
Hi Sam/Marc
I thought I’d found a solution - putting an if/else statement into index.php, page.php etc in the theme:
if (xlanguage_current_language_code("cy")) {include (TEMPLATEPATH . "/headerc.php");
}
else {
include (TEMPLATEPATH . '/header.php'); ;
}
so headerc.php would be the welsh version of the header. This worked once but then gets stuck on one language version - the welsh one in this instance. I’m sure there’s a better way of doing it, but my php skills are a bit rudimentary.
Any help would be much appreciated.
Thanks
May 2nd, 2008 at 9:25
Hi There,
I used this on my header:
It works and I hope I could be helpful...
May 2nd, 2008 at 10:51
Hi Stef,
There are several approaches for localizing theme:
1. If it’s just word changes, or some other minor phrase, the best way would be obtain the .MO files from the theme author to do the translation in the WP’s way. (See WP document for more details about the localization support). xLanguage in this role is to select the correct language depends on user’s language selection, so that the correct MO file will be applied and presented.
2. Your approach is Okay too. the code should actually be
if (xlanguage_current_language_code == "cy") { ... }3. If there is lot of changes, the best way would be create two (or more) independent themes, that’s it, a whole new theme with their very own folder. Then in the “Advanced” options of xLanguage, you can choose to use assign that theme for a different language.
May 2nd, 2008 at 18:25
Hi Sam
Thanks very much for getting back to me. I’m clearly going to have to buy you a lunch or two.
Your third option - to create two separate themes, one in each language - worked perfectly. I’d missed that in the documentation so thanks for the pointer. Option 2 didn’t seem to work even once you’d cleaned up my terrible php - I have a feeling it has to do with the info generated by header.php being held in cache, but I could be wrong.
The other problem I have is that the site is a mix of pages which are generated by Wordpress and pages which sit outside of WP. On the ones which sit outside of WP I include a couple of bits of info from WP - list of current news, list of pages etc so I use
on those pages I’m getting an error:
Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/index_1.php:4) in /home/site/public_html/news/wp-content/plugins/xlanguage/xlanguage.php on line 222
A search on Wordpress reveals that these errors are often caused by spaces in php files, but that doesn’t seem to be the problem here. It seems that xlanguage is trying to modify the header info, to set/read the cookie.
Is there any way of getting around this?
Thanks again
May 3rd, 2008 at 3:53
Hi Sam,
Do you know if there is any incompatibility between the xLanguage plugin and WP MU?
Thanks and keep the good work!
John Lancaster
May 3rd, 2008 at 12:45
I just tried to do something in 1.3.2 to store the parser log in user’s folder. And because xLanguage does not modify DB schema, I believe it’s safe to use in WP-MU now, although I didn’t test yet :).
Please let me know if you have deployed it.
May 3rd, 2008 at 19:18
Hey,
maybe it’s because of wordpress’ new version, but on top of my admin page, i get:
Warning: fopen(//wp-content/uploads/2008/05/xlanguage-parser-1618593827213996771.log) [function.fopen]: failed to open stream: No such file or directory in /wp-content/plugins/xlanguage/admin.php on line 141
Warning: fclose(): supplied argument is not a valid stream resource in /wp-content/plugins/xlanguage/admin.php on line 142
Warning: Cannot modify header information - headers already sent by (output started at /wp-content/plugins/xlanguage/admin.php:141) in /wp-content/plugins/xlanguage/xlanguage.php on line 222