i18n with Redwood
Warning
This post is more than a year old. Information may be outdated.
This is an opinionated guide of implementing Internationalization with Redwood.js
Initial Setup
i18n.js
Extract the allowed list for i18n.
Routing and Navigating
Each path must start with the lang parameter as follows.
Navigating must have lang.
Every page must have the following lang property
Headers
This will gently redirect if the lang property does not exist.
Below is hreflang to others, using allowedLanguageList
Sitemap.xml
... Should be generated accordingly
Consideration
Can we redirect by inserting the current navigator language?
For example, if we land on website.com/about,
- redirect to
website.com/en/aboutfor English users - redirect to
website.com/ko/aboutfor Korean users - That is, maintaining user location and path context.
- One way is to use
window.location.pathname
Reference
Comments