Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Foren / Cotonti / Core Labs / Archive / multi language sites


let the user choose a language

#1 30. Oktober 2009, 21:34
I have put this in another forum item also, but I really think it is a great idea:

look at multiple languages selection

THIS SHOULD BE EASY because Cotonti already supports languages.... :P

I allready found it in common.php, but I do NOT want to make core hacks.
		$usr['skin'] = sed_import($u[0], 'D', 'ALP');
		$usr['theme'] = sed_import($u[1], 'D', 'ALP');
		$usr['lang'] = sed_import($u[2], 'D', 'ALP');

	$usr['auth'] = sed_auth_build(0);
	$usr['skin'] = empty($usr['skin']) ? $cfg['defaultskin'] : $usr['skin'];
	$usr['theme'] = empty($usr['theme']) ? $cfg['defaulttheme'] : $usr['theme'];
	$usr['lang'] = empty($usr['lang']) ? $cfg['defaultlang'] : $usr['lang'];
	$sys['xk'] = mb_strtoupper(dechex(crc32($sys['abs_url']))); // Site related key for guests

So can we make a hook or something to influence what language is selected..
We can even use a HTML header.. like Accept-Language to detect this.. (maybe a setting in the configuration :))
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 30. Oktober 2009, 21:54, vor 11 Jahre) bearbeitet
#2 31. Oktober 2009, 01:43
... can we help you ...
#3 31. Oktober 2009, 02:35
Thanks pieter, this will solve some off my questions...

The title off that plugin was NOT clear for me...

Now I still have to make it work so that people can choose a language.
Any ideas for that ?????

I think I can make something in a hook, but I will have to look a bit further for that.
==- I say: Keep it EZ -==
#4 31. Oktober 2009, 04:12
search for 18n in the forum, there is a whole threat about it.
... can we help you ...
#5 31. Oktober 2009, 04:56
I am working on a language selector plugin..... :)

Now I can change the language on the fly already... and it already works jeeaahh.
So things to do:

1) make a tag for the language selector (like in the user profile) (I think in the header.tpl)
2) Store the language selection in a browser cookie
   So when returning to the page it will remember your setting by the cookie..
   and you can switch languages on the fly with the selector.

Together with the 18n plugin this will have all the ingredients for international sites :P

Hopefully I can finish that, because the cookie thing is new to me.

Added 1 day later:

Hi everyone...

I have made the plugin to switch from language on the fly !!!!
Together with Trustmasters i18n plugin you can make your site INTERNATIONAL.

please try it and let me know what you think.

ow forgot. You can even choose between flags as output or a select box..

enjoy :D

You can find the plugin here: Language selector plugin
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 1. November 2009, 23:59, vor 11 Jahre) bearbeitet
#6 2. November 2009, 00:54
plz add it to downloads.

Added 4 minutes later:

Do you have somewhere a demo?
... can we help you ...
#7 2. November 2009, 03:08
I have submitted a page, but it is not approved.... yet.
The plugin is here:

Preview: en


No, I have only a local demo running, but it is so simple to use, so just install it. :)
In header.tpl (sed-light) add the tag like this:
            <div id="content">

Install the plugin, enable the plugin, choose flags or selectbox and your good to go, you will see what it does.

I think you can use this.. because off the two languages in your country.

Hope to hear some reactions... B)

Ow, the french language file is not included yet, so you have to add it manually
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 2. November 2009, 04:11, vor 11 Jahre) bearbeitet
#8 2. November 2009, 04:31
It will be cool if this plugin could select default language depending of user IP address.
Приходится бежать со всех ног, чтобы только оставаться на месте. А чтобы куда-то попасть, приходится бежать еще быстрее...
...Sorry for my english...
Бесплатные расширения для Cotonti:
#9 2. November 2009, 04:37
Maybe I can use your browser/computer settings..

this is the Accept-Language HTML Header...
I could make another option for this (autodetect language) or so.... :D

I still have to look into Trustmasters plugin (how that works for pages in different languages..
But I will trust that works.. B)

Added 1 day later:

I have made it autodetect, I will publish the plugin later...
It works great :D

Looking up an ip address is to much...
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 3. November 2009, 22:42, vor 11 Jahre) bearbeitet
#10 4. November 2009, 02:29
Pagi18n plugin has a language selector pretty similar to yours built-in. Though it doesn't have auto-detection (which you are right is done via Accept-Language normally) as it was originally designed for more search engine compliance and contained language string in all urls.
May the Source be with you!
#11 4. November 2009, 03:58
The autodetect function is finished and can be found
I have made some nice improvements.. ;)

Maybe you want to use my language selector plugin ??? for the 18n plugin
at least have a look at it, and tell me what you think
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 4. November 2009, 05:22, vor 11 Jahre) bearbeitet
#12 4. November 2009, 08:04
The language selector built into page i18n is perfect. it allows for amazing functionality - integrating the language choice into your URL structure so you can have /en/whatever.html and have it jump between choices.

Have a site running this and i'm in awe every time i remember about the system :)
<a href="">Surreal Art</a>
#13 5. November 2009, 02:41
My plugin is NO replacement what so ever...
I only made a nice selection for languages. Trustmasters plugin is needed for the real selection off pages and categories by language.

But maybe I have made some stuff that he can use in the i18n plugin.
Lets all make better stuff :)
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 5. November 2009, 03:46, vor 11 Jahre) bearbeitet
#14 6. November 2009, 07:57
It sounds like an awesome plug mate :)
<a href="">Surreal Art</a>
#15 10. August 2012, 20:06

When I goto page it shows this: http://www."domain".com/online/ru/articles/my_page_en

in URL but I get a nopage found error 404. And when I click the russian link on the home page it just refreshes screen.

Please help...