I have a MVC
myself that I implement in my projects in PHP
. This supports multiple languages and by default they get the active / initial language from the browser.
However, there are projects that require the language modification feature with a simple click.
The solution I understand best is by the URL ie:
url for automatic language: http://meuprojecto.com/[controller]/[action]
url to force language / locale: http://meuprojecto.com/pt-PT/[controller]/[action]
.
As you can see I use the LOCALE standard to get the language ... Being implemented using the hyphen or the underscore. This way, whenever the framework detects this type of URL, it modifies the locale initially obtained from the browser for the project.
Having my solution, I would like to evaluate other ways to solve this problem.
My question is: what other mechanisms do you know within implementations in PHP
solved differently? I have thought of inserting support for the presence of a ISO 639-1
tag to identify the language but I think I'm complicating it or not?