You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/i18n-l10n/language-negotiation.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ For instance, if the site is being presented in a sub-folder (`www.domain.com/en
60
60
61
61
Another common configuration is to use the browser language request negotiation.
62
62
This means that Plone relies on the `Accept-Language` HTTP header sent by the user's browser.
63
-
The user can configure the list of languages to use in their preferred order, such as in German (de), French (fr), and English (en).
63
+
The user can configure the list of languages to use in their preferred order, such as German (de), French (fr), and English (en).
64
64
In this scenario, Plone will compare its language list with the user's preferences, and will determine in which language to present the site.
65
65
66
66
The exact working of each of the negotiation options is implemented in the class [`LanguageUtility`](https://github.com/plone/plone.i18n/blob/fc05eb4c131574fd8a4353d5346e17866b3a5e2c/plone/i18n/utility.py#L73) in the module `utility.py` in the package `plone/plone.i18n`.
@@ -69,11 +69,13 @@ Plone also sets a cookie with the language preference of the user.
69
69
This cookie is called `I18N_LANGUAGE`.
70
70
It must be declared as a "technical cookie".
71
71
It is a session cookie, which means that it will be deleted after the user leaves the site.
72
-
To obey the cookie the setting, {guilabel}`Use cookie for manual override` should be set along with {guilabel}`Set the language cookie always`.
72
+
To obey the cookie setting, {guilabel}`Use cookie for manual override` should be set along with {guilabel}`Set the language cookie always`.
73
73
74
74
Building websites with user interfaces in multiple languages is complicated due to the different expectations of the users and the difficulty of the configuration.
75
75
76
-
As we will see in the (translating-content-label)= section, Plone will set a special view for the Plone root object called `@@language-switcher` whose implementation lies on `plone.app.multilingual.browser.switcher.LanguageSwitcher`. This language switcher will only rely on the user preferred language to decide where to send the user when she visits the root of the site.
76
+
As we will see in the {doc}`translating-content` chapter, Plone will set a special view for the Plone root object called `@@language-switcher` whose implementation relies on `plone.app.multilingual.browser.switcher.LanguageSwitcher`.
77
+
This language switcher will only rely on the user preferred language to decide where to send the user when they visit the root of the site.
@@ -86,7 +88,7 @@ For example, if `en` and `es` are enabled, Plone will create `www.domain.com/en`
86
88
Plone will assume that all the content below `en` is in English, and all content below `es` is in Spanish.
87
89
It will rely on that assumption to present the user interface in those languages when the user is browsing those parts of the site.
88
90
89
-
As we will see in the {ref}`translating-content-label` chapter, Plone will set a special view for the Plone root object called `@@language-switcher` whose implementation relies on `plone.app.multilngual.browser.switcher.LanguageSwitcher`.
91
+
As we will see in the {doc}`translating-content` chapter, Plone will set a special view for the Plone root object called `@@language-switcher` whose implementation relies on `plone.app.multilingual.browser.switcher.LanguageSwitcher`.
90
92
This language switcher will only rely on the user preferred language to decide where to send the user when they visit the root of the site.
91
93
92
94
An integrator may want to modify this behavior to always send a user to a given language, or to negotiate the language selection in some other way, such as using the domain, a cookie, or some other techniques.
@@ -100,8 +102,12 @@ As such, there are two options.
100
102
101
103
## Changing the default behavior
102
104
103
-
If for any reason you want to change the default behavior set when using `plone.app.multilingual`, you have 2 options:
105
+
If for any reason you want to change the default behavior set when using `plone.app.multilingual`, you have two options.
104
106
105
-
1- Override the `language-switcher` view. Plone has a view called `language-switcher` defined in [plone.app.multilingual.browser.switcher.py](https://github.com/plone/plone.app.multilingual/blob/master/src/plone/app/multilingual/browser/switcher.py) which handles the redirection from the root of the Plone site to the proper Language Root Folder. You can override this view using the usual techniques to provide your own implementation.
107
+
1. Override the `language-switcher` view.
108
+
Plone has a view called `language-switcher` defined in [plone.app.multilingual.browser.switcher.py](https://github.com/plone/plone.app.multilingual/blob/master/src/plone/app/multilingual/browser/switcher.py) which handles the redirection from the root of the Plone site to the proper Language Root Folder.
109
+
You can override this view using the usual techniques to provide your own implementation.
106
110
107
-
2- Create a new view: you can create your own view with your own implementation, configure it properly and then set it as a `default view` for `Plone Site` objects. To do so, you may need to provide your own installation profile with a `Plone Site.xml` file and with the proper configuration.
111
+
1. Create a new view.
112
+
You can create your own view with your own implementation, configure it properly, and then set it as a `default view` for `Plone Site` objects.
113
+
To do so, you may need to provide your own installation profile with a {file}`Plone Site.xml` file and with the proper configuration.
0 commit comments