From 1322cf72a789e64137c3dcf76a408ae2c99890c5 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Wed, 2 Apr 2025 14:03:41 +0800 Subject: [PATCH] init --- package.json | 8 +- pnpm-lock.yaml | 137 +++++++++++++++++++++++++++++ public/locales/en/translation.json | 100 +++++++++++++++++++++ public/locales/zh/translation.json | 100 +++++++++++++++++++++ script/merge-lng.ts | 40 +++++++++ src/data/center/en.json | 88 ++++++++++++++++++ src/data/center/zh.json | 88 ++++++++++++++++++ src/data/draw/en.json | 14 +++ src/data/draw/zh.json | 14 +++ 9 files changed, 585 insertions(+), 4 deletions(-) create mode 100644 public/locales/en/translation.json create mode 100644 public/locales/zh/translation.json create mode 100644 script/merge-lng.ts create mode 100644 src/data/center/en.json create mode 100644 src/data/center/zh.json create mode 100644 src/data/draw/en.json create mode 100644 src/data/draw/zh.json diff --git a/package.json b/package.json index b11320f..0d89477 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,15 @@ { - "name": "vite-react", + "name": "@kevisual/locales", "private": true, "version": "0.0.1", "type": "module", - "basename": "/", + "basename": "/root/locales", "scripts": { "dev": "vite", "build": "vite build", "lint": "eslint .", "preview": "vite preview", - "pub": "envision deploy ./dist -k vite-react -v 0.0.1", - "ev": "npm run build && npm run deploy", + "pub": "envision deploy ./dist -k locales -v 0.0.1 -o root -u", "dev:lib": "turbo dev" }, "author": "abearxiong ", @@ -35,6 +34,7 @@ "@types/react": "^19.0.12", "@types/react-dom": "^19.0.4", "@vitejs/plugin-react": "^4.3.4", + "fast-glob": "^3.3.3", "tailwindcss": "^4.0.16", "typescript": "^5.8.2", "vite": "^6.2.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 47f8705..9858b0a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,6 +60,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.3.4 version: 4.3.4(vite@6.2.3(@types/node@22.13.13)(jiti@2.4.2)(lightningcss@1.29.2)(yaml@2.5.1)) + fast-glob: + specifier: ^3.3.3 + version: 3.3.3 tailwindcss: specifier: ^4.0.16 version: 4.0.16 @@ -349,6 +352,18 @@ packages: '@kevisual/types@0.0.6': resolution: {integrity: sha512-7yxe1QmuC5g7lI/1Hm+zXly8if0z+ZqGM1SVOVv2VNRwRAVYBJDc365zWCCfRwE+5YaB2daWTe5zBOU4EkltkQ==} + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + '@rollup/rollup-android-arm-eabi@4.34.8': resolution: {integrity: sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==} cpu: [arm] @@ -574,6 +589,10 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + browserslist@4.24.2: resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -660,6 +679,17 @@ packages: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} + + fastq@1.19.1: + resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + form-data-encoder@1.7.2: resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==} @@ -691,6 +721,10 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -720,6 +754,18 @@ packages: immer@10.1.1: resolution: {integrity: sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==} + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + jiti@2.4.2: resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} hasBin: true @@ -816,6 +862,14 @@ packages: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} @@ -879,10 +933,17 @@ packages: picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + postcss@8.5.3: resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + react-dom@19.0.0: resolution: {integrity: sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==} peerDependencies: @@ -902,11 +963,18 @@ packages: resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} engines: {node: '>=0.10.0'} + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rollup@4.34.8: resolution: {integrity: sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + scheduler@0.25.0: resolution: {integrity: sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==} @@ -933,6 +1001,10 @@ packages: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -1288,6 +1360,18 @@ snapshots: '@kevisual/types@0.0.6': {} + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.19.1 + '@rollup/rollup-android-arm-eabi@4.34.8': optional: true @@ -1475,6 +1559,10 @@ snapshots: asynckit@0.4.0: {} + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + browserslist@4.24.2: dependencies: caniuse-lite: 1.0.30001684 @@ -1569,6 +1657,22 @@ snapshots: event-target-shim@5.0.1: {} + fast-glob@3.3.3: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fastq@1.19.1: + dependencies: + reusify: 1.1.0 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + form-data-encoder@1.7.2: {} form-data@4.0.2: @@ -1608,6 +1712,10 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.1 + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + globals@11.12.0: {} gopd@1.2.0: {} @@ -1631,6 +1739,14 @@ snapshots: immer@10.1.1: optional: true + is-extglob@2.1.1: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-number@7.0.0: {} + jiti@2.4.2: {} js-tokens@4.0.0: {} @@ -1696,6 +1812,13 @@ snapshots: math-intrinsics@1.1.0: {} + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + mime-db@1.52.0: {} mime-types@2.1.35: @@ -1738,12 +1861,16 @@ snapshots: picocolors@1.1.1: {} + picomatch@2.3.1: {} + postcss@8.5.3: dependencies: nanoid: 3.3.8 picocolors: 1.1.1 source-map-js: 1.2.1 + queue-microtask@1.2.3: {} + react-dom@19.0.0(react@19.0.0): dependencies: react: 19.0.0 @@ -1759,6 +1886,8 @@ snapshots: react@19.0.0: {} + reusify@1.1.0: {} + rollup@4.34.8: dependencies: '@types/estree': 1.0.6 @@ -1784,6 +1913,10 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.34.8 fsevents: 2.3.3 + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + scheduler@0.25.0: {} selfsigned@2.4.1: @@ -1801,6 +1934,10 @@ snapshots: to-fast-properties@2.0.0: {} + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + tr46@0.0.3: {} typescript@5.8.2: {} diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json new file mode 100644 index 0000000..aed6b6d --- /dev/null +++ b/public/locales/en/translation.json @@ -0,0 +1,100 @@ +{ + "markType": "Type", + "summary": "Summary", + "tags": "Tags", + "description": "Description", + "link": "Link", + "createdAt": "Created At", + "updatedAt": "Updated At", + "title": "Title", + "thumbnail": "Thumbnail", + "save": "Save", + "editMarkSuccess": "Edit Mark Success", + "deleteMarkSuccess": "Delete Mark Success", + "container": "Container", + "currentTime": "Current time: {{time, YYYY-MM-DD}}", + "Your profile": "Your profile", + "Your orgs": "Your orgs", + "Site Map": "Site Map", + "User": "User", + "Login Out": "Login Out", + "Switch Org": "Switch Org", + "Save": "Save", + "Profile": "Profile", + "Edit your profile": "Edit your profile", + "Name": "Name", + "Email": "Email", + "Phone": "Phone", + "Description": "Description", + "Avatar": "Avatar", + "Avatar Upload": "Avatar Upload", + "Edit": "Edit", + "Add": "Add", + "Delete": "Delete", + "Cancel": "Cancel", + "Confirm": "Confirm", + "Add Org": "Add Org", + "Home": "Home", + "User App": "User App", + "File App": "File App", + "Org": "Org", + "About": "About", + "Contact": "Contact", + "Terms": "Terms", + "Privacy": "Privacy", + "Language": "Language", + "Theme": "Theme", + "Dark": "Dark", + "Light": "Light", + "Container": "Container", + "Submit": "Submit", + "Username": "Username", + "Back": "Back", + "User List": "User List", + "Switch to Org": "Switch to Org", + "Login": "Login", + "uploadDirectory": "Upload Directory", + "refresh": "Refresh", + "upload": "Upload", + "app": { + "domain": "Domain", + "version": "Version", + "runtime": "Can run environment", + "share": "Share Config" + }, + "Share": "Share", + "Switch To User": "Switch To User", + "Language changed to": "Language changed to", + "en": "English", + "zh": "Chinese", + "Config": "Config", + "Tags": "Tags", + "Add a tag": "Add a tag", + "Tags Input": "Tags Input", + "Public": "Public", + "Protected": "Protected", + "Private": "Private", + "Input User Name": "Input User Name", + "Select Date": "Select Date", + "Permission": "Permission Manager", + "password": "Password", + "expiration-time": "Expiration Time", + "usernames": "Usernames", + "content-type": "Content Type", + "app-source": "App Source", + "app-version": "App Version", + "Detect": "Detect", + "Detect Config Tips": "From the json configuration data of the uploaded [config/1.0.0] path.", + "Upload Config": "Upload Config", + "Upload Config Tips": "Upload the configuration to the default configuration of the [upload/1.0.0] path, and open the configuration item.", + "Workspace Config": "Workspace Config", + "Workspace Config Tips": "Set the default workspace, when there is no specific space to open, the default workspace will be opened. The collection information module, the position of the added resource, will be placed here by default. For example, the WeChat public account's essay.", + "Add Config Tips": "Add configuration, when the key exists, the data update of the key will be queried first, if the key does not exist, the new configuration will be added.", + "VIP Config": "VIP Config", + "VIP Config Tips": "VIP Config, only the admin can configure.", + "directory_name_required": "Directory name is required", + "delete_directory": "Delete Directory", + "delete_directory_success": "Delete directory success", + "create_directory": "Create Directory", + "create_directory_success": "Create directory success" +} \ No newline at end of file diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json new file mode 100644 index 0000000..5cf05ae --- /dev/null +++ b/public/locales/zh/translation.json @@ -0,0 +1,100 @@ +{ + "markType": "类型", + "summary": "摘要", + "tags": "标签", + "description": "描述", + "link": "链接", + "createdAt": "创建时间", + "updatedAt": "更新时间", + "title": "标题", + "thumbnail": "缩略图", + "save": "保存", + "editMarkSuccess": "编辑成功", + "deleteMarkSuccess": "删除成功", + "container": "容器", + "currentTime": "当前时间: {{time, YYYY-MM-DD}}", + "Your profile": "你的个人资料", + "Your orgs": "你的组织", + "Site Map": "站点地图", + "User": "用户", + "Login Out": "退出登录", + "Switch Org": "切换组织", + "Save": "保存", + "Profile": "个人资料", + "Edit your profile": "编辑你的个人资料", + "Name": "姓名", + "Email": "邮箱", + "Phone": "电话", + "Description": "描述", + "Avatar": "头像", + "Avatar Upload": "头像上传", + "Edit": "编辑", + "Add": "添加", + "Delete": "删除", + "Cancel": "取消", + "Confirm": "确认", + "Add Org": "添加组织", + "Home": "首页", + "User App": "用户应用", + "File App": "文件应用", + "Org": "组织", + "About": "关于", + "Contact": "联系", + "Terms": "条款", + "Privacy": "隐私", + "Language": "语言", + "Theme": "主题", + "Dark": "暗黑", + "Light": "明亮", + "Container": "容器", + "Submit": "提交", + "Username": "用户名", + "Back": "返回", + "User List": "用户列表", + "Switch to Org": "切换组织", + "Login": "登录", + "uploadDirectory": "上传文件夹", + "refresh": "刷新", + "upload": "上传", + "app": { + "domain": "访问域名", + "version": "版本", + "runtime": "可以运行的环境", + "share": "共享配置" + }, + "Share": "分享", + "Switch To User": "切换到用户", + "Language changed to": "语言已切换到", + "en": "英语", + "zh": "中文", + "Config": "配置", + "Tags": "标签", + "Add a tag": "添加一个标签", + "Tags Input": "标签输入", + "Public": "公开", + "Protected": "受保护", + "Private": "私有", + "Input User Name": "输入用户名称", + "Select Date": "选择日期", + "Permission": "权限管理", + "password": "密码", + "expiration-time": "过期时间", + "usernames": "用户名", + "content-type": "内容类型", + "app-source": "应用来源", + "app-version": "应用版本", + "Detect": "检测", + "Detect Config Tips": "从上传的 [config/1.0.0] 路径的的json的配置的数据同步过来。", + "Upload Config": "上传配置", + "Upload Config Tips": "上传配置到 [upload/1.0.0] 路径的默认配置,打开配置项。", + "Workspace Config": "工作空间配置", + "Workspace Config Tips": "设置默认的工作空间,当没有打开具体的空间的时候,默认打开的工作空间。收集信息的模块,添加的资源的位置,默认放到这里。比如,微信公众号的随笔。", + "Add Config Tips": "添加配置,当key存在的时候,会优先查询key数据的更新,如果key不存在,则新增配置。", + "VIP Config": "VIP配置", + "VIP Config Tips": "VIP配置,只有管理员才能配置。", + "directory_name_required": "目录名称是必须的", + "delete_directory": "删除目录", + "delete_directory_success": "删除目录成功", + "create_directory": "创建目录", + "create_directory_success": "创建目录成功" +} \ No newline at end of file diff --git a/script/merge-lng.ts b/script/merge-lng.ts new file mode 100644 index 0000000..c081866 --- /dev/null +++ b/script/merge-lng.ts @@ -0,0 +1,40 @@ +import glob from 'fast-glob'; +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const files = await glob('src/data/**/*.json'); + +console.log(files); +// 过滤en.json +const enFiles = files.filter((file) => file.includes('en.json')); +const zhFiles = files.filter((file) => file.includes('zh.json')); + +// console.log(enFiles); +export const readFiles = (files: string[]) => { + const data = files.map((file) => { + const content = fs.readFileSync(file, 'utf-8'); + return JSON.parse(content); + }); + return data; +}; + +export const mergeFiles = (files: string[]) => { + const data = readFiles(files); + return data.reduce((acc, curr) => { + return { ...acc, ...curr }; + }, {}); +}; + +const enData = mergeFiles(enFiles); +const zhData = mergeFiles(zhFiles); + +// console.log(enData); +// console.log(zhData); +const outputZhFile = '../public/locales/zh/translation.json'; +const outputEnFile = '../public/locales/en/translation.json'; + +fs.writeFileSync(path.resolve(__dirname, outputZhFile), JSON.stringify(zhData, null, 2)); +fs.writeFileSync(path.resolve(__dirname, outputEnFile), JSON.stringify(enData, null, 2)); diff --git a/src/data/center/en.json b/src/data/center/en.json new file mode 100644 index 0000000..97b570e --- /dev/null +++ b/src/data/center/en.json @@ -0,0 +1,88 @@ +{ + "container": "Container", + "currentTime": "Current time: {{time, YYYY-MM-DD}}", + "Your profile": "Your profile", + "Your orgs": "Your orgs", + "Site Map": "Site Map", + "User": "User", + "Login Out": "Login Out", + "Switch Org": "Switch Org", + "Save": "Save", + "Profile": "Profile", + "Edit your profile": "Edit your profile", + "Name": "Name", + "Email": "Email", + "Phone": "Phone", + "Description": "Description", + "Avatar": "Avatar", + "Avatar Upload": "Avatar Upload", + "Edit": "Edit", + "Add": "Add", + "Delete": "Delete", + "Cancel": "Cancel", + "Confirm": "Confirm", + "Add Org": "Add Org", + "Home": "Home", + "User App": "User App", + "File App": "File App", + "Org": "Org", + "About": "About", + "Contact": "Contact", + "Terms": "Terms", + "Privacy": "Privacy", + "Language": "Language", + "Theme": "Theme", + "Dark": "Dark", + "Light": "Light", + "Container": "Container", + "Submit": "Submit", + "Username": "Username", + "Back": "Back", + "User List": "User List", + "Switch to Org": "Switch to Org", + "Login": "Login", + "uploadDirectory": "Upload Directory", + "refresh": "Refresh", + "upload": "Upload", + "app": { + "domain": "Domain", + "version": "Version", + "runtime": "Can run environment", + "share": "Share Config" + }, + "Share": "Share", + "Switch To User": "Switch To User", + "Language changed to": "Language changed to", + "en": "English", + "zh": "Chinese", + "Config": "Config", + "Tags": "Tags", + "Add a tag": "Add a tag", + "Tags Input": "Tags Input", + "Public": "Public", + "Protected": "Protected", + "Private": "Private", + "Input User Name": "Input User Name", + "Select Date": "Select Date", + "Permission": "Permission Manager", + "password": "Password", + "expiration-time": "Expiration Time", + "usernames": "Usernames", + "content-type": "Content Type", + "app-source": "App Source", + "app-version": "App Version", + "Detect": "Detect", + "Detect Config Tips": "From the json configuration data of the uploaded [config/1.0.0] path.", + "Upload Config": "Upload Config", + "Upload Config Tips": "Upload the configuration to the default configuration of the [upload/1.0.0] path, and open the configuration item.", + "Workspace Config": "Workspace Config", + "Workspace Config Tips": "Set the default workspace, when there is no specific space to open, the default workspace will be opened. The collection information module, the position of the added resource, will be placed here by default. For example, the WeChat public account's essay.", + "Add Config Tips": "Add configuration, when the key exists, the data update of the key will be queried first, if the key does not exist, the new configuration will be added.", + "VIP Config": "VIP Config", + "VIP Config Tips": "VIP Config, only the admin can configure.", + "directory_name_required": "Directory name is required", + "delete_directory": "Delete Directory", + "delete_directory_success": "Delete directory success", + "create_directory": "Create Directory", + "create_directory_success": "Create directory success" +} \ No newline at end of file diff --git a/src/data/center/zh.json b/src/data/center/zh.json new file mode 100644 index 0000000..b0c1a65 --- /dev/null +++ b/src/data/center/zh.json @@ -0,0 +1,88 @@ +{ + "container": "容器", + "currentTime": "当前时间: {{time, YYYY-MM-DD}}", + "Your profile": "你的个人资料", + "Your orgs": "你的组织", + "Site Map": "站点地图", + "User": "用户", + "Login Out": "退出登录", + "Switch Org": "切换组织", + "Save": "保存", + "Profile": "个人资料", + "Edit your profile": "编辑你的个人资料", + "Name": "姓名", + "Email": "邮箱", + "Phone": "电话", + "Description": "描述", + "Avatar": "头像", + "Avatar Upload": "头像上传", + "Edit": "编辑", + "Add": "添加", + "Delete": "删除", + "Cancel": "取消", + "Confirm": "确认", + "Add Org": "添加组织", + "Home": "首页", + "User App": "用户应用", + "File App": "文件应用", + "Org": "组织", + "About": "关于", + "Contact": "联系", + "Terms": "条款", + "Privacy": "隐私", + "Language": "语言", + "Theme": "主题", + "Dark": "暗黑", + "Light": "明亮", + "Container": "容器", + "Submit": "提交", + "Username": "用户名", + "Back": "返回", + "User List": "用户列表", + "Switch to Org": "切换组织", + "Login": "登录", + "uploadDirectory": "上传文件夹", + "refresh": "刷新", + "upload": "上传", + "app": { + "domain": "访问域名", + "version": "版本", + "runtime": "可以运行的环境", + "share": "共享配置" + }, + "Share": "分享", + "Switch To User": "切换到用户", + "Language changed to": "语言已切换到", + "en": "英语", + "zh": "中文", + "Config": "配置", + "Tags": "标签", + "Add a tag": "添加一个标签", + "Tags Input": "标签输入", + "Public": "公开", + "Protected": "受保护", + "Private": "私有", + "Input User Name": "输入用户名称", + "Select Date": "选择日期", + "Permission": "权限管理", + "password": "密码", + "expiration-time": "过期时间", + "usernames": "用户名", + "content-type": "内容类型", + "app-source": "应用来源", + "app-version": "应用版本", + "Detect": "检测", + "Detect Config Tips": "从上传的 [config/1.0.0] 路径的的json的配置的数据同步过来。", + "Upload Config": "上传配置", + "Upload Config Tips": "上传配置到 [upload/1.0.0] 路径的默认配置,打开配置项。", + "Workspace Config": "工作空间配置", + "Workspace Config Tips": "设置默认的工作空间,当没有打开具体的空间的时候,默认打开的工作空间。收集信息的模块,添加的资源的位置,默认放到这里。比如,微信公众号的随笔。", + "Add Config Tips": "添加配置,当key存在的时候,会优先查询key数据的更新,如果key不存在,则新增配置。", + "VIP Config": "VIP配置", + "VIP Config Tips": "VIP配置,只有管理员才能配置。", + "directory_name_required": "目录名称是必须的", + "delete_directory": "删除目录", + "delete_directory_success": "删除目录成功", + "create_directory": "创建目录", + "create_directory_success": "创建目录成功" +} \ No newline at end of file diff --git a/src/data/draw/en.json b/src/data/draw/en.json new file mode 100644 index 0000000..de092ca --- /dev/null +++ b/src/data/draw/en.json @@ -0,0 +1,14 @@ +{ + "markType": "Type", + "summary": "Summary", + "tags": "Tags", + "description": "Description", + "link": "Link", + "createdAt": "Created At", + "updatedAt": "Updated At", + "title": "Title", + "thumbnail": "Thumbnail", + "save": "Save", + "editMarkSuccess": "Edit Mark Success", + "deleteMarkSuccess": "Delete Mark Success" +} \ No newline at end of file diff --git a/src/data/draw/zh.json b/src/data/draw/zh.json new file mode 100644 index 0000000..e0ab43e --- /dev/null +++ b/src/data/draw/zh.json @@ -0,0 +1,14 @@ +{ + "markType": "类型", + "summary": "摘要", + "tags": "标签", + "description": "描述", + "link": "链接", + "createdAt": "创建时间", + "updatedAt": "更新时间", + "title": "标题", + "thumbnail": "缩略图", + "save": "保存", + "editMarkSuccess": "编辑成功", + "deleteMarkSuccess": "删除成功" +} \ No newline at end of file