gt-react 10.10.2 → 10.10.4
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 +18 -0
- package/README.md +25 -77
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# gt-react
|
|
2
2
|
|
|
3
|
+
## 10.10.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`eb07e8c`](https://github.com/generaltranslation/gt/commit/eb07e8ce1b610551437b40f96c72ac76d0af7b67)]:
|
|
8
|
+
- generaltranslation@8.1.7
|
|
9
|
+
- @generaltranslation/react-core@1.4.4
|
|
10
|
+
- @generaltranslation/supported-locales@2.0.38
|
|
11
|
+
|
|
12
|
+
## 10.10.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`feada39`](https://github.com/generaltranslation/gt/commit/feada3918ad78a1584f07245ac158c2d994a38da)]:
|
|
17
|
+
- generaltranslation@8.1.6
|
|
18
|
+
- @generaltranslation/react-core@1.4.3
|
|
19
|
+
- @generaltranslation/supported-locales@2.0.37
|
|
20
|
+
|
|
3
21
|
## 10.10.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,98 +1,46 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://generaltranslation.com"
|
|
3
|
-
<
|
|
2
|
+
<a href="https://generaltranslation.com/docs/react">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://generaltranslation.com/gt-logo-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://generaltranslation.com/gt-logo-light.svg">
|
|
6
|
+
<img alt="General Translation" src="https://generaltranslation.com/gt-logo-light.svg" width="100" height="100">
|
|
7
|
+
</picture>
|
|
4
8
|
</a>
|
|
5
9
|
</p>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://generaltranslation.com/docs/react"><strong>Documentation</strong></a> · <a href="https://github.com/generaltranslation/gt/issues">Report Bug</a>
|
|
13
|
+
</p>
|
|
8
14
|
|
|
9
|
-
gt-react
|
|
15
|
+
# gt-react
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
Automatic i18n for React.
|
|
12
18
|
|
|
13
19
|
## Installation
|
|
14
20
|
|
|
15
|
-
Install `gt-react` via npm:
|
|
16
|
-
|
|
17
21
|
```bash
|
|
18
22
|
npm install gt-react
|
|
19
23
|
npm install gtx-cli --save-dev
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
Follow the [Quick Start Guide](https://generaltranslation.com/docs/react) or run the setup wizard: `npx gtx-cli init` and add the [`<GTProvider>`](https://generaltranslation.com/en-US/docs/react#gtprovider) to your app.
|
|
25
|
-
|
|
26
|
-
Translate everything inside of the `<T>` component.
|
|
27
|
-
|
|
28
|
-
```jsx
|
|
29
|
-
<T>
|
|
30
|
-
<p>This gets translated!</p>
|
|
31
|
-
<div>This also gets translated!</divs>
|
|
32
|
-
</T>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Documentation
|
|
36
|
-
|
|
37
|
-
Full documentation, including guides, examples, and API references, can be found at [General Translation Docs](generaltranslation.com/docs).
|
|
38
|
-
|
|
39
|
-
## Features
|
|
40
|
-
|
|
41
|
-
### Jsx Translation
|
|
42
|
-
|
|
43
|
-
```jsx
|
|
44
|
-
<T>
|
|
45
|
-
Translate anything inside of a {'<T>'} component!
|
|
46
|
-
<div>Including nested structures</div>
|
|
47
|
-
</T>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Inline string translation
|
|
51
|
-
|
|
52
|
-
```jsx
|
|
53
|
-
function MyComponent() {
|
|
54
|
-
const gt = useGT();
|
|
55
|
-
return <>{gt('Strings as well!')}</>;
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Dictionary translation
|
|
26
|
+
## Quick Start
|
|
60
27
|
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
"key": "Hello, World!"
|
|
64
|
-
}
|
|
28
|
+
```bash
|
|
29
|
+
npx gtx-cli init
|
|
65
30
|
```
|
|
66
31
|
|
|
67
32
|
```jsx
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
33
|
+
import { T, GTProvider } from 'gt-react';
|
|
34
|
+
|
|
35
|
+
export default function App() {
|
|
36
|
+
return (
|
|
37
|
+
<GTProvider>
|
|
38
|
+
<T>
|
|
39
|
+
<p>This gets translated automatically.</p>
|
|
40
|
+
</T>
|
|
41
|
+
</GTProvider>
|
|
42
|
+
);
|
|
71
43
|
}
|
|
72
44
|
```
|
|
73
45
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Support for pluralization and conditional branching
|
|
77
|
-
|
|
78
|
-
```jsx
|
|
79
|
-
<T>
|
|
80
|
-
<Plural
|
|
81
|
-
n={count}
|
|
82
|
-
singular="There is 1 person"
|
|
83
|
-
plural={<>There are <Num>{count}</Num> people}
|
|
84
|
-
/>
|
|
85
|
-
</T>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Formatting
|
|
89
|
-
|
|
90
|
-
Support for number, currency, date time, and dynamic variables
|
|
91
|
-
|
|
92
|
-
```jsx
|
|
93
|
-
<Num options={{ style: 'currency', currency: 'EUR' }}>{1000}</Num>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Contributing
|
|
97
|
-
|
|
98
|
-
We welcome any contributions to our libraries. Please submit a pull request!
|
|
46
|
+
See the [full documentation](https://generaltranslation.com/docs/react) for guides and API reference.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-react",
|
|
3
|
-
"version": "10.10.
|
|
3
|
+
"version": "10.10.4",
|
|
4
4
|
"description": "A React library for automatic internationalization.",
|
|
5
5
|
"main": "./dist/index.cjs.min.cjs",
|
|
6
6
|
"module": "./dist/index.esm.min.mjs",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"react-dom": ">=16.8.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@generaltranslation/supported-locales": "2.0.
|
|
18
|
-
"generaltranslation": "8.1.
|
|
19
|
-
"@generaltranslation/react-core": "1.4.
|
|
17
|
+
"@generaltranslation/supported-locales": "2.0.38",
|
|
18
|
+
"generaltranslation": "8.1.7",
|
|
19
|
+
"@generaltranslation/react-core": "1.4.4"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|