chore: Update README * Update readme Approved-by: Chuma Mcphoy (We Ahead) Approved-by: Joakim Jäderberg
18 lines
636 B
Markdown
18 lines
636 B
Markdown
# Internationalization
|
|
|
|
## The `lang` route parameter
|
|
|
|
All page paths starts with a language parameter, e.g. `/sv/utforska-scandic/wi-fi`.
|
|
|
|
### Get the language in a client component
|
|
|
|
We have a hook called `useLang` that directly returns the `lang` parameter from the path.
|
|
|
|
### Get the language in a server component
|
|
|
|
In order to not prop drill that all the way from a page we use React's `cache` in a way that resembles React`s context, but on the server side.
|
|
|
|
For this to work we must set the language with `setLang` on the topmost layout
|
|
|
|
This was inspired by [server-only-context](https://github.com/manvalls/server-only-context)
|