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: README.md
+57-12Lines changed: 57 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,11 @@ Easily translate your Gatsby website into multiple languages.
15
15
16
16
When you build multilingual sites, Google recommends using different URLs for each language version of a page rather than using cookies or browser settings to adjust the content language on the page. [(read more)](https://support.google.com/webmasters/answer/182192?hl=en&ref_topic=2370587)
17
17
18
-
## How is it different from other gatsby i18next plugins?
18
+
## :boom: Breaking change since v0.0.27
19
19
20
-
This plugin does not require fetching translations with graphql query on each page, everything is done automatically. Just use `react-i18next` to translate your pages.
20
+
As of v0.0.28, language JSON resources should be loaded by `gatsby-source-filesystem` plugin and than fetched by GraphQL query. It enables incremental build and hot-reload as language JSON files change.
21
+
22
+
Users who have loaded language JSON files using `path` option will be affected. Please check configuration example on below.
| path | string | path to the folder with JSON translations |
249
-
| languages | string[]| supported language keys |
250
-
| defaultLanguage | string | default language when visiting `/page` instead of `/es/page`|
251
-
| redirect | boolean | if the value is `true`, `/` or `/page-2` will be redirected to the user's preferred language router. e.g) `/es` or `/es/page-2`. Otherwise, the pages will render `defaultLangugage` language. Default is `true`|
252
-
| siteUrl | string | public site url, is used to generate language specific meta tags |
253
-
| pages | array | an array of [page options](#page-options) used to modify plugin behaviour for specific pages |
| localeJsonSourceName | string | name of JSON translation file nodes that are loaded by `gatsby-source-filesystem` (set by `option.name`). Default is `locale`|
273
+
| localeJsonNodeName | string | name of GraphQL node that holds locale data. Default is `locales`|
274
+
| languages | string[]| supported language keys |
275
+
| defaultLanguage | string | default language when visiting `/page` instead of `/es/page`|
276
+
| redirect | boolean | if the value is `true`, `/` or `/page-2` will be redirected to the user's preferred language router. e.g) `/es` or `/es/page-2`. Otherwise, the pages will render `defaultLangugage` language. Default is `true`|
277
+
| siteUrl | string | public site url, is used to generate language specific meta tags |
278
+
| pages | array | an array of [page options](#page-options) used to modify plugin behaviour for specific pages |
## How to fetch translations of specific namespaces only
400
+
401
+
You can use `ns` and `language` field in gatsby page queries to fetch specific namespaces that are being used in the page. This will be useful when you have several big pages with lots of translations.
## How to add `sitemap.xml` for all language specific pages
375
420
376
421
You can use [gatsby-plugin-sitemap](https://www.gatsbyjs.org/packages/gatsby-plugin-sitemap/) to automatically generate a sitemap during build time. You need to customize `query` to fetch only original pages and then `serialize` data to build a sitemap. Here is an example:
`gatsby-plugin-react-i18next: 💥💥💥 "path" option is deprecated and won't be working as it was before. Please update setting on your gastby-config.js.\n\nSee detail: https://github.com/microapps/gatsby-plugin-react-i18next\n\n`
0 commit comments