gt-next 6.11.1 → 6.11.3

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # gt-next
2
2
 
3
+ ## 6.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#888](https://github.com/generaltranslation/gt/pull/888) [`6314624`](https://github.com/generaltranslation/gt/commit/6314624cd6d537e236e7208b1097dc137befab66) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: readme
8
+
9
+ - Updated dependencies [[`6314624`](https://github.com/generaltranslation/gt/commit/6314624cd6d537e236e7208b1097dc137befab66)]:
10
+ - gt-react@10.9.3
11
+
12
+ ## 6.11.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [[`e113d8d`](https://github.com/generaltranslation/gt/commit/e113d8d8fb5e37f45a4aa77544e8f4666519bfe8)]:
17
+ - generaltranslation@8.1.3
18
+ - @generaltranslation/compiler@1.1.11
19
+ - gt-react@10.9.2
20
+ - @generaltranslation/supported-locales@2.0.33
21
+
3
22
  ## 6.11.1
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -16,89 +16,82 @@ Install `gt-next` via npm:
16
16
 
17
17
  ```bash
18
18
  npm install gt-next
19
- npm install gt-next-cli --save-dev
19
+ npm install gtx-cli --save-dev
20
20
  ```
21
21
 
22
22
  ## Getting Started
23
23
 
24
- ### Step 1: Configure Your Environment Variables
24
+ Follow the [Quick Start Guide](https://generaltranslation.com/docs/next) or run the setup wizard: `npx gtx-cli init`.
25
25
 
26
- Add the following environment variables to your `.env` file:
26
+ Translate everything inside of the `<T>` component.
27
27
 
28
- ```bash
29
- GT_API_KEY="your-api-key"
30
- GT_PROJECT_ID="your-project-id"
28
+ ```jsx
29
+ <T>
30
+ <p>This gets translated!</p>
31
+ <div>This also gets translated!</divs>
32
+ </T>
31
33
  ```
32
34
 
33
- - Get your `API Key` and `Project ID` from the [General Translation Dashboard](https://generaltranslation.com).
34
-
35
- ### 2. Add the `withGTConfig()` plugin
35
+ ## Documentation
36
36
 
37
- Add `withGTConfig()` to your `next.config.js` file.
38
- You can specify the languages you want to support by passing an array of [locale codes](https://generaltranslation.com/docs/platform/locale-strings#supported-locales).
37
+ Full documentation, including guides, examples, and API references, can be found at [General Translation Docs](generaltranslation.com/docs).
39
38
 
40
- ```js
41
- import { withGTConfig } from 'gt-next/config';
39
+ ## Features
42
40
 
43
- const nextConfig = {};
41
+ ### Jsx Translation
44
42
 
45
- export default withGTConfig(nextConfig, {
46
- locales: ['pt', 'es'], // Support for Portuguese and Spanish
47
- swcPluginOptions: {
48
- logLevel: 'silent', // Control warning output
49
- compileTimeHash: false, // Enable compile-time optimizations
50
- },
51
- });
43
+ ```jsx
44
+ <T>
45
+ Translate anything inside of a {'<T>'} component!
46
+ <div>Including nested structures</div>
47
+ </T>
52
48
  ```
53
49
 
54
- ### 3. Add the `<T>` component
55
-
56
- Wrap any nested JSX content in the `<T>` component to make it translatable.
57
- For more information, check out this [guide on using `<T>` components](https://generaltranslation.com/docs/next/reference/t-reference).
50
+ ### Inline string translation
58
51
 
59
52
  ```jsx
60
- import { T } from 'gt-next';
61
-
62
- export default function Example() {
63
- return (
64
- <T>
65
- <p>This gets translated.</p>
66
- </T>
67
- );
53
+ function MyComponent() {
54
+ const gt = useGT();
55
+ return <>{gt('Strings as well!')}</>;
68
56
  }
69
57
  ```
70
58
 
71
- Use the `<Var>` component to designate JSX content that should not be translated.
59
+ ### Dictionary translation
60
+
61
+ ```json
62
+ {
63
+ "key": "Hello, World!"
64
+ }
65
+ ```
72
66
 
73
67
  ```jsx
74
- import { T, Var } from 'gt-next';
75
-
76
- export default function Example() {
77
- return (
78
- <T>
79
- <p>
80
- This gets translated. <Var>This does not.</Var>
81
- </p>
82
- </T>
83
- );
68
+ function MyComponent() {
69
+ const t = useTranslations();
70
+ return <>{t('key')}</>;
84
71
  }
85
72
  ```
86
73
 
87
- **Tip:**
88
- To save time, run the setup command.
89
- It will scan your codebase for translatable JSX and insert the `<T>` tags for you.
74
+ ### Pluralization
90
75
 
91
- ```bash
92
- npx gt-next-cli setup
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>
93
86
  ```
94
87
 
95
- **Strings:**
96
- For strings, you can use `useGT()` or `getGT()` for translation.
97
- For more information, check out [this guide](https://generaltranslation.com/docs/next/tutorials/translating-strings).
88
+ ### Formatting
98
89
 
99
- ## Documentation
90
+ Support for number, currency, date time, and dynamic variables
100
91
 
101
- Full documentation, including guides, examples, and API references, can be found at [General Translation Docs](generaltranslation.com/docs).
92
+ ```jsx
93
+ <Num options={{ style: 'currency', currency: 'EUR' }}>{1000}</Num>
94
+ ```
102
95
 
103
96
  ## Contributing
104
97
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt-next",
3
- "version": "6.11.1",
3
+ "version": "6.11.3",
4
4
  "description": "A Next.js library for automatic internationalization.",
5
5
  "main": "dist/index.server.js",
6
6
  "peerDependencies": {
@@ -13,11 +13,11 @@
13
13
  "CHANGELOG.md"
14
14
  ],
15
15
  "dependencies": {
16
- "@generaltranslation/supported-locales": "2.0.32",
17
- "@generaltranslation/compiler": "1.1.10",
16
+ "@generaltranslation/supported-locales": "2.0.33",
17
+ "@generaltranslation/compiler": "1.1.11",
18
18
  "@generaltranslation/next-internal": "0.1.0",
19
- "generaltranslation": "8.1.2",
20
- "gt-react": "10.9.1"
19
+ "generaltranslation": "8.1.3",
20
+ "gt-react": "10.9.3"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",