intor-translator 1.0.7 → 1.0.8
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/dist/index.cjs +23 -23
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +23 -23
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -297,29 +297,29 @@ var getFullKey = (preKey = "", key = "") => {
|
|
|
297
297
|
var ScopeTranslator = class extends CoreTranslator {
|
|
298
298
|
constructor(options) {
|
|
299
299
|
super(options);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
}
|
|
300
|
+
}
|
|
301
|
+
scoped(preKey) {
|
|
302
|
+
return {
|
|
303
|
+
hasKey: (key, targetLocale) => {
|
|
304
|
+
const fullKey = getFullKey(preKey, key);
|
|
305
|
+
return hasKey({
|
|
306
|
+
messagesRef: this.messagesRef,
|
|
307
|
+
localeRef: this.localeRef,
|
|
308
|
+
key: fullKey,
|
|
309
|
+
targetLocale
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
t: (key, replacements) => {
|
|
313
|
+
const fullKey = getFullKey(preKey, key);
|
|
314
|
+
return translate({
|
|
315
|
+
messagesRef: this.messagesRef,
|
|
316
|
+
localeRef: this.localeRef,
|
|
317
|
+
isLoadingRef: this.isLoadingRef,
|
|
318
|
+
translateConfig: this.options,
|
|
319
|
+
key: fullKey,
|
|
320
|
+
replacements
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
325
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -386,9 +386,13 @@ declare class CoreTranslator<M extends LocaleNamespaceMessages = never> extends
|
|
|
386
386
|
|
|
387
387
|
declare class ScopeTranslator<M extends LocaleNamespaceMessages = never> extends CoreTranslator<M> {
|
|
388
388
|
constructor(options?: CoreTranslatorOptions<M>);
|
|
389
|
-
scoped
|
|
390
|
-
hasKey: (key?:
|
|
391
|
-
t: (key?:
|
|
389
|
+
scoped<K extends NodeKeys<UnionLocaleMessages<M>> & string>(preKey: K): {
|
|
390
|
+
hasKey: (key?: ScopedLeafKeys<M, K> & string, targetLocale?: string) => boolean;
|
|
391
|
+
t: (key?: ScopedLeafKeys<M, K> & string, replacements?: Replacement | RichReplacement) => string;
|
|
392
|
+
};
|
|
393
|
+
scoped(): {
|
|
394
|
+
hasKey: (key?: UnionLocaleLeafKeys<M> & string, targetLocale?: string) => boolean;
|
|
395
|
+
t: (key?: UnionLocaleLeafKeys<M> & string, replacements?: Replacement | RichReplacement) => string;
|
|
392
396
|
};
|
|
393
397
|
}
|
|
394
398
|
|
package/dist/index.d.ts
CHANGED
|
@@ -386,9 +386,13 @@ declare class CoreTranslator<M extends LocaleNamespaceMessages = never> extends
|
|
|
386
386
|
|
|
387
387
|
declare class ScopeTranslator<M extends LocaleNamespaceMessages = never> extends CoreTranslator<M> {
|
|
388
388
|
constructor(options?: CoreTranslatorOptions<M>);
|
|
389
|
-
scoped
|
|
390
|
-
hasKey: (key?:
|
|
391
|
-
t: (key?:
|
|
389
|
+
scoped<K extends NodeKeys<UnionLocaleMessages<M>> & string>(preKey: K): {
|
|
390
|
+
hasKey: (key?: ScopedLeafKeys<M, K> & string, targetLocale?: string) => boolean;
|
|
391
|
+
t: (key?: ScopedLeafKeys<M, K> & string, replacements?: Replacement | RichReplacement) => string;
|
|
392
|
+
};
|
|
393
|
+
scoped(): {
|
|
394
|
+
hasKey: (key?: UnionLocaleLeafKeys<M> & string, targetLocale?: string) => boolean;
|
|
395
|
+
t: (key?: UnionLocaleLeafKeys<M> & string, replacements?: Replacement | RichReplacement) => string;
|
|
392
396
|
};
|
|
393
397
|
}
|
|
394
398
|
|
package/dist/index.js
CHANGED
|
@@ -295,29 +295,29 @@ var getFullKey = (preKey = "", key = "") => {
|
|
|
295
295
|
var ScopeTranslator = class extends CoreTranslator {
|
|
296
296
|
constructor(options) {
|
|
297
297
|
super(options);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
}
|
|
298
|
+
}
|
|
299
|
+
scoped(preKey) {
|
|
300
|
+
return {
|
|
301
|
+
hasKey: (key, targetLocale) => {
|
|
302
|
+
const fullKey = getFullKey(preKey, key);
|
|
303
|
+
return hasKey({
|
|
304
|
+
messagesRef: this.messagesRef,
|
|
305
|
+
localeRef: this.localeRef,
|
|
306
|
+
key: fullKey,
|
|
307
|
+
targetLocale
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
t: (key, replacements) => {
|
|
311
|
+
const fullKey = getFullKey(preKey, key);
|
|
312
|
+
return translate({
|
|
313
|
+
messagesRef: this.messagesRef,
|
|
314
|
+
localeRef: this.localeRef,
|
|
315
|
+
isLoadingRef: this.isLoadingRef,
|
|
316
|
+
translateConfig: this.options,
|
|
317
|
+
key: fullKey,
|
|
318
|
+
replacements
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intor-translator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "A type safe translator that knows what to say and how to handle the rest. Supports custom messages, rich replacements, and async loading.",
|
|
5
5
|
"author": "Yiming Liao",
|
|
6
6
|
"license": "MIT",
|