@pronto-tools-and-more/custom-js-functions 14.26.0 → 14.28.0
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/main.js
CHANGED
@@ -411,6 +411,7 @@
|
|
411
411
|
dateHelper: () => dateHelper,
|
412
412
|
debugId: () => debugId,
|
413
413
|
evaluateCondition: () => evaluateCondition,
|
414
|
+
getLanguage: () => getLanguage,
|
414
415
|
getPrimaryCategoryProperty: () => getPrimaryCategoryProperty,
|
415
416
|
getReadTime: () => getReadTime,
|
416
417
|
handleMenuItems: () => handleMenuItems,
|
@@ -517,6 +518,36 @@
|
|
517
518
|
}
|
518
519
|
};
|
519
520
|
|
521
|
+
// src/parts/GetLanguage/GetLanguage.ts
|
522
|
+
var normalizeLanguage = (language) => {
|
523
|
+
switch (language) {
|
524
|
+
case "de-de":
|
525
|
+
return "de";
|
526
|
+
case "fr-fr":
|
527
|
+
return "fr";
|
528
|
+
case "it-it":
|
529
|
+
return "it";
|
530
|
+
case "es-es":
|
531
|
+
return "es";
|
532
|
+
default:
|
533
|
+
return language;
|
534
|
+
}
|
535
|
+
};
|
536
|
+
var getLanguage = (content) => {
|
537
|
+
if (!content) {
|
538
|
+
return "n/a (no content)";
|
539
|
+
}
|
540
|
+
if (Array.isArray(content)) {
|
541
|
+
return "n/a (content is array)";
|
542
|
+
}
|
543
|
+
const lang = content?.properties?.lang || "";
|
544
|
+
if (!lang) {
|
545
|
+
return "n/a (no language)";
|
546
|
+
}
|
547
|
+
const normalized = normalizeLanguage(lang);
|
548
|
+
return normalized;
|
549
|
+
};
|
550
|
+
|
520
551
|
// src/parts/HandleMenuItems/HandleMenuItems.ts
|
521
552
|
var handleMenuItems = (items, active) => {
|
522
553
|
const index = items.findIndex((item) => item.id === active);
|
package/package.json
CHANGED
@@ -7,6 +7,7 @@ export * from "../FunctionDebugId/FunctionDebugId.ts";
|
|
7
7
|
export * from "../FunctionId/FunctionId.ts";
|
8
8
|
export * from "../FunctionIdOrUndefined/FunctionIdOrUndefined.ts";
|
9
9
|
export * from "../GetCategoryProperty/GetCategoryProperty.ts";
|
10
|
+
export * from "../GetLanguage/GetLanguage.ts";
|
10
11
|
export * from "../HandleMenuItems/HandleMenuItems.ts";
|
11
12
|
export * from "../Parse/Parse.ts";
|
12
13
|
export * from "../ReadTime/ReadTime.ts";
|
@@ -0,0 +1,29 @@
|
|
1
|
+
const normalizeLanguage = (language) => {
|
2
|
+
switch (language) {
|
3
|
+
case "de-de":
|
4
|
+
return "de";
|
5
|
+
case "fr-fr":
|
6
|
+
return "fr";
|
7
|
+
case "it-it":
|
8
|
+
return "it";
|
9
|
+
case "es-es":
|
10
|
+
return "es";
|
11
|
+
default:
|
12
|
+
return language;
|
13
|
+
}
|
14
|
+
};
|
15
|
+
|
16
|
+
export const getLanguage = (content) => {
|
17
|
+
if (!content) {
|
18
|
+
return "n/a (no content)";
|
19
|
+
}
|
20
|
+
if (Array.isArray(content)) {
|
21
|
+
return "n/a (content is array)";
|
22
|
+
}
|
23
|
+
const lang = content?.properties?.lang || "";
|
24
|
+
if (!lang) {
|
25
|
+
return "n/a (no language)";
|
26
|
+
}
|
27
|
+
const normalized = normalizeLanguage(lang);
|
28
|
+
return normalized;
|
29
|
+
};
|