Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Language selection and cookie
dgt
#1 Posted : Sunday, June 06, 2010 6:06:13 PM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 1/21/2010(UTC)
Posts: 69
Location: London
Hi all,
could someone suggest the best way to add a language selection dropdown or links and storing a cookie for the next visit?
My urls are like: www.domain.com (default language), www.domain.com/es, www.domain.com/fr, etc.

So far, I only have a dropdown with javascript that redirects to www.domain.com/<lang> but this is not ideal. The language selection should change the language and keep the user in the same page.

This must be a very common requirement. Should this be built in kooboo or a module for reuse?

Thanks
kellros
#2 Posted : Tuesday, October 18, 2011 11:36:51 AM(UTC)
Rank: Newbie
Groups: Registered

Joined: 10/18/2011(UTC)
Posts: 1
Location: South Africa
This would entirely depend on your approach. In a classic mvc application you could access the pages RouteValues, copy them and add another value such as lang=en and call @Url.Route(routeValues) or similiar.

Alternatively you could get the full page url (think it was Request.Url) and do a hard coded replace via javascript
(ex. var hostName = 'http://www.mysite.com'; window.location.href = window.location.pathname.replace(/hostName/i, hostName + '/en')) but will take some work making it work in all scenarios. Honestly, I'm not sure how to do this with Kooboo ^.^.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.558 seconds.