@seekskyworld/open-browser 0.3.0 → 0.3.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.
Files changed (82) hide show
  1. package/CONTRIBUTING.md +2 -0
  2. package/Docs/desktop-packages.md +45 -0
  3. package/Docs//350/267/250/345/271/263/345/217/260/350/257/225/347/224/250/344/270/216/345/217/221/350/241/214.md +1 -1
  4. package/README.md +8 -6
  5. package/README.zh-CN.md +2 -0
  6. package/api-contract.mjs +2 -1
  7. package/browser-extension/_locales/en/messages.json +8 -0
  8. package/browser-extension/_locales/zh_CN/messages.json +8 -0
  9. package/browser-extension/i18n.js +84 -0
  10. package/browser-extension/manifest.json +5 -4
  11. package/browser-extension/messages.js +266 -0
  12. package/browser-extension/newtab.css +4 -0
  13. package/browser-extension/newtab.html +9 -9
  14. package/browser-extension/newtab.js +38 -36
  15. package/browser-extension/page-locale.js +23 -0
  16. package/browser-extension/phase-labels.js +33 -6
  17. package/browser-extension/popup.css +2 -2
  18. package/browser-extension/popup.html +24 -26
  19. package/browser-extension/popup.js +72 -49
  20. package/browser-extension/tab-action.js +29 -24
  21. package/browser-extension/worker.js +29 -5
  22. package/browser-extension/workspace-title.js +2 -2
  23. package/build-profile.mjs +10 -2
  24. package/chromium-host.mjs +22 -11
  25. package/chromium-shell.mjs +5 -3
  26. package/cli.mjs +33 -30
  27. package/control.mjs +9 -8
  28. package/desktop/Info.plist +3 -1
  29. package/desktop/Launcher.m +10 -2
  30. package/desktop/OBControlBar.m +12 -8
  31. package/desktop/OBLocalization.h +20 -0
  32. package/desktop/OBPageView.m +2 -1
  33. package/desktop/WorkspacePanel.m +84 -83
  34. package/desktop/archive-release.py +5 -1
  35. package/desktop/build-macos.mjs +11 -5
  36. package/desktop/build-managed-input.mjs +2 -1
  37. package/desktop/build-portable.mjs +5 -3
  38. package/desktop/build-profile.mjs +2 -1
  39. package/desktop/build.mjs +2 -1
  40. package/desktop/create-shortcut.ps1 +7 -1
  41. package/desktop/en.lproj/Localizable.strings +106 -0
  42. package/desktop/install-menu-entry.mjs +2 -0
  43. package/desktop/notarize-macos.mjs +21 -24
  44. package/desktop/package-macos.mjs +4 -3
  45. package/desktop/sign.mjs +5 -4
  46. package/desktop/start-profile.mjs +2 -1
  47. package/desktop/start.mjs +3 -1
  48. package/desktop/verify-macos-release.mjs +9 -8
  49. package/desktop/zh-Hans.lproj/Localizable.strings +106 -0
  50. package/engine-service.mjs +1 -1
  51. package/hosted/cli.mjs +2 -1
  52. package/hosted/init.mjs +2 -1
  53. package/i18n.mjs +41 -0
  54. package/mcp-http.mjs +3 -2
  55. package/mcp-server.mjs +4 -3
  56. package/messages.zh-CN.mjs +175 -0
  57. package/package.json +4 -1
  58. package/page-activity.mjs +8 -6
  59. package/paths.mjs +2 -5
  60. package/runtime.mjs +4 -3
  61. package/sdk.mjs +40 -39
  62. package/service.mjs +2 -1
  63. package/skills/open-browser/SKILL.md +11 -9
  64. package/skills/open-browser/SKILL.zh-CN.md +22 -0
  65. package/skills/open-browser/references/macos.en.md +3 -0
  66. package/skills/open-browser/references/macos.md +2 -0
  67. package/skills/open-browser/references/operations.en.md +54 -0
  68. package/skills/open-browser/references/operations.md +2 -0
  69. package/skills/open-browser/references/recovery.en.md +36 -0
  70. package/skills/open-browser/references/recovery.md +2 -0
  71. package/skills/open-browser/references/windows.en.md +3 -0
  72. package/skills/open-browser/references/windows.md +2 -0
  73. package/skills/open-browser/scripts/bootstrap.mjs +6 -4
  74. package/skills/open-browser/scripts/guide.mjs +7 -4
  75. package/skills/open-browser/scripts/open-browser +5 -1
  76. package/studio/demo-site.mjs +5 -4
  77. package/studio/index.html +37 -33
  78. package/studio/index.mjs +10 -3
  79. package/studio/native-demo.mjs +8 -7
  80. package/studio/studio.css +3 -0
  81. package/studio/studio.js +98 -68
  82. package/system-i18n.mjs +19 -0
@@ -1,3 +1,4 @@
1
+ #import "OBLocalization.h"
1
2
  #import "WorkspacePanel.h"
2
3
  #import "OBPageView.h"
3
4
 
@@ -29,20 +30,20 @@ static NSStackView *Stack(NSArray<NSView *> *items, BOOL vertical, CGFloat gap)
29
30
 
