@geekron/strapi 0.2.11 → 0.2.12
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/i18n/index.js +3 -3
- package/dist/i18n/index.mjs +3 -3
- package/i18n/translations/index.ts +7 -7
- package/package.json +1 -1
package/dist/i18n/index.js
CHANGED
|
@@ -40,8 +40,8 @@ var addPrefix = (translations, prefix) => {
|
|
|
40
40
|
return acc;
|
|
41
41
|
}, {});
|
|
42
42
|
};
|
|
43
|
-
var
|
|
44
|
-
return modulePath.
|
|
43
|
+
var isInPrefixDir = (modulePath) => {
|
|
44
|
+
return modulePath.includes("/prefix/") || modulePath.includes("\\prefix\\");
|
|
45
45
|
};
|
|
46
46
|
var extractFileName = (modulePath) => {
|
|
47
47
|
const match = modulePath.match(/\/([^/]+)\.json$/);
|
|
@@ -58,7 +58,7 @@ var processLocaleModules = (modules, locale, basePath = ".") => {
|
|
|
58
58
|
return acc;
|
|
59
59
|
}
|
|
60
60
|
const translation = modules[modulePath];
|
|
61
|
-
if (
|
|
61
|
+
if (isInPrefixDir(modulePath)) {
|
|
62
62
|
return {
|
|
63
63
|
...acc,
|
|
64
64
|
...addPrefix(translation, fileName)
|
package/dist/i18n/index.mjs
CHANGED
|
@@ -5,8 +5,8 @@ var addPrefix = (translations, prefix) => {
|
|
|
5
5
|
return acc;
|
|
6
6
|
}, {});
|
|
7
7
|
};
|
|
8
|
-
var
|
|
9
|
-
return modulePath.
|
|
8
|
+
var isInPrefixDir = (modulePath) => {
|
|
9
|
+
return modulePath.includes("/prefix/") || modulePath.includes("\\prefix\\");
|
|
10
10
|
};
|
|
11
11
|
var extractFileName = (modulePath) => {
|
|
12
12
|
const match = modulePath.match(/\/([^/]+)\.json$/);
|
|
@@ -23,7 +23,7 @@ var processLocaleModules = (modules, locale, basePath = ".") => {
|
|
|
23
23
|
return acc;
|
|
24
24
|
}
|
|
25
25
|
const translation = modules[modulePath];
|
|
26
|
-
if (
|
|
26
|
+
if (isInPrefixDir(modulePath)) {
|
|
27
27
|
return {
|
|
28
28
|
...acc,
|
|
29
29
|
...addPrefix(translation, fileName)
|
|
@@ -12,13 +12,13 @@ const addPrefix = (translations: Record<string, any>, prefix: string): Record<st
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 判断文件是否在 prefix 目录中(需要添加前缀)
|
|
16
16
|
* @param modulePath - 模块路径
|
|
17
|
-
* @
|
|
18
|
-
* @returns 是否为子目录文件
|
|
17
|
+
* @returns 是否在 prefix 目录中
|
|
19
18
|
*/
|
|
20
|
-
const
|
|
21
|
-
|
|
19
|
+
const isInPrefixDir = (modulePath: string): boolean => {
|
|
20
|
+
// 检查路径中是否包含 /prefix/ 子串
|
|
21
|
+
return modulePath.includes('/prefix/') || modulePath.includes('\\prefix\\');
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -58,8 +58,8 @@ const processLocaleModules = (
|
|
|
58
58
|
|
|
59
59
|
const translation = modules[modulePath] as Record<string, any>;
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
if (
|
|
61
|
+
// 判断是否在 prefix 目录中,prefix 目录中的文件添加文件名作为前缀
|
|
62
|
+
if (isInPrefixDir(modulePath)) {
|
|
63
63
|
return {
|
|
64
64
|
...acc,
|
|
65
65
|
...addPrefix(translation, fileName)
|