@tolgee/core 5.2.0-rc.d8d91b51.0 → 5.2.1

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.
@@ -1,6 +1,7 @@
1
1
  import { FallbackGeneral, FallbackLanguageOption, TreeTranslationsData, OnFormatError } from '../../types';
2
2
  import { ObserverOptions, ObserverOptionsInternal } from './observerOptions';
3
3
  export declare const DEFAULT_FORMAT_ERROR = "invalid";
4
+ export declare const DEFAULT_API_URL = "https://app.tolgee.io";
4
5
  export declare type TolgeeStaticData = {
5
6
  [key: string]: TreeTranslationsData | (() => Promise<TreeTranslationsData>);
6
7
  };
@@ -10,7 +11,7 @@ export declare type TolgeeOptionsInternal = {
10
11
  */
11
12
  language?: string;
12
13
  /**
13
- * Tolgee instance url (e.g. https://app.tolgee.io)
14
+ * Tolgee instance url (default: https://app.tolgee.io)
14
15
  */
15
16
  apiUrl?: string;
16
17
  /**
@@ -132,7 +132,9 @@ declare const createTolgee: (options: TolgeeOptions) => Readonly<{
132
132
  apiKey?: string | undefined;
133
133
  projectId?: string | number | undefined;
134
134
  language?: string | undefined;
135
- defaultLanguage?: string | undefined;
135
+ defaultLanguage?: string | undefined; /**
136
+ * Turn off/on events emitting. Is on by default.
137
+ */
136
138
  availableLanguages?: string[] | undefined;
137
139
  fallbackLanguage?: import("./types").FallbackLanguageOption;
138
140
  ns?: string[] | undefined;
@@ -9,7 +9,7 @@ export declare type TranslateParams<T = DefaultParamType> = {
9
9
  [key: string]: T;
10
10
  };
11
11
  export declare type TranslateOptions = {
12
- ns?: NsType;
12
+ ns?: NsType | null;
13
13
  noWrap?: boolean;
14
14
  orEmpty?: boolean;
15
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolgee/core",
3
- "version": "5.2.0-rc.d8d91b51.0",
3
+ "version": "5.2.1",
4
4
  "description": "Library providing ability to translate messages directly in context of developed application.",
5
5
  "main": "./dist/tolgee.cjs.js",
6
6
  "module": "./dist/tolgee.esm.js",
@@ -63,5 +63,5 @@
63
63
  "access": "public"
64
64
  },
65
65
  "sideEffects": false,
66
- "gitHead": "3c25a172269c7726269dae97f46edc0d4f0acab2"
66
+ "gitHead": "10cc8e63d4cf191a569df8fbaf1f6774921321fa"
67
67
  }
@@ -191,12 +191,12 @@ export const Controller = ({ options }: StateServiceProps) => {
191
191
 
192
192
  function getTranslationNs({ key, ns }: KeyAndNamespacesInternal) {
193
193
  const languages = state.getFallbackLangs();
194
- const namespaces = getDefaultAndFallbackNs(ns);
194
+ const namespaces = getDefaultAndFallbackNs(ns || undefined);
195
195
  return cache.getTranslationNs(namespaces, languages, key);
196
196
  }
197
197
 
198
198
  function getTranslation({ key, ns }: KeyAndNamespacesInternal) {
199
- const namespaces = getDefaultAndFallbackNs(ns);
199
+ const namespaces = getDefaultAndFallbackNs(ns || undefined);
200
200
  const languages = state.getFallbackLangs();
201
201
  return cache.getTranslationFallback(namespaces, languages, key);
202
202
  }
@@ -12,6 +12,7 @@ import {
12
12
  } from './observerOptions';
13
13
 
14
14
  export const DEFAULT_FORMAT_ERROR = 'invalid';
15
+ export const DEFAULT_API_URL = 'https://app.tolgee.io';
15
16
 
16
17
  export type TolgeeStaticData = {
17
18
  [key: string]: TreeTranslationsData | (() => Promise<TreeTranslationsData>);
@@ -24,7 +25,7 @@ export type TolgeeOptionsInternal = {
24
25
  language?: string;
25
26
 
26
27
  /**
27
- * Tolgee instance url (e.g. https://app.tolgee.io)
28
+ * Tolgee instance url (default: https://app.tolgee.io)
28
29
  */
29
30
  apiUrl?: string;
30
31
 
@@ -118,6 +119,7 @@ const defaultValues: TolgeeOptionsInternal = {
118
119
  observerOptions: defaultObserverOptions,
119
120
  observerType: 'invisible',
120
121
  onFormatError: DEFAULT_FORMAT_ERROR,
122
+ apiUrl: DEFAULT_API_URL,
121
123
  };
122
124
 
123
125
  export const combineOptions = <T extends TolgeeOptions>(
@@ -17,7 +17,7 @@ export type TranslateParams<T = DefaultParamType> = {
17
17
  };
18
18
 
19
19
  export type TranslateOptions = {
20
- ns?: NsType;
20
+ ns?: NsType | null;
21
21
  noWrap?: boolean;
22
22
  orEmpty?: boolean;
23
23
  };