30
31
  static NSString *Operation(NSDictionary *op) {
31
32
  if (!op) return @"";
32
- NSDictionary *kinds = @{@"openPage":@"打开页面", @"observe":@"观察页面", @"act":@"页面操作",
33
- @"click":@"点击", @"fill":@"填写", @"fillCredential":@"填写凭据"};
34
- NSString *kind = kinds[String(op[@"kind"])] ?: @"操作";
33
+ NSDictionary *kinds = @{@"openPage":OBLocalizedString(@"Open page"), @"observe":OBLocalizedString(@"Observe page"), @"act":OBLocalizedString(@"Page action"),
34
+ @"click":OBLocalizedString(@"Click"), @"fill":OBLocalizedString(@"Fill"), @"fillCredential":OBLocalizedString(@"Fill credential")};
35
+ NSString *kind = kinds[String(op[@"kind"])] ?: OBLocalizedString(@"Action");
35
36
  NSString *step = kinds[String(op[@"stepKind"])];
36
- NSDictionary *phases = @{@"actionability": @"检查目标", @"dispatching": @"正在派发",
37
- @"waiting": @"等待页面", @"verifying": @"核对结果", @"running": @"执行中"};
37
+ NSDictionary *phases = @{@"actionability": OBLocalizedString(@"Checking target"), @"dispatching": OBLocalizedString(@"Dispatching"),
38
+ @"waiting": OBLocalizedString(@"Waiting for page"), @"verifying": OBLocalizedString(@"Checking result"), @"running": OBLocalizedString(@"Running")};
38
39
  if (step && [op[@"state"] isEqual:@"running"]) {
39
40
  NSString *stage = phases[String(op[@"phase"])] ?: phases[@"running"];
40
- return [NSString stringWithFormat:@"%@ · %@ · %@/%@ 步", step, stage,
41
+ return [NSString stringWithFormat:OBLocalizedString(@"%@ · %@ · Steps: %@/%@"), step, stage,
41
42
  op[@"completedSteps"] ?: @0, op[@"totalSteps"] ?: @0];
42
43
  }
43
- NSDictionary *states = @{@"queued":@"排队中", @"running":@"执行中", @"completed":@"已完成",
44
- @"failed":@"失败", @"outcome_unknown":@"结果待核对", @"cancelled":@"已取消"};
45
- NSString *state = [op[@"error"] isEqual:@"credential_required"] ? @"缺少凭据" : states[String(op[@"state"])];
44
+ NSDictionary *states = @{@"queued":OBLocalizedString(@"In queue"), @"running":OBLocalizedString(@"Running"), @"completed":OBLocalizedString(@"Completed"),
45
+ @"failed":OBLocalizedString(@"Failed"), @"outcome_unknown":OBLocalizedString(@"Result needs verification"), @"cancelled":OBLocalizedString(@"Cancelled")};
46
+ NSString *state = [op[@"error"] isEqual:@"credential_required"] ? OBLocalizedString(@"Missing credential") : states[String(op[@"state"])];
46
47
  return state ? [NSString stringWithFormat:@"%@ · %@", kind, state] : kind;
47
48
  }
48
49
 
@@ -55,18 +56,18 @@ static NSInteger Group(NSDictionary *workspace) {
55
56
  }
56
57
 
57
58
  static NSString *Status(NSDictionary *workspace) {
58
- if ([workspace[@"mode"] isEqual:@"human"]) return @"用户控制 · Agent 已暂停";
59
- if ([workspace[@"mode"] isEqual:@"transferring"]) return @"正在交接控制权";
59
+ if ([workspace[@"mode"] isEqual:@"human"]) return OBLocalizedString(@"User in control · Agent paused");
60
+ if ([workspace[@"mode"] isEqual:@"transferring"]) return OBLocalizedString(@"Transferring control");
60
61
  NSDictionary *activity = workspace[@"activity"];
61
- if ([activity[@"needsHumanVerification"] boolValue]) return @"需要人工验证";
62
- if ([activity[@"needsCredential"] boolValue]) return @"等待补充凭据";
63
- if ([activity[@"needsVisualPermission"] boolValue]) return @"需要授权截图";
62
+ if ([activity[@"needsHumanVerification"] boolValue]) return OBLocalizedString(@"Human verification required");
63
+ if ([activity[@"needsCredential"] boolValue]) return OBLocalizedString(@"Waiting for a credential");
64
+ if ([activity[@"needsVisualPermission"] boolValue]) return OBLocalizedString(@"Screenshot permission required");
64
65
  NSString *current = Operation(Map(activity[@"current"]));
65
66
  if (current.length) return current;
66
- NSDictionary *phase = @{@"running":@"执行中", @"actionability":@"检查目标", @"dispatching":@"正在派发",
67
- @"waiting":@"等待页面", @"verifying":@"核对结果", @"queued":@"排队中", @"completed":@"已完成", @"failed":@"执行失败",
68
- @"outcome_unknown":@"结果待核对", @"cancelled":@"已取消", @"needs_credential":@"等待补充凭据", @"needs_human_verification":@"需要人工验证", @"needs_visual_permission":@"需要授权截图"};
69
- return phase[String(activity[@"phase"])] ?: @"等待指令";
67
+ NSDictionary *phase = @{@"running":OBLocalizedString(@"Running"), @"actionability":OBLocalizedString(@"Checking target"), @"dispatching":OBLocalizedString(@"Dispatching"),
68
+ @"waiting":OBLocalizedString(@"Waiting for page"), @"verifying":OBLocalizedString(@"Checking result"), @"queued":OBLocalizedString(@"In queue"), @"completed":OBLocalizedString(@"Completed"), @"failed":OBLocalizedString(@"Action failed"),
69
+ @"outcome_unknown":OBLocalizedString(@"Result needs verification"), @"cancelled":OBLocalizedString(@"Cancelled"), @"needs_credential":OBLocalizedString(@"Waiting for a credential"), @"needs_human_verification":OBLocalizedString(@"Human verification required"), @"needs_visual_permission":OBLocalizedString(@"Screenshot permission required")};
70
+ return phase[String(activity[@"phase"])] ?: OBLocalizedString(@"Waiting for instructions");
70
71
  }
71
72
 
72
73
  static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
@@ -163,31 +164,31 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
163
164
  self.notice.font = [NSFont systemFontOfSize:12];
164
165
  self.notice.maximumNumberOfLines = 2;
165
166
  self.notice.hidden = YES;
166
- self.create = [self icon:@"plus" label:@"新建工作区" action:@selector(createWorkspace:)];
167
- self.back = [self icon:@"chevron.left" label:@"后退" action:@selector(goBack:)];
168
- self.forward = [self icon:@"chevron.right" label:@"前进" action:@selector(goForward:)];
169
- self.reload = [self icon:@"arrow.clockwise" label:@"刷新" action:@selector(reloadPage:)];
170
- self.home = [self icon:@"house" label:@"主页" action:@selector(home:)];
171
- self.splitButton = [self icon:@"rectangle.split.2x1" label:@"拆分页面" action:@selector(toggleSplit:)];
172
- self.tabButton = [self icon:@"plus" label:@"新建标签页" action:@selector(newTab:)];
173
- self.control = [self button:@"接管" action:@selector(changeControl:)];
167
+ self.create = [self icon:@"plus" label:OBLocalizedString(@"New workspace") action:@selector(createWorkspace:)];
168
+ self.back = [self icon:@"chevron.left" label:OBLocalizedString(@"Back") action:@selector(goBack:)];
169
+ self.forward = [self icon:@"chevron.right" label:OBLocalizedString(@"Forward") action:@selector(goForward:)];
170
+ self.reload = [self icon:@"arrow.clockwise" label:OBLocalizedString(@"Refresh") action:@selector(reloadPage:)];
171
+ self.home = [self icon:@"house" label:OBLocalizedString(@"Home") action:@selector(home:)];
172
+ self.splitButton = [self icon:@"rectangle.split.2x1" label:OBLocalizedString(@"Split view") action:@selector(toggleSplit:)];
173
+ self.tabButton = [self icon:@"plus" label:OBLocalizedString(@"New tab") action:@selector(newTab:)];
174
+ self.control = [self button:OBLocalizedString(@"Take") action:@selector(changeControl:)];
174
175
  self.more = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:YES];
