glotstack 0.0.11 → 0.0.14
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/README.md +207 -0
- package/dist/cli.js +34 -64
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +4 -30
- package/dist/index.js +74 -57
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +15 -0
- package/dist/logging.js +44 -0
- package/dist/logging.js.map +1 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/util/fetchGlotstack.d.ts +2 -0
- package/dist/util/fetchGlotstack.js +36 -0
- package/dist/util/fetchGlotstack.js.map +1 -0
- package/dist/util/findConfig.js +8 -4
- package/dist/util/findConfig.js.map +1 -1
- package/dist/util/object.d.ts +1 -0
- package/dist/util/object.js +21 -1
- package/dist/util/object.js.map +1 -1
- package/dist/util/waitForFile.d.ts +2 -0
- package/dist/util/waitForFile.js +58 -0
- package/dist/util/waitForFile.js.map +1 -0
- package/package.json +21 -12
- package/.prettierrc +0 -10
- package/eslint-raw-string.mjs +0 -15
- package/scripts/fix-shebang.sh +0 -28
- package/src/cli.tsx +0 -295
- package/src/index.tsx +0 -518
- package/src/util/findConfig.ts +0 -97
- package/src/util/object.ts +0 -47
- package/src/util/yaml.ts +0 -11
- package/tsconfig.json +0 -23
- package/types/global.d.ts +0 -7
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
[](https://badge.fury.io/js/glotstack)
|
|
2
|
+
|
|
3
|
+
# Glotstack
|
|
4
|
+
|
|
5
|
+
Glotstack is an internationalization and localization tool (translations). This package
|
|
6
|
+
contains a simple React/Typescript SDK. It also contains a command-line interface
|
|
7
|
+
to fetch and extract translations for your source code.
|
|
8
|
+
|
|
9
|
+
[glotstack.ai](https://glotstack.ai)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
This project requires NodeJS (version 20 or later) and NPM.
|
|
15
|
+
To make sure you have them available on your machine,
|
|
16
|
+
try running the following command, I recommend using [asdf](https://asdf-vm.com/guide/introduction.html)
|
|
17
|
+
|
|
18
|
+
## Table of contents
|
|
19
|
+
|
|
20
|
+
- [Glotstack](#glotstack)
|
|
21
|
+
- [Table of contents](#table-of-contents)
|
|
22
|
+
- [Getting Started](#getting-started)
|
|
23
|
+
- [Installation](#installation)
|
|
24
|
+
- [Usage](#usage)
|
|
25
|
+
- [Basics](#basics)
|
|
26
|
+
- [Get Translations](#get-translations)
|
|
27
|
+
- [Create your source locale file](#create-your-source-locale-file)
|
|
28
|
+
- [React app](#react-app)
|
|
29
|
+
- [Credits](#credits)
|
|
30
|
+
- [Authors](#authors)
|
|
31
|
+
- [License](#license)
|
|
32
|
+
|
|
33
|
+
## Getting Started
|
|
34
|
+
|
|
35
|
+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
To install and set up the library, run:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
$ yarn add glotstack
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or if you prefer using npm:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
$ npm install glotstack
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
See quickstart instructions [here](https://glotstack.ai/quickstart)
|
|
55
|
+
|
|
56
|
+
### Basics
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
#### Glotstack Config
|
|
60
|
+
Add a `.glotstack.json` or `.glotstack.yaml` file in the root of your project.
|
|
61
|
+
Yaml is preferred because it's a config language that allows comments.
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
# .glotstack.yaml
|
|
65
|
+
|
|
66
|
+
# path to where you will keep your translation files
|
|
67
|
+
sourcePath: './domains/application/translations'
|
|
68
|
+
|
|
69
|
+
# [optional] where to output the files to if not the same as sourcePath - this is usually not necessary
|
|
70
|
+
outputDir: './domains/application/translations'
|
|
71
|
+
|
|
72
|
+
# what locales you want to get translations for
|
|
73
|
+
outputLocales:
|
|
74
|
+
- fr-FR
|
|
75
|
+
- th-TH
|
|
76
|
+
# ...etc
|
|
77
|
+
|
|
78
|
+
# you *can* put your api key here if you trust the file and/or don't check it into vcs
|
|
79
|
+
# alternatively, you can use --api-key on the CLI
|
|
80
|
+
apiKey: HBZYpOiMCFQ/FeryMnFvKx3Zafee/mA1B/ExRcGv6QuGy/vvffU0g6xjO/4tZw4b
|
|
81
|
+
|
|
82
|
+
# [optional] for using different projects with your key
|
|
83
|
+
projectId: glotstack
|
|
84
|
+
|
|
85
|
+
usage:
|
|
86
|
+
# Context to help out your translator - add context about your application or use-case.
|
|
87
|
+
# Multilines are fine!
|
|
88
|
+
context: |
|
|
89
|
+
The app is a translation application that helps users generate localized translations to
|
|
90
|
+
use as product copy without the help of human translators.
|
|
91
|
+
|
|
92
|
+
# Any proper nouns that should not be translated, i.e. names of things
|
|
93
|
+
properNouns:
|
|
94
|
+
- React
|
|
95
|
+
- Glotstack
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Create your source locale file
|
|
99
|
+
|
|
100
|
+
You can use `en-US.json` or `en-US.yaml` files as source translation files. Internally
|
|
101
|
+
Glotstack uses YAML because it allows comments and is nice (once you get used to it).
|
|
102
|
+
|
|
103
|
+
In your folder of choice (usually somewhere in your `src`) add your `en-US.json` or `en-US.yaml`
|
|
104
|
+
files, you will need it to match `sourcePath` in your config or `--source-path` when using CLI.
|
|
105
|
+
|
|
106
|
+
The source file will not be translated and should contain your translations in the following format:
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
Anything:
|
|
110
|
+
aRbITraRy:
|
|
111
|
+
value: A string to translate
|
|
112
|
+
context: what the string is used for or what it means to your audience
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Every value you want translated should have a context but it isn't required -- you will just
|
|
116
|
+
get poorer results.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
**Note: If you use the `.yaml` file you will most-likely want to use the yaml-to-json CLI tool**
|
|
120
|
+
|
|
121
|
+
Because setting up your build to import JSON or YAML would be annoying, the sub-command `yaml-to-json`
|
|
122
|
+
was added to the `glostack` command. I use it with `nodemon`, but because I didn't want to bloat this
|
|
123
|
+
packages bundle I did not make it a peer dependency. To make it convenient, add a `package.json` script.
|
|
124
|
+
Below is a script that converts your YAML file to the same name JSON file. Then your imports will all be JSON files.
|
|
125
|
+
|
|
126
|
+
If this is too annoying, just use `en-US.json`.
|
|
127
|
+
|
|
128
|
+
First add nodemon
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
yarn add nodemon
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
then add the script
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"scripts": {
|
|
139
|
+
"watch.translations": "nodemon --watch . --ext yaml --exec \"bash -c 'yarn glotstack yaml-to-json'\"",
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
#### React app
|
|
146
|
+
|
|
147
|
+
Add the provider globally to your application
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import * as React from 'react'
|
|
151
|
+
import { GlotstackProvider } from 'glotstack'
|
|
152
|
+
|
|
153
|
+
const importMethod = (locale: string) => {
|
|
154
|
+
// fetch() from static directories to limit bundle sizes.
|
|
155
|
+
// If you don't care about bundling you can always do
|
|
156
|
+
// `import(...)`
|
|
157
|
+
// your project supports dynamic imports and json files
|
|
158
|
+
return fetch(`/static/translations/${locale}.json`)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const Application = () => {
|
|
162
|
+
const locale = 'en-US' // replace with your locale source
|
|
163
|
+
return (
|
|
164
|
+
<GlotstackProvider initialLocale={locale} importMethod={importMethod}>
|
|
165
|
+
<MyComponent />
|
|
166
|
+
</GlotstackProvider>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Note: Dynamic imports are usually better for SSR and fetch() for client side.**
|
|
172
|
+
|
|
173
|
+
Use the hook in your component
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import * as React from 'react'
|
|
177
|
+
import {useGlotstack} from 'glotstack'
|
|
178
|
+
|
|
179
|
+
function MyComponent() => {
|
|
180
|
+
const {t} = useGlotstack()
|
|
181
|
+
|
|
182
|
+
return <div>{t('Quickstart.hero-title')}</div>
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
## Get translations
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
yarn glotstack get-translations --api-key <api-key>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Glotstack will fetch the translations defined by `outputLocales` in your config
|
|
194
|
+
or `--output-locales` via CLI. You can specify `outputDir` (`--output-dir`) or
|
|
195
|
+
they will be written to the same directory as `sourcePath` (`--source-path`).
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
## Authors
|
|
201
|
+
|
|
202
|
+
* **JD Cumpson** - *Founder* - [JD](https://github.com/jdcumpson)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
[MIT License](https://andreasonny.mit-license.org/2019) © Andrea SonnY
|
package/dist/cli.js
CHANGED
|
@@ -47,53 +47,12 @@ const eslint_1 = __importDefault(require("eslint"));
|
|
|
47
47
|
const readline = __importStar(require("node:readline/promises"));
|
|
48
48
|
const node_process_1 = require("node:process");
|
|
49
49
|
const undici_1 = require("undici");
|
|
50
|
-
const undici_2 = require("undici");
|
|
51
50
|
const node_fs_1 = require("node:fs");
|
|
52
51
|
const promises_1 = require("node:fs/promises");
|
|
53
52
|
const node_path_1 = require("node:path");
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const headers = Object.assign({ 'authorization': `Bearer ${apiKey}` }, (overrideHeaders == null ? {} : overrideHeaders));
|
|
58
|
-
let payloadBody;
|
|
59
|
-
if (!(body instanceof undici_2.FormData)) {
|
|
60
|
-
headers['content-type'] = 'application/json';
|
|
61
|
-
payloadBody = JSON.stringify(body);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
payloadBody = body;
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
const res = yield (0, undici_1.fetch)(url, { method: 'POST', body: payloadBody, headers });
|
|
68
|
-
if (!res.ok)
|
|
69
|
-
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
|
70
|
-
return res.json();
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
console.error('Fetch failed:', err);
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
function unflatten(flat) {
|
|
79
|
-
const result = {};
|
|
80
|
-
for (const flatKey in flat) {
|
|
81
|
-
const parts = flatKey.split('.');
|
|
82
|
-
let current = result;
|
|
83
|
-
parts.forEach((part, idx) => {
|
|
84
|
-
if (idx === parts.length - 1) {
|
|
85
|
-
current[part] = flat[flatKey];
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
if (!(part in current)) {
|
|
89
|
-
current[part] = {};
|
|
90
|
-
}
|
|
91
|
-
current = current[part];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
53
|
+
const fetchGlotstack_1 = require("./util/fetchGlotstack");
|
|
54
|
+
const logging_1 = __importDefault(require("./logging"));
|
|
55
|
+
const waitForFile_1 = require("./util/waitForFile");
|
|
97
56
|
const DEFAULT_OPTIONS = {
|
|
98
57
|
sourcePath: '.',
|
|
99
58
|
sourceLocale: 'en-US',
|
|
@@ -115,7 +74,7 @@ function resolveConfigAndOptions(options) {
|
|
|
115
74
|
}
|
|
116
75
|
if ('outputLocales' in options) {
|
|
117
76
|
if (resolved.outputLocales.includes(resolved.sourceLocale)) {
|
|
118
|
-
|
|
77
|
+
logging_1.default.warn(`${resolved.sourceLocale} detected in outputLocales, removing`);
|
|
119
78
|
options.outputLocales = options.outputLocales.filter((x) => x !== resolved.sourceLocale);
|
|
120
79
|
}
|
|
121
80
|
}
|
|
@@ -155,7 +114,7 @@ function run(args) {
|
|
|
155
114
|
return true;
|
|
156
115
|
}
|
|
157
116
|
else if (response !== 'no') {
|
|
158
|
-
|
|
117
|
+
logging_1.default.error('Please respond with yes or no.');
|
|
159
118
|
return askToSend();
|
|
160
119
|
}
|
|
161
120
|
else {
|
|
@@ -164,19 +123,20 @@ function run(args) {
|
|
|
164
123
|
});
|
|
165
124
|
const send = yield askToSend();
|
|
166
125
|
if (send) {
|
|
167
|
-
|
|
126
|
+
logging_1.default.info('Sending files to generate new source and extracted strings');
|
|
168
127
|
let url = `${options.apiOrigin}/uploads/translations/extract`;
|
|
169
128
|
if (options.yaml) {
|
|
170
129
|
url = `${url}?yaml=true`;
|
|
171
130
|
}
|
|
172
|
-
const form = new
|
|
131
|
+
const form = new undici_1.FormData();
|
|
173
132
|
for (let i = 0; i < filesWithIssues.length; i++) {
|
|
174
133
|
const filePath = filesWithIssues[i];
|
|
175
134
|
form.append(`file_${i}`, yield (0, node_fs_1.openAsBlob)(filePath), filePath);
|
|
176
|
-
|
|
135
|
+
logging_1.default.debug(`Uploading file: ${filePath}`);
|
|
177
136
|
}
|
|
178
|
-
const
|
|
179
|
-
data
|
|
137
|
+
const response = yield (0, fetchGlotstack_1.fetchGlotstack)(url, options.apiKey, form);
|
|
138
|
+
const data = (yield response.json()).data;
|
|
139
|
+
data.translations.map(elem => logging_1.default.info(`Source and translations available for: ${elem.name}:\n ${elem.modified_source.url}\n\n`));
|
|
180
140
|
rl.close();
|
|
181
141
|
}
|
|
182
142
|
else {
|
|
@@ -218,7 +178,7 @@ function run(args) {
|
|
|
218
178
|
json = JSON.parse(fileContent);
|
|
219
179
|
}
|
|
220
180
|
catch (err) {
|
|
221
|
-
|
|
181
|
+
logging_1.default.error('Unable to parse source file ', absPath, err);
|
|
222
182
|
throw err;
|
|
223
183
|
}
|
|
224
184
|
}
|
|
@@ -227,20 +187,30 @@ function run(args) {
|
|
|
227
187
|
locales = locales.filter(l => l === options.only);
|
|
228
188
|
}
|
|
229
189
|
const body = Object.assign({ locales, translations: json, usage: options.usage }, Object.assign({}, (resolved.projectId != null ? { projectId: resolved.projectId } : {})));
|
|
190
|
+
logging_1.default.info('Getting translations for: ', locales);
|
|
230
191
|
const url = `${resolved.apiOrigin}/api/translations`;
|
|
231
|
-
|
|
232
|
-
const data = yield
|
|
233
|
-
|
|
234
|
-
Object.entries(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
192
|
+
const response = yield (0, fetchGlotstack_1.fetchGlotstack)(url, resolved.apiKey, body);
|
|
193
|
+
const data = yield response.json();
|
|
194
|
+
const urlMap = data.data;
|
|
195
|
+
const translationsMap = Object.entries(urlMap).map(([locale, data]) => {
|
|
196
|
+
return [locale, (0, waitForFile_1.waitForFile)(data.url, resolved.apiKey)];
|
|
197
|
+
})
|
|
198
|
+
.reduce((map, [locale, promise]) => {
|
|
199
|
+
map[locale] = promise;
|
|
200
|
+
return map;
|
|
201
|
+
}, {});
|
|
239
202
|
if (options.yaml) {
|
|
240
203
|
const fp = `${resolved.outputDir}/${path_1.default.parse(absPath).name}.json`;
|
|
241
|
-
|
|
204
|
+
logging_1.default.info(`Writing file ${fp}`);
|
|
242
205
|
fs_1.promises.writeFile(fp, JSON.stringify(json, null, 2), 'utf-8');
|
|
243
206
|
}
|
|
207
|
+
logging_1.default.info('Waiting for translations', Object.keys(translationsMap));
|
|
208
|
+
yield Promise.all(Object.entries(translationsMap).map((_a) => __awaiter(this, [_a], void 0, function* ([locale, promise]) {
|
|
209
|
+
const val = yield promise;
|
|
210
|
+
const p = `${resolved.outputDir}/${locale}.json`;
|
|
211
|
+
logging_1.default.info(`Writing file ${p}`);
|
|
212
|
+
yield fs_1.promises.writeFile(`${resolved.outputDir}/${locale}.json`, JSON.stringify(val, null, 2), 'utf-8');
|
|
213
|
+
})));
|
|
244
214
|
}));
|
|
245
215
|
commander_1.program
|
|
246
216
|
.command('yaml-to-json')
|
|
@@ -251,7 +221,7 @@ function run(args) {
|
|
|
251
221
|
const fileContent = yield fs_1.promises.readFile(absPath, 'utf-8');
|
|
252
222
|
const fp = `${options.outputDir}/${path_1.default.parse(absPath).name}.json`;
|
|
253
223
|
const json = (0, yaml_1.loadYaml)(fileContent);
|
|
254
|
-
|
|
224
|
+
logging_1.default.info(`Writing file ${fp}`);
|
|
255
225
|
fs_1.promises.writeFile(fp, JSON.stringify(json, null, 2), 'utf-8');
|
|
256
226
|
}));
|
|
257
227
|
commander_1.program
|
|
@@ -274,7 +244,7 @@ function run(args) {
|
|
|
274
244
|
return true;
|
|
275
245
|
}
|
|
276
246
|
else if (response !== 'no') {
|
|
277
|
-
|
|
247
|
+
logging_1.default.error('Please respond with yes or no.');
|
|
278
248
|
return askToSend();
|
|
279
249
|
}
|
|
280
250
|
else {
|
|
@@ -288,7 +258,7 @@ function run(args) {
|
|
|
288
258
|
const fp = (0, node_path_1.resolve)(options.sourcePath, files[i]);
|
|
289
259
|
const text = yield (0, promises_1.readFile)(fp, 'utf-8');
|
|
290
260
|
const json = JSON.parse(text);
|
|
291
|
-
const formatted = JSON.stringify(unflatten(json), null, 2);
|
|
261
|
+
const formatted = JSON.stringify((0, object_1.unflatten)(json), null, 2);
|
|
292
262
|
yield (0, promises_1.writeFile)(fp, formatted, 'utf-8');
|
|
293
263
|
}
|
|
294
264
|
rl.close();
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC9C,MAAM,EAAE,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;oBAChD,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAQ,EAAC,EAAE,EAAE,OAAO,CAAC,CAAA;oBACxC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;oBAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,kBAAS,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;oBAC1D,MAAM,IAAA,oBAAS,EAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;gBACzC,CAAC;gBACD,EAAE,CAAC,KAAK,EAAE,CAAA;YACZ,CAAC;YACD,EAAE,CAAC,KAAK,EAAE,CAAA;QAEZ,CAAC,CAAA,CAAC,CAAA;QAGJ,MAAM,mBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CAAA;AAED,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
context?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface Translations {
|
|
8
|
-
[key: string]: Translations | TranslationLeaf;
|
|
9
|
-
}
|
|
10
|
-
interface TranslateOptsBase {
|
|
11
|
-
locale?: LocaleRegion;
|
|
12
|
-
assigns?: Record<string, React.ReactNode>;
|
|
13
|
-
}
|
|
14
|
-
export type TranslateFn = {
|
|
15
|
-
(key: string, opts: TranslateOptsBase & {
|
|
16
|
-
asString: true;
|
|
17
|
-
}): string;
|
|
18
|
-
(key: string, opts?: TranslateOptsBase & {
|
|
19
|
-
asString?: false;
|
|
20
|
-
}): React.ReactNode;
|
|
21
|
-
};
|
|
2
|
+
export { default as logger, setLogLevel, LogLevel } from "./logging";
|
|
3
|
+
export { LocaleRegion, JSONArray, Translations } from './types';
|
|
4
|
+
import type { LocaleRegion, TranslateFn, Translations } from './types';
|
|
22
5
|
export interface ContextType {
|
|
23
6
|
translations: Record<string, Translations>;
|
|
24
7
|
locale: string | null;
|
|
@@ -37,16 +20,8 @@ interface GlotstackProviderProps {
|
|
|
37
20
|
importMethod: ContextType['importMethod'];
|
|
38
21
|
ssr?: boolean;
|
|
39
22
|
}
|
|
40
|
-
export declare enum LogLevel {
|
|
41
|
-
DEBUG = 0,
|
|
42
|
-
LOG = 1,
|
|
43
|
-
INFO = 2,
|
|
44
|
-
WARNING = 3,
|
|
45
|
-
ERROR = 4
|
|
46
|
-
}
|
|
47
|
-
export declare const setLogLevel: (level: LogLevel) => void;
|
|
48
23
|
export declare const access: (key: string, locale: LocaleRegion, translations: Translations) => string;
|
|
49
|
-
export declare const GlotstackProvider: ({ children, initialLocale, initialTranslations, onLocaleChange, onTranslationLoaded, importMethod }: GlotstackProviderProps) =>
|
|
24
|
+
export declare const GlotstackProvider: ({ children, initialLocale, initialTranslations, onLocaleChange, onTranslationLoaded, importMethod }: GlotstackProviderProps) => React.JSX.Element;
|
|
50
25
|
export declare const useGlotstack: () => ContextType;
|
|
51
26
|
export declare const useTranslations: (_options?: Record<never, never>) => ContextType;
|
|
52
27
|
export type ParsedSimplePlaceholder = {
|
|
@@ -62,4 +37,3 @@ type Renderer = (props: {
|
|
|
62
37
|
}) => React.ReactNode;
|
|
63
38
|
export declare function renderPlaceholdersToNodes(input: string, placeholders: ParsedSimplePlaceholder[], assigns: Record<string, React.ReactNode | Renderer>): React.ReactNode[];
|
|
64
39
|
export declare function useRenderPlaceholdersToNodes(...args: Parameters<typeof renderPlaceholdersToNodes>): React.ReactNode[];
|
|
65
|
-
export {};
|