bfg-common 1.3.580 → 1.3.582
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,22 +1,32 @@
|
|
|
1
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
|
|
3
|
-
export function productNameLocal(
|
|
4
|
-
localization: UI_I_Localization
|
|
5
|
-
): UI_I_Localization {
|
|
6
|
-
const config = useRuntimeConfig()
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export function productNameLocal(
|
|
4
|
+
localization: UI_I_Localization
|
|
5
|
+
): UI_I_Localization {
|
|
6
|
+
const config = useRuntimeConfig()
|
|
7
|
+
|
|
8
|
+
const productName =
|
|
9
|
+
config.public.LOCALIZATION_CODE === 'ru'
|
|
10
|
+
? config.public.PRODUCT_NAME_RU
|
|
11
|
+
: config.public.PRODUCT_NAME_EN
|
|
12
|
+
|
|
13
|
+
return replaceProductNameRecursion(localization, productName)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const replaceProductNameRecursion = (
|
|
17
|
+
obj: UI_I_Localization,
|
|
18
|
+
productName: any
|
|
19
|
+
): UI_I_Localization => {
|
|
20
|
+
for (const key of Object.keys(obj)) {
|
|
21
|
+
if (typeof obj[key] === 'string') {
|
|
22
|
+
obj[key] = (obj[key] as string).replaceAll('{productName}', productName)
|
|
23
|
+
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
24
|
+
obj[key] = replaceProductNameRecursion(
|
|
25
|
+
obj[key] as UI_I_Localization,
|
|
26
|
+
productName
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return obj
|
|
32
|
+
}
|
package/lib/models/interfaces.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UI_T_NotificationStatus } from '~/components/atoms/alert/lib/models/types'
|
|
1
|
+
import type { UI_T_NotificationStatus } from '~/components/atoms/alert/lib/models/types'
|
|
2
2
|
import { UI_E_State } from '~/lib/models/enums'
|
|
3
3
|
|
|
4
4
|
export interface UI_I_ItemView {
|
|
@@ -13,8 +13,9 @@ export interface UI_I_ArbitraryObject<T> {
|
|
|
13
13
|
[key: string]: T
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export interface UI_I_Localization extends UI_I_ArbitraryObject<string
|
|
17
|
-
|
|
16
|
+
export interface UI_I_Localization extends UI_I_ArbitraryObject<string | UI_I_ArbitraryObject<string>> {
|
|
17
|
+
auth: UI_I_ArbitraryObject<string>
|
|
18
|
+
}
|
|
18
19
|
export interface UI_I_SendTaskParams {
|
|
19
20
|
method: string
|
|
20
21
|
target: string
|