intor-translator 1.0.4 → 1.0.5
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 +1 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -269,7 +269,7 @@ var CoreTranslator = class extends BaseTranslator {
|
|
|
269
269
|
replacements
|
|
270
270
|
});
|
|
271
271
|
};
|
|
272
|
-
this.options = options;
|
|
272
|
+
this.options = options || {};
|
|
273
273
|
}
|
|
274
274
|
/** Get the current loading state. */
|
|
275
275
|
get isLoading() {
|
|
@@ -320,7 +320,6 @@ var ScopeTranslator = class extends CoreTranslator {
|
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
322
|
};
|
|
323
|
-
this.options = options;
|
|
324
323
|
}
|
|
325
324
|
};
|
|
326
325
|
|
package/dist/index.d.cts
CHANGED
|
@@ -371,7 +371,7 @@ interface CoreTranslatorOptions<M extends LocaleNamespaceMessages> extends BaseT
|
|
|
371
371
|
declare class CoreTranslator<M extends LocaleNamespaceMessages = never> extends BaseTranslator<M> {
|
|
372
372
|
protected options: CoreTranslatorOptions<M>;
|
|
373
373
|
protected isLoadingRef: IsLoadingRef;
|
|
374
|
-
constructor(options
|
|
374
|
+
constructor(options?: CoreTranslatorOptions<M>);
|
|
375
375
|
/** Get the current loading state. */
|
|
376
376
|
get isLoading(): boolean;
|
|
377
377
|
/** Set the loading state. */
|
|
@@ -379,8 +379,8 @@ declare class CoreTranslator<M extends LocaleNamespaceMessages = never> extends
|
|
|
379
379
|
t: <Result = string>(key: InferTranslatorKey<M>, replacements?: Replacement | RichReplacement) => Result;
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
declare class ScopeTranslator<M extends LocaleNamespaceMessages> extends CoreTranslator<M> {
|
|
383
|
-
constructor(options
|
|
382
|
+
declare class ScopeTranslator<M extends LocaleNamespaceMessages = never> extends CoreTranslator<M> {
|
|
383
|
+
constructor(options?: CoreTranslatorOptions<M>);
|
|
384
384
|
scoped: <K extends NodeKeys<UnionLocaleMessages<M>> & string, ScopedKeys extends ScopedLeafKeys<M, K> & string>(preKey: K) => {
|
|
385
385
|
hasKey: (key?: ScopedKeys | undefined, targetLocale?: string) => boolean;
|
|
386
386
|
t: (key?: ScopedKeys | undefined, replacements?: Replacement | RichReplacement) => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -371,7 +371,7 @@ interface CoreTranslatorOptions<M extends LocaleNamespaceMessages> extends BaseT
|
|
|
371
371
|
declare class CoreTranslator<M extends LocaleNamespaceMessages = never> extends BaseTranslator<M> {
|
|
372
372
|
protected options: CoreTranslatorOptions<M>;
|
|
373
373
|
protected isLoadingRef: IsLoadingRef;
|
|
374
|
-
constructor(options
|
|
374
|
+
constructor(options?: CoreTranslatorOptions<M>);
|
|
375
375
|
/** Get the current loading state. */
|
|
376
376
|
get isLoading(): boolean;
|
|
377
377
|
/** Set the loading state. */
|
|
@@ -379,8 +379,8 @@ declare class CoreTranslator<M extends LocaleNamespaceMessages = never> extends
|
|
|
379
379
|
t: <Result = string>(key: InferTranslatorKey<M>, replacements?: Replacement | RichReplacement) => Result;
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
declare class ScopeTranslator<M extends LocaleNamespaceMessages> extends CoreTranslator<M> {
|
|
383
|
-
constructor(options
|
|
382
|
+
declare class ScopeTranslator<M extends LocaleNamespaceMessages = never> extends CoreTranslator<M> {
|
|
383
|
+
constructor(options?: CoreTranslatorOptions<M>);
|
|
384
384
|
scoped: <K extends NodeKeys<UnionLocaleMessages<M>> & string, ScopedKeys extends ScopedLeafKeys<M, K> & string>(preKey: K) => {
|
|
385
385
|
hasKey: (key?: ScopedKeys | undefined, targetLocale?: string) => boolean;
|
|
386
386
|
t: (key?: ScopedKeys | undefined, replacements?: Replacement | RichReplacement) => string;
|
package/dist/index.js
CHANGED
|
@@ -267,7 +267,7 @@ var CoreTranslator = class extends BaseTranslator {
|
|
|
267
267
|
replacements
|
|
268
268
|
});
|
|
269
269
|
};
|
|
270
|
-
this.options = options;
|
|
270
|
+
this.options = options || {};
|
|
271
271
|
}
|
|
272
272
|
/** Get the current loading state. */
|
|
273
273
|
get isLoading() {
|
|
@@ -318,7 +318,6 @@ var ScopeTranslator = class extends CoreTranslator {
|
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
};
|
|
321
|
-
this.options = options;
|
|
322
321
|
}
|
|
323
322
|
};
|
|
324
323
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intor-translator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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",
|