GeezerVison is showing github.com — feat: add createIntl to common.utils, and fix misuse of zh_CN · GrapeGun/lowcode-engine@84e0c1f
File treeExpand file treeCollapse file tree Open diff view settings demo01/expected/demo-project/src demo02/expected/demo-project/src demo03/expected/demo-project/src demo04/expected/demo-project/src demo05/expected/demo-project/src demo06-jsslot/expected/demo-project/src demo07-newline-in-props/expected/demo-project/src demo08-jsslot-with-multiple-children/expected/demo-project/src demo09-jsslot-with-conditional-children/expected/demo-project/src demo10-jsslot-with-loop-children/expected/demo-project/src demo11-utils-name-alias/expected/demo-project/src demo12-refs/expected/demo-project/src demo13-datasource-prop/expected/demo-project/src
demo1/expected/demo-project/src demo2-utils-name-alias/expected/demo-project/src demo2/expected/demo-project/src demo3/expected/demo-project/src demo4/expected/demo-project/src demo5/expected/demo-project/src demo6-literal-condition/expected/demo-project/src demo7-literal-condition2/expected/demo-project/src demo8-datasource-prop/expected/demo-project/src demo9-datasource-engine/expected/demo-project/src demo_10-jsslot/expected/demo-project/src demo_11-jsslot-2/expected/demo-project/src
document/document-model/__snapshots__
editor-skeleton/src/locale plugin-outline-pane/src/locale react-simulator-renderer/test/schema renderer-core/src/renderer
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deploy-space/static/index.html +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 21 | 21 | <script> | 22 | 22 | window.pageConfig = { | 23 | 23 | env: 'release', | 24 | | - locale: 'zh_CN', | | 24 | + locale: 'zh-CN', | 25 | 25 | pageType: 'single', | 26 | 26 | deviceType: 'web', | 27 | 27 | appName: '基础包管理后台', | | 34 | 34 | isSuperAdmin: 'n', | 35 | 35 | isBetaDeveloper: 'n', | 36 | 36 | formType: 'display', | 37 | | - title: { en_US: '测试', type: 'i18n', zh_CN: '测试' }, | | 37 | + title: { 'en-US': 'Test', type: 'i18n', 'zh-CN': '测试' }, | 38 | 38 | urlPrefix: 'https://go.alibaba-inc.com', | 39 | 39 | APIUrlPrefix: 'https://mocks.alibaba-inc.com/mock/lowCodeEngine', | 40 | 40 | devVersion: '0.1.0', // 这个是子应用的变更 id | | 54 | 54 | }, | 55 | 55 | designerConfigs: {}, | 56 | 56 | navConfig: | 57 | | - '{"appName":{"en_US":"基础包管理后台","key":"","type":"i18n","zh_CN":"基础包管理后台"},"bgColor":"white","data":[{"children":[],"hidden":false,"icon":"","inner":true,"navUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","relateUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","slug":"test","targetNew":false,"title":{"en_US":"测试","type":"i18n","zh_CN":"测试"}}],"isFixed":"y","isFold":"y","isFoldHorizontal":"n","languageChangeUrl":{"en_US":"/common/account/changeAccountLanguage.json","type":"i18n","zh_CN":"/common/account/changeAccountLanguage.json"},"layout":"auto","navStyle":"orange","navTheme":"light","openSubMode":false,"showAppTitle":true,"showCrumb":true,"showIcon":false,"showLanguageChange":true,"showNav":true,"showSearch":"n","singletons":{"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V":{"isFixed":"n","isFold":"n","isFoldHorizontal":"n","showAppTitle":false,"showCrumb":false,"showLanguageChange":false,"showNav":false,"showSearch":"n","singleton":false},"test":{"$ref":"$.singletons.FORM\\-3KYJN7RV\\-DIOD8LLK1WGQ89S7NHA92\\-QJVH497K\\-V"}},"type":"top_fold"}', | | 57 | + '{"appName":{"en-US":"基础包管理后台","key":"","type":"i18n","zh-CN":"基础包管理后台"},"bgColor":"white","data":[{"children":[],"hidden":false,"icon":"","inner":true,"navUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","relateUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","slug":"test","targetNew":false,"title":{"en-US":"测试","type":"i18n","zh-CN":"测试"}}],"isFixed":"y","isFold":"y","isFoldHorizontal":"n","languageChangeUrl":{"en-US":"/common/account/changeAccountLanguage.json","type":"i18n","zh-CN":"/common/account/changeAccountLanguage.json"},"layout":"auto","navStyle":"orange","navTheme":"light","openSubMode":false,"showAppTitle":true,"showCrumb":true,"showIcon":false,"showLanguageChange":true,"showNav":true,"showSearch":"n","singletons":{"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V":{"isFixed":"n","isFold":"n","isFoldHorizontal":"n","showAppTitle":false,"showCrumb":false,"showLanguageChange":false,"showNav":false,"showSearch":"n","singleton":false},"test":{"$ref":"$.singletons.FORM\\-3KYJN7RV\\-DIOD8LLK1WGQ89S7NHA92\\-QJVH497K\\-V"}},"type":"top_fold"}', | 58 | 58 | historyType: 'HASH', | 59 | 59 | isSinglePage: 'n', | 60 | 60 | rhino: 'n', | |
Collapse file Copy file name to clipboardExpand all lines: deploy-space/static/preview.html +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 23 | 23 | <script> | 24 | 24 | window.pageConfig = { | 25 | 25 | env: 'release', | 26 | | - locale: 'zh_CN', | | 26 | + locale: 'zh-CN', | 27 | 27 | pageType: 'single', | 28 | 28 | deviceType: 'web', | 29 | 29 | appName: '基础包管理后台', | | 36 | 36 | isSuperAdmin: 'n', | 37 | 37 | isBetaDeveloper: 'n', | 38 | 38 | formType: 'display', | 39 | | - title: { en_US: '测试', type: 'i18n', zh_CN: '测试' }, | | 39 | + title: { 'en-US': 'Test', type: 'i18n', 'zh-CN': '测试' }, | 40 | 40 | urlPrefix: 'https://go.alibaba-inc.com', | 41 | 41 | APIUrlPrefix: 'https://mocks.alibaba-inc.com/mock/lowCodeEngine', | 42 | 42 | devVersion: '0.1.0', // 这个是子应用的变更 id | | 56 | 56 | }, | 57 | 57 | designerConfigs: {}, | 58 | 58 | navConfig: | 59 | | - '{"appName":{"en_US":"基础包管理后台","key":"","type":"i18n","zh_CN":"基础包管理后台"},"bgColor":"white","data":[{"children":[],"hidden":false,"icon":"","inner":true,"navUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","relateUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","slug":"test","targetNew":false,"title":{"en_US":"测试","type":"i18n","zh_CN":"测试"}}],"isFixed":"y","isFold":"y","isFoldHorizontal":"n","languageChangeUrl":{"en_US":"/common/account/changeAccountLanguage.json","type":"i18n","zh_CN":"/common/account/changeAccountLanguage.json"},"layout":"auto","navStyle":"orange","navTheme":"light","openSubMode":false,"showAppTitle":true,"showCrumb":true,"showIcon":false,"showLanguageChange":true,"showNav":true,"showSearch":"n","singletons":{"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V":{"isFixed":"n","isFold":"n","isFoldHorizontal":"n","showAppTitle":false,"showCrumb":false,"showLanguageChange":false,"showNav":false,"showSearch":"n","singleton":false},"test":{"$ref":"$.singletons.FORM\\-3KYJN7RV\\-DIOD8LLK1WGQ89S7NHA92\\-QJVH497K\\-V"}},"type":"top_fold"}', | | 59 | + '{"appName":{"en-US":"基础包管理后台","key":"","type":"i18n","zh-CN":"基础包管理后台"},"bgColor":"white","data":[{"children":[],"hidden":false,"icon":"","inner":true,"navUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","relateUuid":"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V","slug":"test","targetNew":false,"title":{"en-US":"测试","type":"i18n","zh-CN":"测试"}}],"isFixed":"y","isFold":"y","isFoldHorizontal":"n","languageChangeUrl":{"en-US":"/common/account/changeAccountLanguage.json","type":"i18n","zh-CN":"/common/account/changeAccountLanguage.json"},"layout":"auto","navStyle":"orange","navTheme":"light","openSubMode":false,"showAppTitle":true,"showCrumb":true,"showIcon":false,"showLanguageChange":true,"showNav":true,"showSearch":"n","singletons":{"FORM-3KYJN7RV-DIOD8LLK1WGQ89S7NHA92-QJVH497K-V":{"isFixed":"n","isFold":"n","isFoldHorizontal":"n","showAppTitle":false,"showCrumb":false,"showLanguageChange":false,"showNav":false,"showSearch":"n","singleton":false},"test":{"$ref":"$.singletons.FORM\\-3KYJN7RV\\-DIOD8LLK1WGQ89S7NHA92\\-QJVH497K\\-V"}},"type":"top_fold"}', | 60 | 60 | historyType: 'HASH', | 61 | 61 | isSinglePage: 'n', | 62 | 62 | rhino: 'n', | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/src/plugins/project/i18n.ts +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,13 +34,13 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => { | 34 | 34 | }; | 35 | 35 |
| 36 | 36 | const isEmptyVariables = variables => ( | 37 | | - Array.isArray(variables) && variables.length === 0 | | 37 | + Array.isArray(variables) && variables.length === 0 | 38 | 38 | || typeof variables === 'object' && (!variables || Object.keys(variables).length === 0) | 39 | 39 | ); | 40 | 40 |
| 41 | 41 | // 按低代码规范里面的要求进行变量替换 | 42 | 42 | const format = (msg, variables) => ( | 43 | | - typeof msg === 'string' | | 43 | + typeof msg === 'string' | 44 | 44 | ? msg.replace(/\\\$\\{(\\w+)\\}/g, (match, key) => variables?.[key] ?? '') | 45 | 45 | : msg | 46 | 46 | ); | @@ -69,7 +69,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => { | 69 | 69 | }; | 70 | 70 | target._i18nText = (t) => { | 71 | 71 | // 优先取直接传过来的语料 | 72 | | - const localMsg = t[locale] ?? t[String(locale).replace('-', '_')] | | 72 | + const localMsg = t[locale] ?? t[String(locale).replace('-', '_')] | 73 | 73 | if (localMsg != null) { | 74 | 74 | return format(localMsg, t.params); | 75 | 75 | } | @@ -81,7 +81,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => { | 81 | 81 | } | 82 | 82 |
| 83 | 83 | // 兜底用 use 指定的或默认语言的 | 84 | | - return format(t[t.use || "zh_CN"] ?? t.en_US, t.params); | | 84 | + return format(t[t.use || "zh-CN"] ?? t.en_US, t.params); | 85 | 85 | } | 86 | 86 |
| 87 | 87 | // 注入到上下文中去 | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/bugfix/i18n-with-params.schema.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 42 | 42 | } | 43 | 43 | ], | 44 | 44 | "i18n": { | 45 | | - "zh_CN": { | | 45 | + "zh-CN": { | 46 | 46 | "greetings.hello": "${name}, 你好!" | 47 | 47 | }, | 48 | | - "en_US": { | | 48 | + "en-US": { | 49 | 49 | "greetings.hello": "Hello, ${name}!" | 50 | 50 | } | 51 | 51 | } | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/bugfix/tolerate-eval-errors-1-loop.schema.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 48 | 48 | } | 49 | 49 | ], | 50 | 50 | "i18n": { | 51 | | - "zh_CN": { | | 51 | + "zh-CN": { | 52 | 52 | "greetings.hello": "${name}, 你好!" | 53 | 53 | }, | 54 | | - "en_US": { | | 54 | + "en-US": { | 55 | 55 | "greetings.hello": "Hello, ${name}!" | 56 | 56 | } | 57 | 57 | } | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/bugfix/tolerate-eval-errors-2-nested-loop.schema.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 60 | 60 | } | 61 | 61 | ], | 62 | 62 | "i18n": { | 63 | | - "zh_CN": { | | 63 | + "zh-CN": { | 64 | 64 | "greetings.hello": "${name}, 你好!" | 65 | 65 | }, | 66 | | - "en_US": { | | 66 | + "en-US": { | 67 | 67 | "greetings.hello": "Hello, ${name}!" | 68 | 68 | } | 69 | 69 | } | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/fixtures/test-cases/rax-app/demo01/expected/demo-project/src/i18n.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,7 +52,7 @@ const _inject2 = (target) => { | 52 | 52 | } | 53 | 53 |
| 54 | 54 | // 兜底用 use 指定的或默认语言的 | 55 | | - return format(t[t.use || 'zh_CN'] ?? t.en_US, t.params); | | 55 | + return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params); | 56 | 56 | }; | 57 | 57 |
| 58 | 58 | // 注入到上下文中去 | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/fixtures/test-cases/rax-app/demo02/expected/demo-project/src/i18n.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,7 +52,7 @@ const _inject2 = (target) => { | 52 | 52 | } | 53 | 53 |
| 54 | 54 | // 兜底用 use 指定的或默认语言的 | 55 | | - return format(t[t.use || 'zh_CN'] ?? t.en_US, t.params); | | 55 | + return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params); | 56 | 56 | }; | 57 | 57 |
| 58 | 58 | // 注入到上下文中去 | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/fixtures/test-cases/rax-app/demo03/expected/demo-project/src/i18n.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,7 +52,7 @@ const _inject2 = (target) => { | 52 | 52 | } | 53 | 53 |
| 54 | 54 | // 兜底用 use 指定的或默认语言的 | 55 | | - return format(t[t.use || 'zh_CN'] ?? t.en_US, t.params); | | 55 | + return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params); | 56 | 56 | }; | 57 | 57 |
| 58 | 58 | // 注入到上下文中去 | |
Collapse file Copy file name to clipboardExpand all lines: modules/code-generator/tests/fixtures/test-cases/rax-app/demo04/expected/demo-project/src/i18n.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,7 +52,7 @@ const _inject2 = (target) => { | 52 | 52 | } | 53 | 53 |
| 54 | 54 | // 兜底用 use 指定的或默认语言的 | 55 | | - return format(t[t.use || 'zh_CN'] ?? t.en_US, t.params); | | 55 | + return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params); | 56 | 56 | }; | 57 | 57 |
| 58 | 58 | // 注入到上下文中去 | |
|