gt-react 9.2.19 → 9.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +13 -17
- package/dist/client.cjs.min.cjs +3 -3
- package/dist/client.esm.min.mjs +3 -3
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/index.cjs.min.cjs +1 -1
- package/dist/index.esm.min.mjs +3 -3
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/package.json +7 -3
- package/rollup.base.config.mjs +0 -33
- package/rollup.config.mjs +0 -110
- package/tsconfig.json +0 -23
package/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# gt-react
|
2
|
+
|
3
|
+
## 9.2.21
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#305](https://github.com/generaltranslation/gt/pull/305) [`5991569`](https://github.com/generaltranslation/gt/commit/59915699154fa0b442c4460c7c8d586fdc8020f9) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Bump downstream
|
8
|
+
|
9
|
+
- Updated dependencies [[`5991569`](https://github.com/generaltranslation/gt/commit/59915699154fa0b442c4460c7c8d586fdc8020f9)]:
|
10
|
+
- generaltranslation@6.2.8
|
11
|
+
- @generaltranslation/supported-locales@2.0.8
|
package/README.md
CHANGED
@@ -34,39 +34,38 @@ GT_PROJECT_ID="your-project-id"
|
|
34
34
|
|
35
35
|
### 2. Select languages
|
36
36
|
|
37
|
-
`<GTProvider>` is used to configure the behavior of `gt-react`.
|
37
|
+
`<GTProvider>` is used to configure the behavior of `gt-react`.
|
38
38
|
It should be placed as high up in your app as possible, ideally at the root.
|
39
39
|
|
40
|
-
Just pass a list of [locale codes](https://generaltranslation.com/docs/
|
40
|
+
Just pass a list of [locale codes](https://generaltranslation.com/docs/platform/locale-strings#supported-locales) to add them to your app.
|
41
41
|
|
42
42
|
```jsx
|
43
|
-
import { GTProvider } from
|
44
|
-
import MyApp from
|
43
|
+
import { GTProvider } from 'gt-react';
|
44
|
+
import MyApp from './MyApp';
|
45
45
|
|
46
46
|
export default function App() {
|
47
47
|
return (
|
48
|
-
<GTProvider locales={['fr', 'zh']}>
|
48
|
+
<GTProvider locales={['fr', 'zh']}>
|
49
|
+
{' '}
|
50
|
+
// French and Chinese support
|
49
51
|
<MyApp />
|
50
52
|
</GTProvider>
|
51
53
|
);
|
52
54
|
}
|
53
55
|
```
|
54
56
|
|
55
|
-
|
56
57
|
### 3. Add the `<T>` component
|
57
58
|
|
58
59
|
Wrap any nested JSX content in the `<T>` component to make it translatable.
|
59
60
|
For more information, check out the [guide on using `<T>` components](https://generaltranslation.com/docs/react/reference/t-reference).
|
60
61
|
|
61
62
|
```jsx
|
62
|
-
import { T } from
|
63
|
+
import { T } from 'gt-react';
|
63
64
|
|
64
65
|
export default function Example() {
|
65
66
|
return (
|
66
67
|
<T>
|
67
|
-
<p>
|
68
|
-
This gets translated.
|
69
|
-
</p>
|
68
|
+
<p>This gets translated.</p>
|
70
69
|
</T>
|
71
70
|
);
|
72
71
|
}
|
@@ -75,7 +74,7 @@ export default function Example() {
|
|
75
74
|
Use the `<Var>` component to designate JSX content that should not be translated.
|
76
75
|
|
77
76
|
```jsx
|
78
|
-
import { T, Var } from
|
77
|
+
import { T, Var } from 'gt-react';
|
79
78
|
|
80
79
|
export default function Example() {
|
81
80
|
return (
|
@@ -101,17 +100,14 @@ For strings, you can use `useGT()` for translation.
|
|
101
100
|
For more information, check out [this guide](/docs/react/tutorials/translating-strings).
|
102
101
|
|
103
102
|
```jsx
|
104
|
-
import { useGT } from
|
103
|
+
import { useGT } from 'gt-react';
|
105
104
|
|
106
105
|
export default function Example() {
|
107
106
|
const t = useGT();
|
108
|
-
return (
|
109
|
-
<p>
|
110
|
-
{t("This gets translated.")}
|
111
|
-
</p>
|
112
|
-
);
|
107
|
+
return <p>{t('This gets translated.')}</p>;
|
113
108
|
}
|
114
109
|
```
|
110
|
+
|
115
111
|
## Documentation
|
116
112
|
|
117
113
|
Full documentation, including guides, examples, and API references, can be found at [General Translation Docs](generaltranslation.com/docs).
|