vjcad 0.0.1 → 1.0.1

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/README.md CHANGED
@@ -32,6 +32,16 @@ yarn add vjcad
32
32
  pnpm add vjcad
33
33
  ```
34
34
 
35
+ 或在 `package.json` 中添加:
36
+
37
+ ```json
38
+ {
39
+ "dependencies": {
40
+ "vjcad": "^1.0.0"
41
+ }
42
+ }
43
+ ```
44
+
35
45
  ## 快速开始
36
46
 
37
47
  ### 1. 初始化引擎
@@ -42,11 +52,24 @@ pnpm add vjcad
42
52
  ```
43
53
 
44
54
  ```javascript
45
- import { MainView, initCadContainer, Engine, LineEnt } from 'vjcad';
55
+ import { MainView, initCadContainer, Engine, LineEnt, initLocale, registerMessages, t } from 'vjcad';
56
+
57
+ // Initialize locale first (auto-detects from URL ?lang= > localStorage > browser language)
58
+ initLocale(); // 'zh-CN' or 'en-US'
59
+
60
+ // Register app-level translations
61
+ registerMessages({
62
+ 'zh-CN': {
63
+ 'app.name': '唯杰WebCAD'
64
+ },
65
+ 'en-US': {
66
+ 'app.name': 'VJMap WebCAD'
67
+ },
68
+ });
46
69
 
47
70
  // 创建 MainView 实例
48
71
  const cadView = new MainView({
49
- appname: "我的CAD应用",
72
+ appname: t('app.name'),
50
73
  version: "v1.0.0",
51
74
  serviceUrl: "https://your-service-url/api/v1",
52
75
  sidebarStyle: "none", // "none" | "left" | "right" | "both"