175
176
  self.more.bordered = NO;
176
177
  self.more.controlSize = NSControlSizeSmall;
177
- self.more.toolTip = @"更多操作";
178
- [self.more setAccessibilityLabel:@"更多操作"];
178
+ self.more.toolTip = OBLocalizedString(@"More actions");
179
+ [self.more setAccessibilityLabel:OBLocalizedString(@"More actions")];
179
180
  self.more.menu.autoenablesItems = NO;
180
181
  [self.more addItemWithTitle:@""];
181
- self.more.itemArray.firstObject.image = [NSImage imageWithSystemSymbolName:@"ellipsis.circle" accessibilityDescription:@"更多操作"];
182
+ self.more.itemArray.firstObject.image = [NSImage imageWithSystemSymbolName:@"ellipsis.circle" accessibilityDescription:OBLocalizedString(@"More actions")];
182
183
  self.more.imagePosition = NSImageOnly;
183
- self.credential = [self menuItem:@"绑定凭据…" action:@selector(credentials:)];
184
- self.preview = [self menuItem:@"查看页面文本…" action:@selector(previewPage:)];
185
- self.feedback = [self menuItem:@"反馈问题…" action:@selector(feedback:)];
184
+ self.credential = [self menuItem:OBLocalizedString(@"Bind credential…") action:@selector(credentials:)];
185
+ self.preview = [self menuItem:OBLocalizedString(@"View page text…") action:@selector(previewPage:)];
186
+ self.feedback = [self menuItem:OBLocalizedString(@"Send feedback…") action:@selector(feedback:)];
186
187
  [self.more.menu addItem:NSMenuItem.separatorItem];
187
- self.closePageButton = [self menuItem:@"关闭标签页" action:@selector(closePage:)];
188
- self.close = [self menuItem:@"关闭工作区…" action:@selector(closeWorkspace:)];
188
+ self.closePageButton = [self menuItem:OBLocalizedString(@"Close tab") action:@selector(closePage:)];
189
+ self.close = [self menuItem:OBLocalizedString(@"Close workspace…") action:@selector(closeWorkspace:)];
189
190
  self.address = [[NSTextField alloc] initWithFrame:NSZeroRect];
190
- self.address.placeholderString = @"输入网址";
191
+ self.address.placeholderString = OBLocalizedString(@"Enter a URL");
191
192
  self.address.bezelStyle = NSTextFieldRoundedBezel;
192
193
  self.address.font = [NSFont systemFontOfSize:13];
193
194
  self.address.usesSingleLineMode = YES;
@@ -195,7 +196,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
195
196
  self.address.target = self;
196
197
  self.address.action = @selector(submitAddress:);
197
198
  [(NSTextFieldCell *)self.address.cell setSendsActionOnEndEditing:NO];
198
- [self.address setAccessibilityLabel:@"地址栏"];
199
+ [self.address setAccessibilityLabel:OBLocalizedString(@"Address bar")];
199
200
  self.window.initialFirstResponder = self.address;
200
201
  self.table = [[NSTableView alloc] initWithFrame:NSZeroRect];
201
202
  NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:@"workspace"];
@@ -209,7 +210,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
209
210
  self.table.columnAutoresizingStyle = NSTableViewLastColumnOnlyAutoresizingStyle;
210
211
  self.table.style = NSTableViewStyleSourceList;
211
212
  self.table.backgroundColor = NSColor.clearColor;
212
- [self.table setAccessibilityLabel:@"工作区与页面"];
213
+ [self.table setAccessibilityLabel:OBLocalizedString(@"Workspaces and pages")];
213
214
  NSScrollView *scroll = [[NSScrollView alloc] init];
214
215
  scroll.documentView = self.table;
215
216
  scroll.hasVerticalScroller = YES;
@@ -218,7 +219,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
218
219
 
219
220
  NSVisualEffectView *sidebar = [[NSVisualEffectView alloc] initWithFrame:NSMakeRect(0, 0, 190, size.height)];
220
221
  sidebar.material = NSVisualEffectMaterialSidebar;
221
- NSTextField *library = Label(@"工作区", 15, NSFontWeightSemibold, NSColor.labelColor);
222
+ NSTextField *library = Label(OBLocalizedString(@"Workspace"), 15, NSFontWeightSemibold, NSColor.labelColor);
222
223
  NSView *sideHeader = [NSView new];
223
224
  [sideHeader addSubview:library];
224
225
  [sideHeader addSubview:self.create];
@@ -271,8 +272,8 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
271
272
  [self.pageSplit addArrangedSubview:self.secondaryPageView];
272
273
  self.secondaryPageView.hidden = YES;
273
274
  [viewport addSubview:self.pageSplit];
274
- self.emptyTitle = Label(@"打开工作区", 24, NSFontWeightSemibold, NSColor.labelColor);
275
- self.emptyAction = [self button:@"新建工作区" action:@selector(emptyAction:)];
275
+ self.emptyTitle = Label(OBLocalizedString(@"Open workspace"), 24, NSFontWeightSemibold, NSColor.labelColor);
276
+ self.emptyAction = [self button:OBLocalizedString(@"New workspace") action:@selector(emptyAction:)];
276
277
  NSImageView *icon = [NSImageView imageViewWithImage:NSApp.applicationIconImage];
277
278
  [icon.widthAnchor constraintEqualToConstant:40].active = YES;
