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: crowdin/README.md
+10-1
Original file line number
Diff line number
Diff line change
@@ -93,4 +93,13 @@ The Yarn task `crowdin:update-languages` determines which translated languages h
93
93
└── # ...
94
94
```
95
95
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