Skip to content

dcroitoru/gatsby-starter-i18n-lingui

Repository files navigation

gatsby-starter-i18n-linguijs

Gatsby starter with i18n/l10n support using js-lingui.
This will generate pages for each locale avoiding duplicate code.

Demo

Install

Make sure that you have Gatsby and js-lingui installed globally:

npm install --global gatsby-cli js-lingui

Extract translations:

npm run extract

Run gatsby:

npm run develop

Config

Add new locale (ex: russian):

lingui add-locale ru

Wire up catalogs in src/i18n-config

Refer to js-lingui docs for further information on using the library

You could have translated paths; for that you will need a mapping of default paths to localized paths. Update gatsby-node and locale files to use those mappings.

Thanks

These threads/repositories served as inspiration:
gatsbyjs/gatsby#3853 (comment)
lingui/js-lingui#158 (comment)
https://github.com/morloy/ledgy.com