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
|[/locales/de/translation.json](/example/locales/de/translation.json)| German |
64
64
65
-
You can use different namespaces to organize your translations. Use the following file structure.
65
+
You can use different namespaces to organize your translations. Use the following file structure:
66
66
67
67
```
68
68
|-- language
@@ -81,11 +81,11 @@ The default namespace is `translation`
81
81
82
82
### Change your components
83
83
84
-
Use react i18next [`useTranslation`](https://react.i18next.com/latest/usetranslation-hook) hook and [`Trans`](https://react.i18next.com/latest/trans-component) component to translate your pages.
84
+
Use react i18next [`useTranslation`](https://react.i18next.com/latest/usetranslation-hook)react hook and [`Trans`](https://react.i18next.com/latest/trans-component) component to translate your pages.
85
85
86
86
`gatsby-plugin-react-i18next` exposes all [`react-i18next`](https://react.i18next.com/) methods and components.
87
87
88
-
Replace Gatsby `Link` component with the `Link` component exported from `gatsby-plugin-react-i18next`
88
+
Replace [Gatsby `Link`](https://www.gatsbyjs.org/docs/gatsby-link) component with the `Link` component exported from `gatsby-plugin-react-i18next`
89
89
90
90
```javascript
91
91
importReactfrom'react';
@@ -133,7 +133,7 @@ and in `locales/en/translations.json` you will have
133
133
}
134
134
```
135
135
136
-
This example is not using semantic keys (eg `i18nKey`) e.g. the entire message will be used as a key. [Read more](https://www.i18next.com/principles/fallback#key-fallback).
136
+
This example is not using semantic keys instead the entire message will be used as a key. [Read more](https://www.i18next.com/principles/fallback#key-fallback).
### `Link` component - is identical to [Gatsby Link component](https://www.gatsbyjs.org/docs/gatsby-link/) expept that you can provide additional `language` prop to create a link to a page with different language
192
+
### `Link` component
193
+
194
+
`Link` component is identical to [Gatsby Link component](https://www.gatsbyjs.org/docs/gatsby-link/) except that you can provide additional `language` prop to create a link to a page with different language
| routed | boolean | if `false` it means that the page is in default language |
221
+
| defaultLanguage | string | default language provided in plugin options |
222
+
| originalPath | string | page path in default language |
220
223
221
224
### `useI18next` react hook
222
225
223
226
This hook returns `I18nextContext`, object and additional helper functions
224
227
225
-
Function | Description
226
-
navigate | This is a wrapper around [Gatsby navigate helper function](https://www.gatsbyjs.org/docs/gatsby-link/#how-to-use-the-navigate-helper-function) that will navigate to the page in selected language
227
-
changeLanguage | A helper function to change language. The first parameter is a language code. Signature: `(language: string, to?: string, options?: NavigateOptions) => Promise<void>'. You can pass additional parameters to navigate to different page.
| navigate | This is a wrapper around [Gatsby navigate helper function](https://www.gatsbyjs.org/docs/gatsby-link/#how-to-use-the-navigate-helper-function) that will navigate to the page in selected language |
231
+
| changeLanguage | A helper function to change language. The first parameter is a language code. Signature: `(language: string, to?: string, options?: NavigateOptions) => Promise<void>'. You can pass additional parameters to navigate to different page. |
228
232
229
233
`useI18next` also exposes the output of react i18next [`useTranslation`](https://react.i18next.com/latest/usetranslation-hook) so you can use
0 commit comments