如何使用Gatsby JS处理国际化/本地化? [英] How to handle internationalization/localization with Gatsby JS?
问题描述
我想在全球各地使用本地化内容发布静态站点.
I would like to publish my static site in various locals around the world with localized content.
如何做到这一点?
推荐答案
我最近添加了一个默认的Gatsby启动程序,该启动程序具有多语言网址路由和浏览器语言检测功能. (演示)
I recently added a default Gatsby starter with features of multi-language url routes and browser language detection. (demo)
功能:
-
react-intl 提供的本地化(多语言).
Localization (Multilanguage) provided by react-intl.
由 browser-lang 提供的浏览器中基于用户首选语言的自动重定向. .
Automatic redirection based on user's preferred language in browser provided by browser-lang.
在单个页面组件中支持多语言url路由.这意味着您不必创建单独的页面,例如pages/en/index.js
或pages/ko/index.js
.
Support multi-language url routes within a single page component. That means you don't have to create separate pages such as pages/en/index.js
or pages/ko/index.js
.
基于 gatsby-starter-default 进行的最少修改.
这篇关于如何使用Gatsby JS处理国际化/本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!