Welcome Guest, Not a member yet? Register   Sign In
third locale detection
#1
Smile 

CI4 has 2 way of locale detection:

1. By url
Most modern websites use locale setting on some url part. But on complex url routing, this may not works (misinterpreted as segment or parameter instead of locale)

2. Content negotiation
Usually, browser has differ language than web. Some user wants to keep that. Also user may want to change language (force website for another language). So content negotiation cannot be used on this scenario.

I proposed 3rd way.

3. By Cookie.

My usecase:

My user can change website's language by clicking link which I put GET variable to that link. The new settings is saved on cookie.
When user visit, controller checks the cookie and GET variable,
- if both not present then using default locale
- if only one present, then that will be used
- if both present, then use setting from GET and change the cookie if differs from GET variable
Reply
#2

That should not be part of the framework that is JavaScript and should be left to the user.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB