I don’t think your set_admin_language() function works, at least not for me.
You are probably running into the same problem I ran into when I was trying to build a solid language switcher.
Wondering out load: It would seem to me that this option of being able to switch languages on the fly is something that many folks would be glad to have and it would indeed help EE in attracting new customers because of this capability. Therefore, is it something that perhaps could be rolled into a forthcoming version of EE? Mark and others have done a super job and this could be the foundation on which EE can roll it into their production cycle? I am specifically referring to a Language Switch for page viewing and not the back-end admin areas, although that could be also incorporated. Just a thought....
@Cocoaholic,
You are correct, the function will only work in PHP5. I’ll try to check out a workaround for PHP4, but I’m not sure what could be done without hacking the core files. I’ve also submitted a feature request through your linked thread to hopefully get a few more hooks into the template system.
@giovanni,
I concur. this would be a nice feature.
One little question: Is it possible to check which language is active? I have two languages Dutch and English and I only want to display the option which is currently not active. So if the language is Dutch, i want to have a link that says ‘English’ and vice versa.
I tried it with a {if} statement but i cant figure out which variable to use.
The way it’s working now an {if /} statement won’t work. It’s kind of finicky that way because the XHTML is calculated before the template even begins parsing. I did it that way to simplify things, otherwise I’d need to bundle a plugin with the extension. That being said, there should be enough CSS hooks in there to style it so that the active language is hidden.
Alright, I have it switching categories now. It’s a hack, but I’m pretty pleased with it. You can read about the implementation at the top of the thread, but as a teaser you only need to perform the following:
If category group 4 were named ‘blog’ and there was another category group named ‘blog_ja’ it would switch blog to the suffixed version assuming a user is browsing in japanese.