|
@@ -23,6 +23,8 @@ $language = Language::findFirstMatch(['de', 'en']);
|
|
|
```
|
|
```
|
|
|
It will use the language with the highest weight supported by the user agent data provided.
|
|
It will use the language with the highest weight supported by the user agent data provided.
|
|
|
|
|
|
|
|
|
|
+Note: When you have intl installed, you can also try to use the CakePHP core LocaleSelectorMiddleware.
|
|
|
|
|
+
|
|
|
|
|
|
|
|
## Session based language switch
|
|
## Session based language switch
|
|
|
In your AppController you can now do:
|
|
In your AppController you can now do:
|
|
@@ -97,6 +99,8 @@ In this case you should have a canonical (pointed to the root) on that action to
|
|
|
|
|
|
|
|
Now you just have to overwrite `Controller::redirect()` for the controller redirects and `HtmlHelper::link()`/`UrlHelper::build()` etc for the view level URLs generated.
|
|
Now you just have to overwrite `Controller::redirect()` for the controller redirects and `HtmlHelper::link()`/`UrlHelper::build()` etc for the view level URLs generated.
|
|
|
|
|
|
|
|
|
|
+For a more sophisticated approach on that routing topic you might want to look into [the I18n plugin](https://github.com/ADmad/cakephp-i18n).
|
|
|
|
|
+
|
|
|
|
|
|
|
|
## Language vs Locale
|
|
## Language vs Locale
|
|
|
A locale is a combination of language and region (usually a country).
|
|
A locale is a combination of language and region (usually a country).
|