Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

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

12>>>

let the user choose a language

ez
#1 2009-10-30 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.
	}
	else
	{
		$usr['skin'] = sed_import($u[0], 'D', 'ALP');
		$usr['theme'] = sed_import($u[1], 'D', 'ALP');
		$usr['lang'] = sed_import($u[2], 'D', 'ALP');
	}
}

if($usr['id']==0)
{
	$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 -==

Dit bericht is bewerkt door ez (2009-10-30 21:54, 10 jaren ago)
pieter
#2 2009-10-31 01:43
... can we help you ...
ez
#3 2009-10-31 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 -==
pieter
#4 2009-10-31 04:12
search for 18n in the forum, there is a whole threat about it.
... can we help you ...
ez
#5 2009-10-31 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 -==

Dit bericht is bewerkt door ez (2009-11-01 23:59, 10 jaren ago)
pieter
#6 2009-11-02 00:54
plz add it to downloads.

Added 4 minutes later:

Do you have somewhere a demo?
... can we help you ...
ez
#7 2009-11-02 03:08
I have submitted a page, but it is not approved.... yet.
The plugin is here: http://ezscript.2basix.nl/page.php?id=33

Preview: en

Configuration:

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>
            </div>
{PLUGIN_LANGSELECT}
            <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 -==

Dit bericht is bewerkt door ez (2009-11-02 04:11, 10 jaren ago)
Alex300
#8 2009-11-02 04:31
It will be cool if this plugin could select default language depending of user IP address.
Приходится бежать со всех ног, чтобы только оставаться на месте. А чтобы куда-то попасть, приходится бежать еще быстрее...
...Sorry for my english...
Бесплатные расширения для Cotonti: http://portal30.ru/sozdanie-internet-sajtov/free-scripts/
ez
#9 2009-11-02 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:

@Alex300
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 -==

Dit bericht is bewerkt door ez (2009-11-03 22:42, 10 jaren ago)
Trustmaster
#10 2009-11-04 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!
ez
#11 2009-11-04 03:58
@all:
The autodetect function is finished and can be found http://ezscript.2basix.nl/page.php?id=33
I have made some nice improvements.. ;)

@Trustmaster:
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 -==

Dit bericht is bewerkt door ez (2009-11-04 05:22, 10 jaren ago)
Lombi
#12 2009-11-04 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="http://www.domenlo.com">Surreal Art</a>
ez
#13 2009-11-05 02:41
@lombi
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 -==

Dit bericht is bewerkt door ez (2009-11-05 03:46, 10 jaren ago)
Lombi
#14 2009-11-06 07:57
It sounds like an awesome plug mate :)
<a href="http://www.domenlo.com">Surreal Art</a>
jbra
#15 2012-08-10 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...

12>>>