@jsverse/transloco 7.5.1 → 7.6.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.
@@ -0,0 +1,39 @@
1
+ import { Injector, Signal } from '@angular/core';
2
+ import { HashMap, Translation, TranslocoScope } from './types';
3
+ type ScopeType = string | TranslocoScope | TranslocoScope[];
4
+ type SignalKey = Signal<string> | Signal<string[]> | Signal<string>[];
5
+ type TranslateSignalKey = string | string[] | SignalKey;
6
+ type TranslateSignalParams = HashMap | HashMap<Signal<string>> | Signal<HashMap>;
7
+ type TranslateSignalRef<T> = T extends unknown[] | Signal<string[]> ? Signal<string[]> : Signal<string>;
8
+ type TranslateObjectSignalRef<T> = T extends unknown[] | Signal<string[]> ? Signal<Translation[]> : Signal<Translation>;
9
+ /**
10
+ * Gets the translated value of a key as Signal
11
+ *
12
+ * @example
13
+ * text = translateSignal('hello');
14
+ * textList = translateSignal(['green', 'blue']);
15
+ * textVar = translateSignal('hello', { variable: 'world' });
16
+ * textSpanish = translateSignal('hello', { variable: 'world' }, 'es');
17
+ * textTodosScope = translateSignal('hello', { variable: 'world' }, { scope: 'todos' });
18
+ *
19
+ * @example
20
+ * dynamicKey = signal('hello');
21
+ * dynamicParam = signal({ variable: 'world' });
22
+ * text = translateSignal(this.dynamicKey, this.dynamicParam);
23
+ *
24
+ */
25
+ export declare function translateSignal<T extends TranslateSignalKey>(key: T, params?: TranslateSignalParams, lang?: ScopeType, injector?: Injector): TranslateSignalRef<T>;
26
+ /**
27
+ * Gets the translated object of a key as Signal
28
+ *
29
+ * @example
30
+ * object = translateObjectSignal('nested.object');
31
+ * title = object().title;
32
+ *
33
+ * @example
34
+ * dynamicKey = signal('nested.object');
35
+ * dynamicParam = signal({ variable: 'world' });
36
+ * object = translateObjectSignal(this.dynamicKey, this.dynamicParam);
37
+ */
38
+ export declare function translateObjectSignal<T extends TranslateSignalKey>(key: T, params?: TranslateSignalParams, lang?: ScopeType, injector?: Injector): TranslateObjectSignalRef<T>;
39
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsverse/transloco",
3
- "version": "7.5.1",
3
+ "version": "7.6.1",
4
4
  "description": "The internationalization (i18n) library for Angular",
5
5
  "schematics": "./schematics/src/collection.json",
6
6
  "publishConfig": {
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/jsverse/transloco/issues"
11
11
  },
12
- "homepage": "https://jsverse.github.io/transloco/",
12
+ "homepage": "https://jsverse.gitbook.io/transloco/",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "https://github.com/jsverse/transloco"