278
279
  [icon.heightAnchor constraintEqualToConstant:40].active = YES;
@@ -388,7 +389,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
388
389
  BOOL wasConnected = self.connected;
389
390
  self.connected = !error && [result isKindOfClass:NSArray.class];
390
391
  if (!self.connected) {
391
- [self message:error ?: @"正在连接本地服务…"];
392
+ [self message:error ?: OBLocalizedString(@"Connecting to the local service…")];
392
393
  [self render];
393
394
  return;
394
395
  }
@@ -419,7 +420,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
419
420
  if (![self page] && ![self draft]) {
420
421
  self.pageID = [selectedWorkspace[@"pages"] lastObject][@"pageId"] ?: [self.drafts[self.workspaceID ?: @""] lastObject][@"pageId"];
421
422
  }
422
- NSArray *titles = @[@"待处理", @"Agent 运行", @"人工接管", @"待命"];
423
+ NSArray *titles = @[OBLocalizedString(@"Needs attention"), OBLocalizedString(@"Agent running"), OBLocalizedString(@"Take over"), OBLocalizedString(@"Idle")];
423
424
  NSMutableArray *rows = [NSMutableArray array];
424
425
  for (NSInteger i = 0; i < (NSInteger)titles.count; i++) {
425
426
  NSMutableArray *members = [NSMutableArray array];
@@ -464,7 +465,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
464
465
  BOOL page = item[@"pageId"] != nil;
465
466
  NSString *title = String(item[@"title"]), *origin = String(item[@"origin"]);
466
467
  NSString *workspaceName = String(item[@"name"]);
467
- if (!workspaceName.length) workspaceName = @"未命名任务(请命名)";
468
+ if (!workspaceName.length) workspaceName = OBLocalizedString(@"Untitled task (please name it)");
468
469
  NSString *name = group ? [NSString stringWithFormat:@"%@ %@", item[@"group"], item[@"count"]]
469
470
  : page ? (title.length ? title : origin) : workspaceName;
470
471
  NSTextField *primary = Label(name, group ? 11 : 13, group || !page ? NSFontWeightSemibold : NSFontWeightRegular, group ? NSColor.secondaryLabelColor : NSColor.labelColor);
@@ -478,7 +479,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
478
479
  toggle.image = [NSImage imageWithSystemSymbolName:collapsed ? @"chevron.right" : @"chevron.down" accessibilityDescription:nil];
479
480
  toggle.symbolConfiguration = [NSImageSymbolConfiguration configurationWithPointSize:9 weight:NSFontWeightSemibold];
480
481
  toggle.identifier = item[@"workspaceId"];
481
- toggle.toolTip = collapsed ? @"展开工作区" : @"折叠工作区";
482
+ toggle.toolTip = collapsed ? OBLocalizedString(@"Expand workspace") : OBLocalizedString(@"Collapse workspace");
482
483
  [toggle setAccessibilityLabel:toggle.toolTip];
483
484
  toggle.translatesAutoresizingMaskIntoConstraints = NO;
484
485
  [cell addSubview:toggle];
@@ -551,17 +552,17 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
551
552
  self.home.enabled = ready;
552
553
  self.tabButton.enabled = ready;
553
554
  self.splitButton.enabled = ready && page && ([self splitCandidate] || self.splitPage);
554
- self.splitButton.toolTip = self.splitPage ? @"关闭拆分" : @"拆分当前工作区页面";
555
+ self.splitButton.toolTip = self.splitPage ? OBLocalizedString(@"Close split view") : OBLocalizedString(@"Split the current workspace view");
555
556
  self.more.enabled = ready;
556
557
  self.create.enabled = ready;
557
558
  self.control.enabled = ready && (human || (agent && page));
558
- self.control.title = human ? @"交回 Agent" : @"接管";
559
- self.control.toolTip = human ? @"交回此工作区的控制权" : @"人工接管当前页面";
559
+ self.control.title = human ? OBLocalizedString(@"Return to agent") : OBLocalizedString(@"Take");
560
+ self.control.toolTip = human ? OBLocalizedString(@"Return control of this workspace to the agent") : OBLocalizedString(@"Take control of the current page");
560
561
  self.control.hidden = !w || (!page && !human);
561
- self.status.stringValue = w ? Status(w) : self.connected ? @"" : @"正在连接本地服务…";
562
- if ([activity[@"queued"] integerValue]) self.status.stringValue = [self.status.stringValue stringByAppendingFormat:@" · 排队 %@", activity[@"queued"]];
562
+ self.status.stringValue = w ? Status(w) : self.connected ? @"" : OBLocalizedString(@"Connecting to the local service…");
563
+ if ([activity[@"queued"] integerValue]) self.status.stringValue = [self.status.stringValue stringByAppendingFormat:OBLocalizedString(@" · Queued: %@"), activity[@"queued"]];
563
564
  self.status.toolTip = Operation(Map(activity[@"recent"]));
564
- self.credential.title = [activity[@"needsCredential"] boolValue] ? @"补充凭据…" : @"绑定凭据…";
565
+ self.credential.title = [activity[@"needsCredential"] boolValue] ? OBLocalizedString(@"Supply credentials…") : OBLocalizedString(@"Bind credential…");
565
566
  self.credential.enabled = agent && page;
566
567
  self.preview.enabled = agent && page;
567
568
  self.feedback.enabled = self.connected;
@@ -578,8 +579,8 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
578
579
  NSDictionary *secondHandle = second ? @{@"workspaceId":self.workspaceID, @"pageId":second[@"pageId"]} : nil;
579
580
  self.secondaryPageView.hidden = secondHandle == nil || handle == nil;
580
581
  self.pageSplit.hidden = handle == nil;
581
- self.emptyTitle.stringValue = !self.connected ? @"正在连接本地服务…" : @"新标签页";
582
- self.emptyAction.title = @"输入网址";
582
+ self.emptyTitle.stringValue = !self.connected ? OBLocalizedString(@"Connecting to the local service…") : OBLocalizedString(@"New Tab");
583
+ self.emptyAction.title = OBLocalizedString(@"Enter a URL");
583
584
  self.emptyAction.enabled = ready;
584
585
  if (!self.window.visible || self.window.miniaturized) handle = nil;
585
586
  NSArray *identity = handle ? @[handle, String(w[@"mode"]), String(w[@"controlGeneration"])] : @[];
@@ -609,12 +610,12 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
609
610
  [self invoke:method params:params reply:^(id result, NSString *error) {
610
611
  self.busy = NO;
611
612
  if (error.length) {
612
- NSDictionary *messages = @{@"invalid_url":@"请输入完整的 http 或 https 网址。",
613
- @"origin_denied":@"该站点不在此工作区的授权范围内。",
614
- @"navigation_failed":@"页面打开失败,请检查网址或网络。",
615
- @"workspace_under_user_control":@"工作区正由用户控制。",
616
- @"stale_control":@"控制权已变化,请重新操作。",
617
- @"stale_credential_request":@"凭据请求已变化,请重新查看。"};
613
+ NSDictionary *messages = @{@"invalid_url":OBLocalizedString(@"Enter a complete HTTP or HTTPS URL."),
614
+ @"origin_denied":OBLocalizedString(@"This site is outside the workspace's approved origins."),
615
+ @"navigation_failed":OBLocalizedString(@"Could not open the page. Check the URL or your connection."),
616
+ @"workspace_under_user_control":OBLocalizedString(@"The user controls this workspace."),
617
+ @"stale_control":OBLocalizedString(@"Control has changed. Try again."),
618
+ @"stale_credential_request":OBLocalizedString(@"The credential request changed. Review it again.")};
618
619
  [self message:messages[error] ?: error];
619
620
  }
620
621
  else {
@@ -631,7 +632,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
631
632
  sheet.messageText = title;
632
633
  sheet.informativeText = message ?: @"";
633
634
  [sheet addButtonWithTitle:action];
634
- [sheet addButtonWithTitle:@"取消"];
635
+ [sheet addButtonWithTitle:OBLocalizedString(@"Cancel")];
635
636
  return sheet;
636
637
  }
637
638
 
@@ -650,9 +651,9 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
650
651
  }
651
652
 
652
653
  - (void)createWorkspace:(id)sender {
653
- NSAlert *sheet = [self sheet:@"新建工作区" message:@"" action:@"创建"];
654
- NSTextField *name = [self field:@"工作区名称" secure:NO];
655
- NSTextField *url = [self field:@"首个网址(可选)" secure:NO];
654
+ NSAlert *sheet = [self sheet:OBLocalizedString(@"New workspace") message:@"" action:OBLocalizedString(@"Create")];
655
+ NSTextField *name = [self field:OBLocalizedString(@"Workspace name") secure:NO];
656
+ NSTextField *url = [self field:OBLocalizedString(@"First URL (optional)") secure:NO];
656
657
  [self attach:@[name, url] sheet:sheet];
657
658
  name.nextKeyView = url;
658
659
  sheet.window.initialFirstResponder = name;
@@ -660,7 +661,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
660
661
  if (response != NSAlertFirstButtonReturn) return;
661
662
  NSString *title = [name.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
662
663
  NSString *address = [url.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
663
- if (!title.length) { [self message:@"请输入工作区名称。"]; return; }
664
+ if (!title.length) { [self message:OBLocalizedString(@"Enter a workspace name.")]; return; }
664
665
  [self perform:@"createWorkspace" params:@{@"name":title} success:^(id result) {
665
666
  NSString *createdID = result[@"workspaceId"];
666
667
  self.pendingSelection = @{@"workspaceId":createdID};
@@ -687,7 +688,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
687
688
  if (self.workspaceID) {
688
689
  if (!self.drafts[self.workspaceID]) self.drafts[self.workspaceID] = [NSMutableArray array];
689
690
  self.pageID = NSUUID.UUID.UUIDString;
690
- [self.drafts[self.workspaceID] addObject:@{@"workspaceId":self.workspaceID, @"pageId":self.pageID, @"title":@"新标签页"}];
691
+ [self.drafts[self.workspaceID] addObject:@{@"workspaceId":self.workspaceID, @"pageId":self.pageID, @"title":OBLocalizedString(@"New Tab")}];
691
692
  [self.collapsed removeObject:self.workspaceID];
692
693
  [self displayWorkspaces:self.workspaces];
693
694
  }
@@ -707,7 +708,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
707
708
  }
708
709
  NSDictionary *candidate = [self splitCandidate];
709
710
  if (!candidate) {
710
- [self message:@"当前工作区至少需要两个页面才能拆分。"];
711
+ [self message:OBLocalizedString(@"This workspace needs at least two pages for split view.")];
711
712
  return;
712
713
  }
713
714
  self.splitPage = candidate;
@@ -775,7 +776,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
775
776
  }
776
777
  NSURLComponents *components = [NSURLComponents componentsWithString:address];
777
778
  if (![@[@"http", @"https"] containsObject:components.scheme.lowercaseString] || !components.host.length || components.user || components.password) {
778
- [self message:@"请输入有效的 HTTP 或 HTTPS 网址。"]; return;
779
+ [self message:OBLocalizedString(@"Enter a valid HTTP or HTTPS URL.")]; return;
779
780
  }
780
781
  if ([self handle]) { [self navigate:@"go" url:address]; return; }
781
782
  if (self.workspaceID) { [self openAddress:address workspace:self.workspaceID]; return; }
@@ -805,25 +806,25 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
805
806
  - (void)feedback:(id)sender {
806
807
  NSDictionary *workspace = [self active];
807
808
  NSDictionary *activity = workspace[@"activity"];
808
- NSString *report = [NSString stringWithFormat:@"open-browser\n工作区状态:%@\nAgent:%@\n页面标题:%@\n\n请补充复现步骤。此文本不包含网址、页面正文、凭据或 Cookie。",
809
+ NSString *report = [NSString stringWithFormat:OBLocalizedString(@"Open Browser\nWorkspace status: %@\nAgent: %@\nPage title: %@\n\nDescribe how to reproduce the issue. This report omits URLs, page content, credentials and cookies."),
809
810
  Status(workspace), String(workspace[@"agentName"]), String([self page][@"title"])];
810
811
  NSAlert *alert = [NSAlert new];
811
- alert.messageText = @"反馈问题";
812
- alert.informativeText = [NSString stringWithFormat:@"%@\n当前操作:%@", report, Operation(Map(activity[@"recent"]))];
813
- [alert addButtonWithTitle:@"复制脱敏反馈"];
814
- [alert addButtonWithTitle:@"关闭"];
812
+ alert.messageText = OBLocalizedString(@"Send feedback");
813
+ alert.informativeText = [NSString stringWithFormat:OBLocalizedString(@"%@\nCurrent action: %@"), report, Operation(Map(activity[@"recent"]))];
814
+ [alert addButtonWithTitle:OBLocalizedString(@"Copy redacted feedback")];
815
+ [alert addButtonWithTitle:OBLocalizedString(@"Close")];
815
816
  if ([alert runModal] == NSAlertFirstButtonReturn) {
816
817
  NSPasteboard *pasteboard = NSPasteboard.generalPasteboard;
817
818
  [pasteboard clearContents];
818
819
  [pasteboard setString:report forType:NSPasteboardTypeString];
819
- [self message:@"已复制脱敏反馈,可粘贴到项目 issue 或私聊中。"];
820
+ [self message:OBLocalizedString(@"Redacted feedback copied. Paste it into an issue or a private message.")];
820
821
  }
821
822
  }
822
823
 
823
824
  - (void)closeWorkspace:(id)sender {
824
825
  NSString *workspace = self.workspaceID;
825
826
  if (!workspace) return;
826
- NSAlert *sheet = [self sheet:@"关闭工作区?" message:[self active][@"name"] action:@"关闭工作区"];
827
+ NSAlert *sheet = [self sheet:OBLocalizedString(@"Close workspace?") message:[self active][@"name"] action:OBLocalizedString(@"Close workspace")];
827
828
  sheet.buttons.firstObject.hasDestructiveAction = YES;
828
829
  [sheet beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse response) {
829
830
  if (response == NSAlertFirstButtonReturn) [self perform:@"closeWorkspace" params:@{@"workspaceId":workspace} success:nil];
@@ -835,9 +836,9 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
835
836
  [self perform:@"previewPage" params:page success:^(id result) {
836
837
  if (![page isEqual:[self handle]] || ![[self active][@"mode"] isEqual:@"agent"]) return;
837
838
  NSAlert *sheet = [[NSAlert alloc] init];
838
- sheet.messageText = @"页面文本";
839
+ sheet.messageText = OBLocalizedString(@"Page text");
839
840
  sheet.informativeText = String([self page][@"origin"]);
840
- [sheet addButtonWithTitle:@"完成"];
841
+ [sheet addButtonWithTitle:OBLocalizedString(@"Done")];
841
842
  NSScrollView *scroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, 0, 320, 200)];
842
843
  scroll.hasVerticalScroller = YES;
843
844
  scroll.borderType = NSBezelBorder;
@@ -846,7 +847,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
846
847
  text.richText = NO;
847
848
  text.autoresizingMask = NSViewWidthSizable;
848
849
  text.textContainerInset = NSMakeSize(6, 6);
849
- text.string = String(result[@"text"]).length ? result[@"text"] : @"暂无可预览的文字。";
850
+ text.string = String(result[@"text"]).length ? result[@"text"] : OBLocalizedString(@"No text to preview.");
850
851
  scroll.documentView = text;
851
852
  sheet.accessoryView = scroll;
852
853
  self.previewSheet = sheet;
@@ -866,16 +867,16 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
866
867
  NSString *target = request ? request[@"pageId"] : page[@"pageId"];
867
868
  NSDictionary *targetPage = Find(result[@"pages"], @"pageId", target);
868
869
  NSString *origin = request ? String(request[@"origin"]) : String(targetPage[@"origin"]);
869
- if (!targetPage || ![targetPage[@"origin"] isEqual:origin]) { [self message:@"页面已变化,请重新打开凭据面板。"]; return; }
870
+ if (!targetPage || ![targetPage[@"origin"] isEqual:origin]) { [self message:OBLocalizedString(@"The page changed. Reopen the credential panel.")]; return; }
870
871
  [self editCredential:request page:targetPage generation:result[@"controlGeneration"] origin:origin];
871
872
  }];
872
873
  }
873
874
 
874
875
  - (void)editCredential:(NSDictionary *)request page:(NSDictionary *)page generation:(NSString *)generation origin:(NSString *)origin {
875
876
  NSDictionary *handle = @{@"workspaceId":page[@"workspaceId"], @"pageId":page[@"pageId"]};
876
- NSAlert *sheet = [self sheet:request ? @"补充凭据" : @"绑定凭据" message:origin action:@"绑定"];
877
- NSTextField *ref = [self field:@"凭据名称" secure:NO];
878
- NSSecureTextField *secret = (NSSecureTextField *)[self field:@"凭据值" secure:YES];
877
+ NSAlert *sheet = [self sheet:request ? OBLocalizedString(@"Supply credentials") : OBLocalizedString(@"Bind credential") message:origin action:OBLocalizedString(@"Bind")];
878
+ NSTextField *ref = [self field:OBLocalizedString(@"Credential name") secure:NO];
879
+ NSSecureTextField *secret = (NSSecureTextField *)[self field:OBLocalizedString(@"Credential value") secure:YES];
879
880
  NSMutableArray *fields = [NSMutableArray array];
880
881
  if (request) {
881
882
  ref.stringValue = String(request[@"credentialRef"]);
@@ -896,19 +897,19 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
896
897
  secret.stringValue = @"";
897
898
  if (response != NSAlertFirstButtonReturn) return;
898
899
  NSString *key = [ref.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
899
- if (!value.length || !key.length) { [self message:@"请填写凭据名称和值。"]; return; }
900
+ if (!value.length || !key.length) { [self message:OBLocalizedString(@"Enter a credential name and value.")]; return; }
900
901
  [self perform:@"getWorkspace" params:@{@"workspaceId":handle[@"workspaceId"]} success:^(id fresh) {
901
902
  NSDictionary *currentRequest = Map(fresh[@"activity"][@"credentialRequest"]);
902
903
  NSDictionary *currentPage = Find(fresh[@"pages"], @"pageId", handle[@"pageId"]);
903
904
  if (![fresh[@"mode"] isEqual:@"agent"] || ![generation isEqual:fresh[@"controlGeneration"]] ||
904
905
  ![currentPage[@"origin"] isEqual:origin] || (request && ![request isEqual:currentRequest])) {
905
- [self message:@"页面、控制权或凭据请求已变化,请重新查看。"];
906
+ [self message:OBLocalizedString(@"The page, control or credential request changed. Review it again.")];
906
907
  return;
907
908
  }
908
909
  NSMutableDictionary *binding = [NSMutableDictionary dictionaryWithDictionary:request ?: @{}];
909
910
  [binding addEntriesFromDictionary:@{@"workspaceId":handle[@"workspaceId"], @"origin":origin, @"credentialRef":key, @"value":value}];
910
911
  [self perform:(request ? @"resolveCredential" : @"setCredential") params:binding success:^(id __unused bound) {
911
- [self message:request ? @"已绑定凭据,调用方可以重试。" : @"已绑定凭据。"];
912
+ [self message:request ? OBLocalizedString(@"Credential bound. The agent can retry.") : OBLocalizedString(@"Credential bound.")];
912
913
  }];
913
914
  }];
914
915
  }];
@@ -69,8 +69,12 @@ def packaged_paths(source, mac):
69
69
  common = {name: 'open-browser.app/Contents/Resources/' + location for name, location in common.items()}
70
70
  common['desktop/icons/open-browser.icns'] = 'open-browser.app/Contents/Resources/open-browser.icns'
71
71
  common['desktop/Info.plist'] = 'open-browser.app/Contents/Info.plist'
72
+ for lang in ('en', 'zh-Hans'):
73
+ resource = lang + '.lproj/Localizable.strings'
74
+ common['desktop/' + resource] = 'open-browser.app/Contents/Resources/' + resource
72
75
  else:
73
- common['Docs/跨平台试用与发行.md'] = 'README.md'
76
+ common['Docs/desktop-packages.md'] = 'README.md'
77
+ common['Docs/跨平台试用与发行.md'] = 'README.zh-CN.md'
74
78
  common['desktop/smoke-portable.mjs'] = 'verify.mjs'
75
79
  return common
76
80
 
@@ -1,3 +1,4 @@
1
+ import { t } from "../i18n.mjs";
1
2
  import { execFileSync } from 'node:child_process';
2
3
  import { createHash } from 'node:crypto';
3
4
  import { copyFile, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
@@ -16,10 +17,10 @@ const sums = {
16
17
  arm64: 'e7131995759b61a0170b646010d2ad35a5d37b4cb0d471f3e8317eac6f742f3d',
17
18
  x64: 'c53383238206b9ae4db23c5d8a63645e2e753bec8ab51a49cc81939aa64e9422',
18
19
  };
19
- if (process.platform !== 'darwin' || !sums[requestedArch]) throw new Error('macOS 构建目标架构必须是 arm64 或 x64。');
20
- if (archOption >= 0 && !requestedArch) throw new Error('--arch 需要 arm64 或 x64。');
20
+ if (process.platform !== 'darwin' || !sums[requestedArch]) throw new Error(t("macOS builds require arm64 or x64."));
21
+ if (archOption >= 0 && !requestedArch) throw new Error(t("--arch requires arm64 or x64."));
21
22
  if (requestedArch !== process.arch)
22
- throw new Error(`当前 Node 是 ${process.arch},不能伪造 ${requestedArch} 架构构建。请在对应架构的 macOS、Rosetta 下的 x64 Node,或 x64 CI runner 上运行。`);
23
+ throw new Error(t("This Node process is {0}. Build {1} on matching macOS hardware, with x64 Node under Rosetta, or on an x64 CI runner.", process.arch, requestedArch));
23
24
  process.env.OPEN_BROWSER_TARGET_ARCH = requestedArch;
24
25
  const identity = signingIdentity();
25
26
  await engineExecutable();
@@ -34,7 +35,7 @@ if ((await checksum(archive).catch(() => '')) !== sums[requestedArch]) {
34
35
  const temp = archive + '.' + process.pid;
35
36
  execFileSync('curl', ['--fail', '--location', '--retry', '2', '--output', temp,
36
37
  'https://nodejs.org/dist/v22.23.5/' + filename], { stdio: 'inherit' });
37
- if (await checksum(temp) !== sums[requestedArch]) throw new Error('Node archive integrity check failed');
38
+ if (await checksum(temp) !== sums[requestedArch]) throw new Error(t('Node archive integrity check failed'));
38
39
  await rename(temp, archive);
39
40
  }
40
41
 
@@ -63,6 +64,11 @@ try {
63
64
  path.join(root, 'desktop/Launcher.m'), path.join(root, 'desktop/OBControlBar.m'),
64
65
  '-o', path.join(contents, 'MacOS/open-browser')], { stdio: 'inherit' });
65
66
  await copyFile(path.join(root, 'desktop/icons/open-browser.icns'), path.join(resources, 'open-browser.icns'));
67
+ for (const lang of ['en', 'zh-Hans']) {
68
+ const folder = lang + '.lproj';
69
+ await mkdir(path.join(resources, folder));
70
+ await copyFile(path.join(root, 'desktop', folder, 'Localizable.strings'), path.join(resources, folder, 'Localizable.strings'));
71
+ }
66
72
  await copyApplication(app);
67
73
  await writeFile(path.join(app, '.open-browser-build-profile'), (isDevelopmentBuild ? 'dev' : 'stable') + '\n');
68
74
  const engine = path.join(app, '.open-browser', 'engine');
@@ -102,7 +108,7 @@ const outputName = isDevelopmentBuild ? 'open-browser-dev.app' : requestedArch =
102
108
  if (prior.profileVersion !== 2) continue;
103
109
  const previousBrowser = path.resolve(priorEngine, prior.executable, '../../..');
104
110
  if (!previousBrowser.startsWith(priorEngine + path.sep) || !['open-browser.app', 'open-browser-x64.app', 'open-browser-dev.app'].includes(path.basename(previousBrowser)))
105
- throw new Error('旧版本 Chromium 路径无效。');
111
+ throw new Error(t("Invalid previous Chromium path."));
106
112
  verifyUpgrade(previousBrowser, browserBundle);
107
113
  }
108
114
  const old = path.join(staging, 'previous.app');
@@ -1,3 +1,4 @@
1
+ import { t } from '../i18n.mjs';
1
2
  // Build the Dev engine in an already synced Chromium checkout on its native OS.
2
3
  import { execFileSync } from 'node:child_process';
3
4
  import { existsSync, realpathSync } from 'node:fs';
@@ -7,7 +8,7 @@ import { fileURLToPath } from 'node:url';
7
8
  const revision = '98a2592026af8d673b9fa83b626ac68bdf4ae78a';
8
9
  const patch = fileURLToPath(new URL('./patches/chromium-managed-input.patch', import.meta.url));
9
10
  const arg = process.argv[2];
10
- if (!arg || process.argv.length !== 3) throw Error('Usage: node desktop/build-managed-input.mjs <chromium-src>');
11
+ if (!arg || process.argv.length !== 3) throw Error(t('Usage: node desktop/build-managed-input.mjs <chromium-src>'));
11
12
  const src = realpathSync(arg);
12
13
  const run = (file, args, options = {}) => execFileSync(file, args, {cwd:src, stdio:'inherit', ...options});
13
14
  const head = run('git', ['rev-parse', 'HEAD'], {stdio:'pipe', encoding:'utf8'}).trim();
@@ -1,3 +1,4 @@
1
+ import { t } from '../i18n.mjs';
1
2
  import { execFileSync } from 'node:child_process';
2
3
  import { createHash, randomUUID } from 'node:crypto';
3
4
  import { createReadStream } from 'node:fs';
@@ -15,11 +16,11 @@ const platforms = {
15
16
  };
16
17
  const platform = process.argv[2] || process.platform + '-' + process.arch;
17
18
  const spec = platforms[platform];
18
- if (!spec) throw new Error('Use node desktop/build-portable.mjs linux-x64 or win32-x64');
19
+ if (!spec) throw new Error(t('Use node desktop/build-portable.mjs linux-x64 or win32-x64'));
19
20
  const chromeVersion = '159.0.8154.6';
20
21
  const nodeVersion = '22.23.5';
21
22
  const info = JSON.parse(await readFile(path.join(root, 'node_modules/playwright-core/browsers.json'), 'utf8')).browsers.find(b => b.name === 'chromium');
22
- if (info.browserVersion !== chromeVersion) throw new Error('Refresh the pinned Chrome archive version and SHA-256.');
23
+ if (info.browserVersion !== chromeVersion) throw new Error(t('Refresh the pinned Chrome archive version and SHA-256.'));
23
24
  const playwright = JSON.parse(await readFile(path.join(root, 'node_modules/playwright-core/package.json'), 'utf8'));
24
25
  const cache = path.join(root, '.open-browser', 'build-cache', 'portable');
25
26
  const output = path.join(root, 'dist');
@@ -83,7 +84,8 @@ try {
83
84
  await writeFile(launcher, '#!/bin/sh\nset -eu\nbase=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)\nexec "$base/node/bin/node" "$base/app/service.mjs" --chromium "$@"\n');
84
85
  await chmod(launcher, 0o755);
85
86
  }
86
- await copyFile(path.join(root, 'Docs/跨平台试用与发行.md'), path.join(bundle, 'README.md'));
87
+ await copyFile(path.join(root, 'Docs/desktop-packages.md'), path.join(bundle, 'README.md'));
88
+ await copyFile(path.join(root, 'Docs/跨平台试用与发行.md'), path.join(bundle, 'README.zh-CN.md'));
87
89
  await copyFile(path.join(root, 'desktop/smoke-portable.mjs'), path.join(bundle, 'verify.mjs'));
88
90
  const name = folder + (windows ? '.zip' : '.tar.gz'), archive = path.join(staging, name);
89
91
  if (windows) pythonArchive('pack', bundle, archive);
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import { systemMessage as t } from '../system-i18n.mjs';
2
3
  const [profile, ...args] = process.argv.slice(2);
3
- if (!['dev', 'stable'].includes(profile)) throw new Error('usage: build-profile.mjs <dev|stable> [build arguments]');
4
+ if (!['dev', 'stable'].includes(profile)) throw new Error(t('usage: build-profile.mjs <dev|stable> [build arguments]'));
4
5
  process.env.OPEN_BROWSER_BUILD_PROFILE = profile;
5
6
  process.argv = [process.argv[0], process.argv[1], ...args];
6
7
  await import('./build.mjs');
package/desktop/build.mjs CHANGED
@@ -1,7 +1,8 @@
1
+ import { systemMessage as t } from '../system-i18n.mjs';
1
2
  const profileIndex = process.argv.findIndex(value => value === '--profile');
2
3
  if (profileIndex >= 0) {
3
4
  const profile = process.argv[profileIndex + 1];
4
- if (!['dev', 'stable'].includes(profile)) throw new Error('--profile must be dev or stable');
5
+ if (!['dev', 'stable'].includes(profile)) throw new Error(t('--profile must be dev or stable'));
5
6
  process.env.OPEN_BROWSER_BUILD_PROFILE = profile;
6
7
  }
7
8
  const archIndex = process.argv.findIndex(value => value === '--arch');
@@ -1,4 +1,4 @@
1
- $ErrorActionPreference = 'Stop'
1
+ $ErrorActionPreference = 'Stop'
2
2
  $desktop = [Environment]::GetFolderPath('DesktopDirectory')
3
3
  $link = (New-Object -ComObject WScript.Shell).CreateShortcut((Join-Path $desktop 'open-browser.lnk'))
4
4
  $link.TargetPath = Join-Path $PSScriptRoot 'node\node.exe'
@@ -6,4 +6,10 @@ $link.Arguments = '"' + (Join-Path $PSScriptRoot 'app\service.mjs') + '" --chrom
6
6
  $link.WorkingDirectory = $PSScriptRoot
7
7
  $link.IconLocation = (Join-Path $PSScriptRoot 'open-browser.ico') + ',0'
8
8
  $link.WindowStyle = 7
9
+ $language = if ($env:OPEN_BROWSER_LOCALE) { $env:OPEN_BROWSER_LOCALE } else { (Get-UICulture).Name }
10
+ $link.Description = if ($language -match '^zh($|[-_.@])') {
11
+ '与 Agent 一起浏览网页,随时在标签页接管任务'
12
+ } else {
13
+ 'Browse with agents and take over a task in its tab'
14
+ }
9
15
  $link.Save()