intor-translator 1.0.6 → 1.0.7

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 CHANGED
@@ -249,13 +249,9 @@ var BaseTranslator = class {
249
249
  get locale() {
250
250
  return this.localeRef.current;
251
251
  }
252
- /** Change the active locale if available. */
252
+ /** Change the active locale. */
253
253
  setLocale(newLocale) {
254
- if (this.messagesRef.current && newLocale in this.messagesRef.current) {
255
- this.localeRef.current = newLocale;
256
- return true;
257
- }
258
- return false;
254
+ this.localeRef.current = newLocale;
259
255
  }
260
256
  };
261
257
 
package/dist/index.d.cts CHANGED
@@ -364,8 +364,8 @@ declare class BaseTranslator<M extends LocaleNamespaceMessages = never> {
364
364
  setMessages<N extends LocaleNamespaceMessages>(messages: N): void;
365
365
  /** Get the current active locale. */
366
366
  get locale(): LocaleKey<M> | undefined;
367
- /** Change the active locale if available. */
368
- setLocale(newLocale: LocaleKey<M>): boolean;
367
+ /** Change the active locale. */
368
+ setLocale(newLocale: LocaleKey<M>): void;
369
369
  /** Check if a key exists in the specified locale or current locale. */
370
370
  hasKey: (key: InferTranslatorKey<M>, targetLocale?: LocaleKey<M>) => boolean;
371
371
  }
package/dist/index.d.ts CHANGED
@@ -364,8 +364,8 @@ declare class BaseTranslator<M extends LocaleNamespaceMessages = never> {
364
364
  setMessages<N extends LocaleNamespaceMessages>(messages: N): void;
365
365
  /** Get the current active locale. */
366
366
  get locale(): LocaleKey<M> | undefined;
367
- /** Change the active locale if available. */
368
- setLocale(newLocale: LocaleKey<M>): boolean;
367
+ /** Change the active locale. */
368
+ setLocale(newLocale: LocaleKey<M>): void;
369
369
  /** Check if a key exists in the specified locale or current locale. */
370
370
  hasKey: (key: InferTranslatorKey<M>, targetLocale?: LocaleKey<M>) => boolean;
371
371
  }
package/dist/index.js CHANGED
@@ -247,13 +247,9 @@ var BaseTranslator = class {
247
247
  get locale() {
248
248
  return this.localeRef.current;
249
249
  }
250
- /** Change the active locale if available. */
250
+ /** Change the active locale. */
251
251
  setLocale(newLocale) {
252
- if (this.messagesRef.current && newLocale in this.messagesRef.current) {
253
- this.localeRef.current = newLocale;
254
- return true;
255
- }
256
- return false;
252
+ this.localeRef.current = newLocale;
257
253
  }
258
254
  };
259
255
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor-translator",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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",