Skip to content

Commit e759552

Browse files
author
Brian Vaughn
committed
Crowdin README update
1 parent dec99ee commit e759552

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crowdin/README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,13 @@ The Yarn task `crowdin:update-languages` determines which translated languages h
9393
   └── # ...
9494
```
9595

96-
This `languages.json` list is imported into a translations page (`pages/translations.js`) and used to create a list of links to translated docs.
96+
This `languages.json` list is imported into a translations page (`pages/translations.js`) and used to create a list of links to translated docs.
97+
98+
### Locale persistence
99+
100+
By default, legacy links to docs pages (e.g. `/docs/hello-world.html`) are re-routed to a new page (`docs-language-redirect.js`) that determines which locale to redirect to (e.g. `/en-US/docs/hello-world.html`). This is done as follows:
101+
* First it checks `localStorage` for the user's selected language. If one is found, it is used.
102+
* Next it checks the user's preferred languages (using `navigator.languages`). If any have been translated, it is used.
103+
* Lastly it falls back to English.
104+
105+
Each time a user visits a localized docs path, the website updates their currently selected language (in `localStorage`) so that subsequent visits (within this session or a new session) will restore their selected language.

0 commit comments

Comments
 (0)