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: context/middleware.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ use Utopia::Redirection::Errors,
36
36
37
37
## Localization
38
38
39
-
The {ruby Utopia::Localization} middleware provides non-intrusive localization on top of the controller and view layers. The middleware uses the `accept-language` header to guess the preferred locale out of the given options. If a request path maps to a resource, that resource is returned. Otherwise, a non-localized request is made.
39
+
The {ruby Utopia::Localization} middleware computes immutable localization preferences from the request path, host, and `accept-language` header. Localization-aware resource middleware, including {ruby Utopia::Static} and {ruby Utopia::Content}, resolves those preferences without invoking controllers more than once. Place the localization middleware before those resources in the middleware stack.
40
40
41
41
~~~ruby
42
42
use Utopia::Localization,
@@ -53,7 +53,7 @@ pages/index.ja.xnode
53
53
pages/index.zh.xnode
54
54
~~~
55
55
56
-
You can also access the current locale in the view via {ruby Utopia::Content::Node::Context#localization}.
56
+
You can access the selected locale in a view using `localization.locale`. Controllers can inspect the request preferences using `request.localization`.
Copy file name to clipboardExpand all lines: guides/middleware/readme.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ use Utopia::Redirection::Errors,
36
36
37
37
## Localization
38
38
39
-
The {ruby Utopia::Localization} middleware provides non-intrusive localization on top of the controller and view layers. The middleware uses the `accept-language` header to guess the preferred locale out of the given options. If a request path maps to a resource, that resource is returned. Otherwise, a non-localized request is made.
39
+
The {ruby Utopia::Localization} middleware computes immutable localization preferences from the request path, host, and `accept-language` header. Localization-aware resource middleware, including {ruby Utopia::Static} and {ruby Utopia::Content}, resolves those preferences without invoking controllers more than once. Place the localization middleware before those resources in the middleware stack.
40
40
41
41
~~~ruby
42
42
use Utopia::Localization,
@@ -53,7 +53,7 @@ pages/index.ja.xnode
53
53
pages/index.zh.xnode
54
54
~~~
55
55
56
-
You can also access the current locale in the view via {ruby Utopia::Content::Node::Context#localization}.
56
+
You can access the selected locale in a view using `localization.locale`. Controllers can inspect the request preferences using `request.localization`.
0 commit comments