@tstdl/base 0.85.10 → 0.85.11
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/package.json
CHANGED
|
@@ -33,12 +33,16 @@ var import_rxjs = require("rxjs");
|
|
|
33
33
|
var import_container = require("../container/index.js");
|
|
34
34
|
var import_api = require("../signals/api.js");
|
|
35
35
|
var import_switch_map = require("../signals/switch-map.js");
|
|
36
|
+
var import_type_guards = require("../utils/type-guards.js");
|
|
36
37
|
var import_localization_service = require("./localization.service.js");
|
|
37
38
|
const missingLocalizationKeyText = "[MISSING LOCALIZATION KEY]";
|
|
38
39
|
function resolveDynamicText(text, localizationService) {
|
|
39
40
|
const resolvedLocalizationService = localizationService ?? import_container.container.resolve(import_localization_service.LocalizationService);
|
|
40
|
-
const
|
|
41
|
-
return (0, import_switch_map.switchMap)(() =>
|
|
41
|
+
const localizableTextSignal = (0, import_api.isSignal)(text) ? text : (0, import_rxjs.isObservable)(text) ? (0, import_api.toSignal)(text, { initialValue: missingLocalizationKeyText }) : (0, import_api.computed)(() => text);
|
|
42
|
+
return (0, import_switch_map.switchMap)(() => {
|
|
43
|
+
const localizableText = localizableTextSignal();
|
|
44
|
+
return (0, import_type_guards.isString)(localizableText) ? (0, import_api.computed)(() => localizableText) : resolvedLocalizationService.localize(localizableText);
|
|
45
|
+
});
|
|
42
46
|
}
|
|
43
47
|
function resolveDynamicText$(text, localizationService) {
|
|
44
48
|
return (0, import_api.toObservable)(resolveDynamicText(text, localizationService));
|