cc-pets 2.1.2 → 2.2.0

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 (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/CHANGELOG.zh-CN.md +17 -0
  3. package/CONTRIBUTING.md +54 -0
  4. package/CONTRIBUTING.zh-CN.md +45 -0
  5. package/README.md +31 -26
  6. package/README.zh-CN.md +22 -16
  7. package/Resources/Info.plist +3 -1
  8. package/Resources/en.lproj/InfoPlist.strings +1 -0
  9. package/Resources/phrases.default.en.txt +182 -0
  10. package/Resources/zh-Hans.lproj/InfoPlist.strings +1 -0
  11. package/Resources/zh-Hans.lproj/Localizable.strings +332 -0
  12. package/Sources/CCPets/CCPetsAppDelegate+AgentStatus.m +28 -28
  13. package/Sources/CCPets/CCPetsAppDelegate+Bridge.m +16 -14
  14. package/Sources/CCPets/CCPetsAppDelegate+Pets.m +7 -9
  15. package/Sources/CCPets/CCPetsAppDelegate+Private.h +3 -0
  16. package/Sources/CCPets/CCPetsAppDelegate+Settings.m +25 -4
  17. package/Sources/CCPets/CCPetsAppDelegate+Speech.m +1 -1
  18. package/Sources/CCPets/CCPetsAppDelegate+Update.m +36 -35
  19. package/Sources/CCPets/CCPetsAppDelegate.m +20 -14
  20. package/Sources/CCPets/CCPetsCleanup.m +9 -6
  21. package/Sources/CCPets/CCPetsEvents.m +4 -3
  22. package/Sources/CCPets/CCPetsL10n.h +55 -0
  23. package/Sources/CCPets/CCPetsL10n.m +219 -0
  24. package/Sources/CCPets/CCPetsPhrases.h +7 -1
  25. package/Sources/CCPets/CCPetsPhrases.m +86 -31
  26. package/Sources/CCPets/CCPetsPhrasesEditor.m +62 -64
  27. package/Sources/CCPets/CCPetsPreviews.m +7 -6
  28. package/Sources/CCPets/CCPetsVersion.h +7 -4
  29. package/Sources/CCPets/CCPetsVersion.m +14 -6
  30. package/Sources/CCPets/MenuToggleSwitch.m +3 -2
  31. package/Sources/CCPets/PetView.m +103 -74
  32. package/Sources/CCPets/QuotaDashboardView.m +122 -85
  33. package/Sources/CCPets/main.m +3 -1
  34. package/bin/cc-pets +21 -22
  35. package/bin/claude-with-pet +2 -1
  36. package/bin/codex-with-pet +2 -1
  37. package/package.json +3 -2
  38. package/scripts/bridge/cli.mjs +39 -38
  39. package/scripts/bridge/core.mjs +27 -26
  40. package/scripts/bridge/hook.mjs +7 -6
  41. package/scripts/bridge/install.mjs +24 -23
  42. package/scripts/bridge/mcp-server.mjs +79 -71
  43. package/scripts/bridge/options.mjs +7 -6
  44. package/scripts/bridge/reservations.mjs +6 -5
  45. package/scripts/bridge/store.mjs +10 -9
  46. package/scripts/build.sh +24 -5
  47. package/scripts/check-l10n.mjs +168 -0
  48. package/scripts/configure-updater.mjs +4 -3
  49. package/scripts/doctor.mjs +93 -79
  50. package/scripts/i18n.mjs +122 -0
  51. package/scripts/i18n.zsh +66 -0
  52. package/scripts/install-app.sh +3 -2
  53. package/scripts/install-claude-hooks.mjs +10 -9
  54. package/scripts/install-codex-hooks.mjs +7 -6
  55. package/scripts/install-shell-integration.sh +6 -5
  56. package/scripts/locales/zh-Hans.json +366 -0
  57. package/scripts/pet-store.mjs +45 -44
  58. package/scripts/uninstall-app.sh +4 -3
  59. package/scripts/uninstall-integrations.mjs +8 -7
  60. package/scripts/uninstall-shell-integration.sh +8 -7
  61. /package/Resources/{phrases.default.txt → phrases.default.zh-Hans.txt} +0 -0
@@ -1,4 +1,5 @@
1
1
  #import "QuotaDashboardView.h"
2
+ #import "CCPetsL10n.h"
2
3
 
3
4
  const CGFloat QuotaLogicalWidth = 760;
4
5
  const CGFloat QuotaLogicalHeight = 590;
@@ -77,7 +78,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
77
78
  }
78
79
  - (NSRect)logicalSummaryRect {
79
80
  return NSMakeRect(20, [self logicalHeight] - QuotaHeaderHeight - QuotaSummaryHeight,
80
- QuotaLogicalWidth - 40, QuotaSummaryHeight);
81
+ QuotaLogicalWidth - 40, QuotaSummaryHeight + 1 / QuotaScale);
81
82
  }
82
83
  // 刷新时间挪去了右上角,这一版块整宽留给两个统计格,各占一半。
83
84
  - (NSRect)logicalSummaryCellRectAtIndex:(NSUInteger)index {
@@ -116,14 +117,14 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
116
117
  - (NSDictionary *)comparisonForCurrent:(double)current previous:(double)previous
117
118
  color:(NSColor *)color {
118
119
  if (previous <= 0) {
119
- return @{ @"text": current > 0 ? @"较上月同期 新增" : @"较上月同期 持平",
120
+ return @{ @"text": current > 0 ? L(@"vs last month: new") : L(@"vs last month: flat"),
120
121
  @"color": current > 0 ? color : self.secondaryColor };
121
122
  }
122
123
  double change = (current - previous) * 100.0 / previous;
123
124
  if (fabs(change) < 0.05) {
124
- return @{ @"text": @"较上月同期 持平", @"color": self.secondaryColor };
125
+ return @{ @"text": L(@"vs last month: flat"), @"color": self.secondaryColor };
125
126
  }
126
- return @{ @"text": [NSString stringWithFormat:@"较上月同期 %@%.1f%%",
127
+ return @{ @"text": [NSString stringWithFormat:L(@"vs last month %@%.1f%%"),
127
128
  change > 0 ? @"↑" : @"↓", fabs(change)], @"color": color };
128
129
  }
129
130
  // 输入取 total - output,而不是把几个 input_* 字段加起来:两家的包含关系是相反的。
@@ -177,8 +178,8 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
177
178
  // 原生玻璃下字号更大,完整说明在单元格里放不下,只留起始日期。
178
179
  formatter.dateFormat = self.usesLiquidGlass ? @"M/d" : @"yyyy-MM-dd";
179
180
  NSString *date = [formatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:start.doubleValue]];
180
- return self.usesLiquidGlass ? [NSString stringWithFormat:@"近 7 天累计用量(%@ 起)", date]
181
- : [NSString stringWithFormat:@"近 7 天累计用量(%@ 至今·滚动记录)", date];
181
+ return self.usesLiquidGlass ? [NSString stringWithFormat:L(@"Last 7 days (since %@)"), date]
182
+ : [NSString stringWithFormat:L(@"Last 7 days (since %@, rolling)"), date];
182
183
  }
183
184
  // 在线 = 这一家还有活着的客户端,和有没有额度数据无关:额度会一直缓存着,
184
185
  // 拿它当在线信号会恒亮。身份不明的老客户端无法归属到某一家,保守地都算在线。
@@ -276,12 +277,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
276
277
  return used ? @(fmax(0, fmin(100, used.doubleValue))) : nil;
277
278
  }
278
279
  - (NSString *)refreshAgeText {
279
- if (self.lastUpdatedAt <= 0) return @"等待数据";
280
+ if (self.lastUpdatedAt <= 0) return L(@"Waiting for data");
280
281
  NSTimeInterval age = fmax(0, NSDate.date.timeIntervalSince1970 - self.lastUpdatedAt);
281
- if (age < 5) return @"刚刚";
282
- if (age < 60) return [NSString stringWithFormat:@"%.0f 秒前", age];
283
- if (age < 3600) return [NSString stringWithFormat:@"%.0f 分钟前", floor(age / 60)];
284
- return [NSString stringWithFormat:@"%.0f 小时前", floor(age / 3600)];
282
+ if (age < 5) return L(@"just now");
283
+ if (age < 60) return [NSString stringWithFormat:L(@"%.0fs ago"), age];
284
+ if (age < 3600) return [NSString stringWithFormat:L(@"%.0fm ago"), floor(age / 60)];
285
+ return [NSString stringWithFormat:L(@"%.0fh ago"), floor(age / 3600)];
285
286
  }
286
287
  // 原生玻璃下背景可以是任意壁纸,面板按 0.58 缩放后小字只有 6–7pt,细笔画很容易被
287
288
  // 背后的纹理吃掉。所以 liquid 模式统一收紧文字:小字放大一点、加粗一级;灰字不低于
@@ -304,7 +305,13 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
304
305
  - (void)drawText:(NSString *)text inRect:(NSRect)rect size:(CGFloat)size
305
306
  weight:(NSFontWeight)weight color:(NSColor *)color dotColor:(NSColor *)dotColor {
306
307
  if (!self.usesLiquidGlass) {
307
- [text drawInRect:rect withAttributes:[self textAttributesWithSize:size color:color weight:weight]];
308
+ NSMutableDictionary *attributes = [[self textAttributesWithSize:size color:color
309
+ weight:weight] mutableCopy];
310
+ NSMutableParagraphStyle *style = [NSMutableParagraphStyle new];
311
+ style.lineBreakMode = NSLineBreakByTruncatingTail;
312
+ attributes[NSParagraphStyleAttributeName] = style;
313
+ [text drawInRect:rect withAttributes:[self attributes:attributes fittingText:text
314
+ inWidth:NSWidth(rect)]];
308
315
  return;
309
316
  }
310
317
  NSMutableDictionary *attributes = [[self textAttributesWithSize:size color:color
@@ -313,23 +320,43 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
313
320
  style.lineBreakMode = NSLineBreakByTruncatingTail;
314
321
  attributes[NSParagraphStyleAttributeName] = style;
315
322
  NSFont *font = attributes[NSFontAttributeName];
316
- CGFloat diameter = 9;
317
- // drawInRect: 从矩形顶部开始排版,圆点对齐到首行小写字母的中线。
318
- CGFloat baselineMid = NSMaxY(rect) - font.ascender + font.xHeight / 2.0;
319
- [NSGraphicsContext saveGraphicsState];
320
- [[NSShadow new] set];
321
- [dotColor setFill];
322
- [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(rect), baselineMid - diameter / 2.0,
323
- diameter, diameter)] fill];
324
- [NSGraphicsContext restoreGraphicsState];
325
323
  NSRect textRect = rect;
326
- textRect.origin.x += diameter + 6;
327
- textRect.size.width -= diameter + 6;
328
- [text drawInRect:textRect withAttributes:attributes];
324
+ if (dotColor) {
325
+ CGFloat diameter = 9;
326
+ // drawInRect: 从矩形顶部开始排版,圆点对齐到首行小写字母的中线。
327
+ CGFloat baselineMid = NSMaxY(rect) - font.ascender + font.xHeight / 2.0;
328
+ [NSGraphicsContext saveGraphicsState];
329
+ [[NSShadow new] set];
330
+ [dotColor setFill];
331
+ [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(rect), baselineMid - diameter / 2.0,
332
+ diameter, diameter)] fill];
333
+ [NSGraphicsContext restoreGraphicsState];
334
+ textRect.origin.x += diameter + 6;
335
+ textRect.size.width -= diameter + 6;
336
+ }
337
+ [text drawInRect:textRect withAttributes:[self attributes:attributes fittingText:text
338
+ inWidth:NSWidth(textRect)]];
329
339
  }
330
- // 风险提示:原生玻璃下是圆点 + 白字;经典主题照旧画彩色字。
340
+ // 译文长短差得多,固定宽度的格子迟早有放不下的语言。放不下时先把字号往下收,最多收 2pt
341
+ // (liquid 下即从 14 收到 12)——比截成"…"好认;还放不下才交给截断。放得下就原样返回,
342
+ // 中文和多数英文不受影响。
343
+ - (NSDictionary *)attributes:(NSDictionary *)attributes fittingText:(NSString *)text
344
+ inWidth:(CGFloat)width {
345
+ NSFont *font = attributes[NSFontAttributeName];
346
+ if (!font || text.length == 0 || [text sizeWithAttributes:attributes].width <= width) {
347
+ return attributes;
348
+ }
349
+ NSMutableDictionary *fitted = [attributes mutableCopy];
350
+ for (CGFloat size = font.pointSize - 0.5; size >= font.pointSize - 2; size -= 0.5) {
351
+ fitted[NSFontAttributeName] = [NSFont fontWithDescriptor:font.fontDescriptor size:size];
352
+ if ([text sizeWithAttributes:fitted].width <= width) break;
353
+ }
354
+ return fitted;
355
+ }
356
+ // 风险提示只保留文字,和 Max / Now 使用同一条左边界。
331
357
  - (void)drawTip:(NSString *)text inRect:(NSRect)rect color:(NSColor *)color {
332
- [self drawText:text inRect:rect size:11 weight:NSFontWeightMedium color:color dotColor:color];
358
+ if (text.length == 0) return;
359
+ [self drawText:text inRect:rect size:11 weight:NSFontWeightMedium color:color dotColor:nil];
333
360
  }
334
361
  - (void)fillLiquidScrim:(NSBezierPath *)path {
335
362
  [NSGraphicsContext saveGraphicsState];
@@ -488,7 +515,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
488
515
  - (NSDictionary *)paceStatusForQuota:(NSDictionary *)quota currentUsed:(NSNumber *)currentUsed
489
516
  color:(NSColor *)providerColor {
490
517
  if (!currentUsed) {
491
- return @{@"label": @"数据不足", @"tip": @"等待官方额度数据",
518
+ return @{@"label": L(@"Not enough data"), @"tip": L(@"Waiting for data"),
492
519
  @"color": self.secondaryColor};
493
520
  }
494
521
  NSNumber *reset = [quota[@"resets_at"] isKindOfClass:NSNumber.class]
@@ -517,10 +544,10 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
517
544
  // 四个档位从轻到重排成阶梯,后面的仲裁只在这上面挪档位,不再各写一套 label/tip/color。
518
545
  double remaining = 100.0 - currentUsed.doubleValue;
519
546
  NSArray<NSArray *> *ladder = @[
520
- @[@"充足", @"当前额度余量充足", NSColor.systemGreenColor],
521
- @[@"平稳", @"当前额度余量平稳", providerColor],
522
- @[@"需关注", @"建议关注额度余量", NSColor.systemOrangeColor],
523
- @[@"高风险", @"当前额度余量较低", NSColor.systemRedColor]
547
+ @[L(@"Plenty"), CCPetsLanguageIsSource() ? @"" : L(@"Plenty of quota left"), NSColor.systemGreenColor],
548
+ @[L(@"Steady"), CCPetsLanguageIsSource() ? @"" : L(@"Quota is holding steady"), providerColor],
549
+ @[L(@"Watch"), L(@"Watch usage"), NSColor.systemOrangeColor],
550
+ @[L(@"At risk"), L(@"Quota low"), NSColor.systemRedColor]
524
551
  ];
525
552
  NSUInteger baseRank = remaining >= 70 ? 0
526
553
  : (remaining >= 40 ? 1 : (remaining >= 15 ? 2 : 3));
@@ -531,13 +558,13 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
531
558
  if (!isnan(projectedRemaining)) {
532
559
  if (remaining <= 5 || projectedRemaining < 0) {
533
560
  projectedRank = 3;
534
- projectedTip = @"预计重置前额度用尽";
561
+ projectedTip = L(@"Runs out early");
535
562
  } else if (projectedRemaining < 10) {
536
563
  projectedRank = 2;
537
- projectedTip = @"建议减少高消耗任务";
564
+ projectedTip = L(@"Ease off a bit");
538
565
  } else if (projectedRemaining >= 30) {
539
566
  projectedRank = 0;
540
- projectedTip = @"按当前节奏额度充足";
567
+ projectedTip = L(@"Plenty to spare");
541
568
  }
542
569
  }
543
570
 
@@ -555,7 +582,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
555
582
 
556
583
  NSString *label = ladder[rank][0];
557
584
  NSString *tip = ladder[rank][1];
558
- if (demotedByFact) tip = @"消耗偏快,注意节奏";
585
+ if (demotedByFact) tip = L(@"Burning fast");
559
586
  else if (projectedRank >= 0 && rank == (NSUInteger)projectedRank) tip = projectedTip;
560
587
  return @{@"label": label, @"tip": tip, @"color": ladder[rank][2]};
561
588
  }
@@ -627,8 +654,8 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
627
654
  withAttributes:[self textAttributesWithSize:22 color:primary weight:NSFontWeightBold]];
628
655
  // 四态:额度被拒 → 额度受限(百分比仍是上次官方快照);没有任何额度数据 → 等待数据;
629
656
  // 有数据但客户端已退出 → 离线;两者都有 → 在线。
630
- NSString *statusText = (!apiMode && exhausted) ? @"额度受限"
631
- : (!hasData ? @"等待数据" : (online ? @"● 在线" : @"离线"));
657
+ NSString *statusText = (!apiMode && exhausted) ? L(@"Rate limited")
658
+ : (!hasData ? L(@"Waiting for data") : (online ? L(@"● Online") : L(@"Offline")));
632
659
  NSColor *statusColor = (!apiMode && exhausted) ? NSColor.systemOrangeColor
633
660
  : (online && hasData ? NSColor.systemGreenColor : secondary);
634
661
  if (self.usesLiquidGlass) {
@@ -648,12 +675,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
648
675
  if (apiMode) {
649
676
  CGFloat callX = NSMinX(card) + 214;
650
677
  CGFloat tokenX = NSMinX(card) + 394;
651
- [@"本月调用" drawInRect:NSMakeRect(callX, NSMinY(card) + 114, 130, 20)
678
+ [L(@"Calls this month") drawInRect:NSMakeRect(callX, NSMinY(card) + 114, 130, 20)
652
679
  withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
653
- [@"本月消耗" drawInRect:NSMakeRect(tokenX, NSMinY(card) + 114, 130, 20)
680
+ [L(@"Tokens this month") drawInRect:NSMakeRect(tokenX, NSMinY(card) + 114, 130, 20)
654
681
  withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
655
682
 
656
- NSString *requests = [NSString stringWithFormat:@"%@ 次",
683
+ NSString *requests = [NSString stringWithFormat:L(@"%@ calls"),
657
684
  [self formattedRequestCount:monthTokens ?: @{}]];
658
685
  [requests drawInRect:NSMakeRect(callX, NSMinY(card) + 75, 150, 34)
659
686
  withAttributes:[self textAttributesWithSize:24 color:primary weight:NSFontWeightBold]];
@@ -667,20 +694,20 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
667
694
  NSNumber *requestCount = [monthTokens[@"request_count"] isKindOfClass:NSNumber.class]
668
695
  ? monthTokens[@"request_count"] : nil;
669
696
  NSString *average = requestCount
670
- ? [NSString stringWithFormat:@"日均 %@ 次",
697
+ ? [NSString stringWithFormat:L(@"%@/day avg"),
671
698
  [NSNumberFormatter localizedStringFromNumber:
672
699
  @(llround(requestCount.doubleValue / elapsedDays))
673
700
  numberStyle:NSNumberFormatterDecimalStyle]]
674
- : @"日均 --";
701
+ : L(@"--/day avg");
675
702
  [average drawInRect:NSMakeRect(callX, NSMinY(card) + 48, 150, 20)
676
703
  withAttributes:[self textAttributesWithSize:12 color:secondary weight:NSFontWeightRegular]];
677
704
 
678
705
  // 这里不再重复"本月消耗"的合计:输入与输出各自的量级才是按量计费时要看的东西,
679
706
  // 合计随时可以由这两个数得到,而它原先占掉了最显眼的一行。
680
707
  NSArray<NSDictionary *> *splits = @[
681
- @{@"label": @"输入", @"value": [self formattedTokenSplit:monthTokens ?: @{}
708
+ @{@"label": L(@"Input"), @"value": [self formattedTokenSplit:monthTokens ?: @{}
682
709
  wantsOutput:NO], @"y": @(NSMinY(card) + 76)},
683
- @{@"label": @"输出", @"value": [self formattedTokenSplit:monthTokens ?: @{}
710
+ @{@"label": L(@"Output"), @"value": [self formattedTokenSplit:monthTokens ?: @{}
684
711
  wantsOutput:YES], @"y": @(NSMinY(card) + 48)}
685
712
  ];
686
713
  for (NSDictionary *split in splits) {
@@ -709,17 +736,17 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
709
736
  CGFloat trendX = NSMinX(card) + 564;
710
737
  // 「按日 Token」跟在标题后面,与标题同一行:它是标题的限定语,单独占一行既浪费
711
738
  // 竖向空间,也把曲线和脚注挤得没法与左边两列对齐。
712
- [@"本月趋势" drawInRect:NSMakeRect(trendX, NSMinY(card) + 114, 60, 20)
739
+ [L(@"Month") drawInRect:NSMakeRect(trendX, NSMinY(card) + 114, 60, 20)
713
740
  withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
714
741
  if (self.usesLiquidGlass) {
715
- [self drawText:@"按日 Token" inRect:NSMakeRect(trendX + 62, NSMinY(card) + 114, 96, 20)
742
+ [self drawText:L(@"Daily tokens") inRect:NSMakeRect(trendX + 62, NSMinY(card) + 114, 96, 20)
716
743
  size:11 weight:NSFontWeightSemibold color:color dotColor:color];
717
744
  } else {
718
745
  NSDictionary *pillAttributes = [self textAttributesWithSize:11 color:color
719
746
  weight:NSFontWeightSemibold];
720
747
  NSRect pill = NSMakeRect(trendX + 59, NSMinY(card) + 113, 76, 22);
721
748
  [self fillRoundedRect:pill radius:11 color:[color colorWithAlphaComponent:0.14]];
722
- [@"按日 Token" drawInRect:NSInsetRect(pill, 9, 3) withAttributes:pillAttributes];
749
+ [L(@"Daily tokens") drawInRect:NSInsetRect(pill, 9, 3) withAttributes:pillAttributes];
723
750
  }
724
751
  NSRect curveRect = NSMakeRect(trendX, NSMinY(card) + 62, 135, 38);
725
752
  [self drawMonthlyTokenCurve:monthDaily inRect:curveRect color:color];
@@ -733,17 +760,17 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
733
760
  todayTotals = totals;
734
761
  }
735
762
  NSString *peakText = recordedDays > 0
736
- ? [NSString stringWithFormat:@"峰值 %@", [self formattedTokenValue:peak]] : @"峰值 --";
763
+ ? [NSString stringWithFormat:L(@"Peak %@"), [self formattedTokenValue:peak]] : L(@"Peak --");
737
764
  NSString *todayText = todayTotals
738
- ? [NSString stringWithFormat:@"今日 %@",
739
- [self formattedTokenValue:[todayTotals[@"total_tokens"] doubleValue]]] : @"今日 --";
765
+ ? [NSString stringWithFormat:L(@"Today %@"),
766
+ [self formattedTokenValue:[todayTotals[@"total_tokens"] doubleValue]]] : L(@"Today --");
740
767
  [peakText drawInRect:NSMakeRect(trendX, NSMinY(card) + 42, 74, 16)
741
768
  withAttributes:[self textAttributesWithSize:10 color:secondary weight:NSFontWeightRegular]];
742
769
  [todayText drawInRect:NSMakeRect(trendX + 61, NSMinY(card) + 42, 74, 16)
743
770
  withAttributes:[self rightAlignedTextAttributesWithSize:10 color:secondary
744
771
  weight:NSFontWeightRegular]];
745
772
  // 与左边两列的"较上月同期"同一条基线(+22),三列脚注才在一条水平线上。
746
- [[NSString stringWithFormat:@"本月已记录 %lu / %lu 天",
773
+ [[NSString stringWithFormat:L(@"%lu / %lu days recorded"),
747
774
  (unsigned long)recordedDays, (unsigned long)monthDaily.count]
748
775
  drawInRect:NSMakeRect(trendX, NSMinY(card) + 22, 145, 18)
749
776
  withAttributes:[self textAttributesWithSize:11 color:color weight:NSFontWeightMedium]];
@@ -753,12 +780,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
753
780
  // 层级:官方剩余额度是订阅限额的权威值,占主位;本机 Token 是参考量,降一级并用
754
781
  // 强调色区分;重置时间最小。反过来会让最抢眼的数字恰好是最不该照着做决定的那个。
755
782
  NSArray<NSDictionary *> *windows = @[
756
- @{@"x": @(NSMinX(card) + 214), @"title": @"官方 5 小时窗口", @"quota": five ?: @{},
783
+ @{@"x": @(NSMinX(card) + 214), @"title": L(@"5h window"), @"quota": five ?: @{},
757
784
  @"tokens": fiveTokens ?: @{}, @"used": fiveUsed ?: NSNull.null,
758
- @"rolling": @"官方额度待刷新"},
759
- @{@"x": @(NSMinX(card) + 394), @"title": @"官方 7 天窗口", @"quota": week ?: @{},
785
+ @"rolling": L(@"Waiting for refresh")},
786
+ @{@"x": @(NSMinX(card) + 394), @"title": L(@"7d window"), @"quota": week ?: @{},
760
787
  @"tokens": weekTokens ?: @{}, @"used": weekUsed ?: NSNull.null,
761
- @"rolling": @"官方额度待刷新"}
788
+ @"rolling": L(@"Waiting for refresh")}
762
789
  ];
763
790
  for (NSDictionary *window in windows) {
764
791
  CGFloat x = [window[@"x"] doubleValue];
@@ -777,7 +804,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
777
804
  withAttributes:valueAttributes];
778
805
  // 没有数字可标时不给口径标签:"-- 剩余"看起来像一个真实的 0 值,而实际上是
779
806
  // 官方快照待刷新。下方的状态文字会说明它为何不可用。
780
- NSString *valueLabel = !used ? @"" : (exhausted ? @"快照" : @"剩余");
807
+ NSString *valueLabel = !used ? @"" : (exhausted ? L(@"Snapshot") : L(@"Left"));
781
808
  if (valueLabel.length > 0) {
782
809
  [valueLabel drawInRect:NSMakeRect(x + valueWidth + 7, NSMinY(card) + 78, 60, 20)
783
810
  withAttributes:[self textAttributesWithSize:12 color:secondary
@@ -787,13 +814,13 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
787
814
  // 说清楚这一行的口径,比留一个 `--` 让人以为是渲染坏了要好。
788
815
  NSString *resetValue = [self resetText:window[@"quota"]];
789
816
  NSString *reset = [resetValue isEqualToString:@"--"]
790
- ? window[@"rolling"] : [NSString stringWithFormat:@"重置时间 %@", resetValue];
817
+ ? window[@"rolling"] : [NSString stringWithFormat:L(@"Resets %@"), resetValue];
791
818
  [reset drawInRect:NSMakeRect(x, NSMinY(card) + 46, 150, 18)
792
819
  withAttributes:[self textAttributesWithSize:11 color:secondary weight:NSFontWeightRegular]];
793
820
  // 原生玻璃下字更大、前面还有圆点,这一栏放不下"Token"一词;脚注里已说明
794
821
  // Token 即本机统计的已用量。
795
822
  NSString *tokenText = [NSString stringWithFormat:
796
- self.usesLiquidGlass ? @"已用 %@" : @"已用 Token %@",
823
+ self.usesLiquidGlass ? L(@"Used %@") : L(@"Used tokens %@"),
797
824
  [self formattedTokenCount:window[@"tokens"]]];
798
825
  [self drawText:tokenText inRect:NSMakeRect(x, NSMinY(card) + 22, 150, 22) size:14
799
826
  weight:NSFontWeightSemibold color:color dotColor:color];
@@ -801,7 +828,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
801
828
 
802
829
  CGFloat trendX = NSMinX(card) + 564;
803
830
  // 与 API 卡同一套骨架:标题行带 pill、中间曲线、脚注和左边两列齐平。
804
- [@"使用趋势" drawInRect:NSMakeRect(trendX, NSMinY(card) + 114, 60, 20)
831
+ [L(@"Trend") drawInRect:NSMakeRect(trendX, NSMinY(card) + 114, 60, 20)
805
832
  withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
806
833
  NSArray<NSDictionary *> *history = [name isEqualToString:@"Codex"]
807
834
  ? self.codexHistory : self.claudeHistory;
@@ -813,7 +840,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
813
840
  // 矛盾。所以只有 7 天窗口自己确实没有百分比时才退回"待刷新"。
814
841
  BOOL weekUnknown = exhausted && currentUsed == nil;
815
842
  NSDictionary *pace = weekUnknown
816
- ? @{ @"label": @"待刷新", @"tip": @"等待官方额度刷新",
843
+ ? @{ @"label": L(@"Stale"), @"tip": L(@"Awaiting refresh"),
817
844
  @"color": NSColor.systemOrangeColor }
818
845
  : [self paceStatusForQuota:week currentUsed:currentUsed color:color];
819
846
  NSColor *paceColor = pace[@"color"];
@@ -822,7 +849,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
822
849
  NSString *paceTip = pace[@"tip"];
823
850
  NSColor *tipColor = paceColor;
824
851
  if (exhausted && !weekUnknown) {
825
- paceTip = @"官方额度受限,等待重置";
852
+ paceTip = L(@"Limited until reset");
826
853
  tipColor = NSColor.systemOrangeColor;
827
854
  }
828
855
  if (self.usesLiquidGlass) {
@@ -844,16 +871,17 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
844
871
  double peak = 0;
845
872
  for (NSDictionary *point in points) peak = fmax(peak, [point[@"used"] doubleValue]);
846
873
  NSString *peakText = points.count > 0
847
- ? [NSString stringWithFormat:@"最高 %.0f%%", peak] : @"最高 --";
874
+ ? [NSString stringWithFormat:L(@"Max %.0f%%"), peak] : L(@"Max --");
848
875
  NSString *currentText = currentUsed
849
- ? [NSString stringWithFormat:@"当前 %.0f%%", currentUsed.doubleValue] : @"当前 --";
850
- [peakText drawInRect:NSMakeRect(trendX, NSMinY(card) + 42, 72, 16)
876
+ ? [NSString stringWithFormat:L(@"Now %.0f%%"), currentUsed.doubleValue] : L(@"Now --");
877
+ [peakText drawInRect:NSMakeRect(trendX, NSMinY(card) + 42 - 2 / QuotaScale, 72, 16)
851
878
  withAttributes:[self textAttributesWithSize:10 color:secondary weight:NSFontWeightRegular]];
852
- [currentText drawInRect:NSMakeRect(trendX + 66, NSMinY(card) + 42, 69, 16)
879
+ [currentText drawInRect:NSMakeRect(trendX + 66, NSMinY(card) + 42 - 2 / QuotaScale, 69, 16)
853
880
  withAttributes:[self rightAlignedTextAttributesWithSize:10 color:secondary
854
881
  weight:NSFontWeightRegular]];
855
882
  // 与左边两列的"已用 Token"同一条基线(+22),也和 API 卡的脚注行对齐。
856
- [self drawTip:paceTip inRect:NSMakeRect(trendX, NSMinY(card) + 22, 145, 18) color:tipColor];
883
+ [self drawTip:paceTip inRect:NSMakeRect(trendX, NSMinY(card) + 22 - 2 / QuotaScale,
884
+ 145, 18) color:tipColor];
857
885
  }
858
886
  - (void)drawRect:(NSRect)dirtyRect {
859
887
  [NSGraphicsContext saveGraphicsState];
@@ -923,20 +951,25 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
923
951
  NSColor *agentColor = self.agentStatusColor;
924
952
  [@"Agent Usage" drawInRect:NSMakeRect(28, height - 65, 260, 42)
925
953
  withAttributes:[self textAttributesWithSize:30 color:primary weight:NSFontWeightBold]];
926
- [@"实时状态与滚动用量" drawInRect:NSMakeRect(30, height - 94, self.usesLiquidGlass ? 142 : 130, 22)
927
- withAttributes:[self textAttributesWithSize:14 color:secondary weight:NSFontWeightRegular]];
954
+ NSDictionary *liveStatusAttributes = [self textAttributesWithSize:14 color:secondary
955
+ weight:NSFontWeightRegular];
956
+ NSString *liveStatusText = L(@"Live status");
957
+ [liveStatusText drawInRect:NSMakeRect(30, height - 94, self.usesLiquidGlass ? 142 : 130, 22)
958
+ withAttributes:liveStatusAttributes];
959
+ CGFloat agentIndicatorX = 30 + [liveStatusText sizeWithAttributes:liveStatusAttributes].width + 12;
928
960
  [agentColor setFill];
929
- [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(174, height - 88, 9, 9)] fill];
961
+ [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(agentIndicatorX, height - 88, 9, 9)] fill];
930
962
  NSString *agentText = self.activeAgentCount > 0
931
- ? [NSString stringWithFormat:@"%ld 个 Agent 在线", (long)self.activeAgentCount]
932
- : @"暂无 Agent 在线";
933
- [agentText drawInRect:NSMakeRect(190, height - 95, 160, 22)
963
+ ? [NSString stringWithFormat:self.activeAgentCount != 1 ? L(@"%ld Agents online")
964
+ : L(@"%ld Agent online"), (long)self.activeAgentCount]
965
+ : L(@"No Agents online");
966
+ [agentText drawInRect:NSMakeRect(agentIndicatorX + 16, height - 95, 160, 22)
934
967
  withAttributes:[self textAttributesWithSize:14 color:agentColor weight:NSFontWeightMedium]];
935
968
  [self drawSystemMetricsEndingAtX:QuotaLogicalWidth - 28 y:height - 95];
936
969
 
937
970
  // 用量由定时器自动刷新,面板不再提供手动刷新按钮;右上角只留上次刷新的时间,
938
971
  // 与下一行的系统指标右边对齐。放回汇总条里会挤掉一整格 Provider 数据。
939
- [[NSString stringWithFormat:@"数据刷新 %@", [self refreshAgeText]]
972
+ [[NSString stringWithFormat:L(@"Updated %@"), [self refreshAgeText]]
940
973
  drawInRect:NSMakeRect(QuotaLogicalWidth - 28 - 200, height - 45, 200, 18)
941
974
  withAttributes:[self rightAlignedTextAttributesWithSize:11 color:secondary
942
975
  weight:NSFontWeightRegular]];
@@ -970,12 +1003,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
970
1003
  // 解决的是另一件事——Agent 动画,以及 Claude 额度(statusline 是它唯一的来源)。
971
1004
  // 把两者写成一句会让人以为不执行 install 卡片就不出现。
972
1005
  CGFloat noticeTop = height - QuotaHeaderHeight;
973
- [@"未检测到 Codex / Claude Code CLI" drawInRect:NSMakeRect(28, noticeTop - 30, 460, 26)
1006
+ [L(@"No Codex / Claude Code CLI detected") drawInRect:NSMakeRect(28, noticeTop - 30, 460, 26)
974
1007
  withAttributes:[self textAttributesWithSize:17 color:primary weight:NSFontWeightMedium]];
975
- [@"安装 Codex 或 Claude Code 后,额度卡会自动出现"
1008
+ [L(@"Quota cards appear once Codex or Claude Code is installed")
976
1009
  drawInRect:NSMakeRect(28, noticeTop - 52, 560, 20)
977
1010
  withAttributes:[self textAttributesWithSize:12 color:secondary weight:NSFontWeightRegular]];
978
- [@"重新执行 cc-pets install 可启用 Agent 动画与 Claude 额度采集"
1011
+ [L(@"Run cc-pets install again to enable Agent animations and Claude quota tracking")
979
1012
  drawInRect:NSMakeRect(28, noticeTop - 72, 560, 18)
980
1013
  withAttributes:[self textAttributesWithSize:11
981
1014
  color:[NSColor colorWithWhite:0.52 alpha:1] weight:NSFontWeightRegular]];
@@ -983,12 +1016,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
983
1016
  BOOL hasAPICard = ([visibleProviders containsObject:@"Codex"] && self.codexShowsAPIUsage) ||
984
1017
  ([visibleProviders containsObject:@"Claude"] && self.claudeShowsAPIUsage);
985
1018
  NSString *footer = visibleProviders.count == 0
986
- ? @"ⓘ 桌宠与系统状态不受影响;额度卡只在检测到对应 CLI 时显示"
1019
+ ? L(@"ⓘ The pet and system status still work; quota cards only show for detected CLIs")
987
1020
  : (hasAPICard
988
- ? @"ⓘ API 用量 = 本机会话统计(输入含缓存读写);环比按上月相同时间进度计算"
989
- : (self.usesLiquidGlass
990
- ? @"ⓘ 百分比 = 官方额度剩余;Token = 本机统计已用量(含缓存读写)"
991
- : @"ⓘ 百分比 = 官方订阅额度的剩余比例;Token = 本机统计的已用量(输入含缓存读写),两者口径不同"));
1021
+ ? L(@"ⓘ API usage = local session stats (input includes cache reads/writes); compared with the same point last month")
1022
+ : (self.usesLiquidGlass || CCPetsLanguageIsSource()
1023
+ ? L(@"ⓘ % = official quota left; tokens = local usage (incl. cache reads/writes)")
1024
+ : L(@"ⓘ % = share of official plan quota left; tokens = locally counted usage (input incl. cache reads/writes). They measure different things")));
992
1025
  // 最后一块的底边距面板底 QuotaFooterHeight:脚注与其留约 8pt,底部留白 16pt,
993
1026
  // 和顶部标题的留白大致对称。
994
1027
  [footer drawInRect:NSMakeRect(28, 16, 650, 20)
@@ -1017,7 +1050,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
1017
1050
 
1018
1051
  NSArray<NSDictionary *> *cells = @[
1019
1052
  @{@"icon": @"◔", @"headerSymbol": @"calendar", @"key": @"today",
1020
- @"label": @"今日用量"},
1053
+ @"label": L(@"Today")},
1021
1054
  @{@"icon": @"◉", @"headerSymbol": @"calendar.badge.clock", @"key": @"recentWeek",
1022
1055
  @"label": [self recentWeekUsageLabel]}
1023
1056
  ];
@@ -1055,6 +1088,9 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
1055
1088
  NSFont *headerFont = [self fontWithSize:11 weight:NSFontWeightRegular];
1056
1089
  NSDictionary *headerAttributes = @{NSFontAttributeName: headerFont,
1057
1090
  NSForegroundColorAttributeName: [self textColor:secondary]};
1091
+ NSDictionary *titleAttributes = @{NSFontAttributeName:
1092
+ [self fontWithSize:11 weight:NSFontWeightBold],
1093
+ NSForegroundColorAttributeName: [self textColor:secondary]};
1058
1094
  NSImage *headerIcon = [NSImage imageWithSystemSymbolName:cell[@"headerSymbol"]
1059
1095
  accessibilityDescription:cell[@"label"]];
1060
1096
  NSImageSymbolConfiguration *headerIconConfiguration =
@@ -1074,7 +1110,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
1074
1110
  [header appendAttributedString:[[NSAttributedString alloc]
1075
1111
  initWithString:@" " attributes:headerAttributes]];
1076
1112
  [header appendAttributedString:[[NSAttributedString alloc]
1077
- initWithString:cell[@"label"] attributes:headerAttributes]];
1113
+ initWithString:cell[@"label"] attributes:titleAttributes]];
1078
1114
  [header drawInRect:NSMakeRect(x + 24, NSMinY(summary) + 89,
1079
1115
  NSWidth([self logicalSummaryCellRectAtIndex:index]) - 48, 18)];
1080
1116
  for (NSDictionary *row in rows) {
@@ -1083,6 +1119,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
1083
1119
  CGFloat iconY = NSMinY(summary) + [row[@"iconY"] doubleValue];
1084
1120
  CGFloat nameY = NSMinY(summary) + [row[@"nameY"] doubleValue];
1085
1121
  CGFloat labelY = NSMinY(summary) + [row[@"labelY"] doubleValue];
1122
+ if (CCPetsLanguageIsSource()) labelY += 2 / QuotaScale;
1086
1123
  CGFloat valueY = NSMinY(summary) + [row[@"valueY"] doubleValue];
1087
1124
  // 这是图标字形不是文字,原生玻璃下也保留颜色:它负责标出这一行是哪一家。
1088
1125
  [cell[@"icon"] drawInRect:NSMakeRect(x + 20, iconY, 42, 42)
@@ -1091,9 +1128,9 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
1091
1128
  [row[@"name"] drawInRect:NSMakeRect(x + 66, nameY, 76, 22)
1092
1129
  withAttributes:[self textAttributesWithSize:14 color:rowColor
1093
1130
  weight:NSFontWeightMedium]];
1094
- [@"输入" drawInRect:NSMakeRect(inputX, labelY, 76, 16)
1131
+ [L(@"Input") drawInRect:NSMakeRect(inputX, labelY, 76, 16)
1095
1132
  withAttributes:headerAttributes];
1096
- [@"输出" drawInRect:NSMakeRect(outputX, labelY, 76, 16)
1133
+ [L(@"Output") drawInRect:NSMakeRect(outputX, labelY, 76, 16)
1097
1134
  withAttributes:headerAttributes];
1098
1135
  NSDictionary *valueAttributes = [self textAttributesWithSize:16 color:primary
1099
1136
  weight:NSFontWeightBold];
@@ -1,3 +1,4 @@
1
+ #import "CCPetsL10n.h"
1
2
  #import <Cocoa/Cocoa.h>
2
3
  #import "CCPetsAppDelegate.h"
3
4
  #import "CCPetsEvents.h"
@@ -109,7 +110,8 @@ int main(int argc, const char *argv[]) {
109
110
  if (strcmp(argv[index], launchFlags[flag]) == 0) known = YES;
110
111
  }
111
112
  if (known) continue;
112
- fprintf(stderr, "未知参数:%s\n运行 cc-pets --help 查看用法。\n", argv[index]);
113
+ fprintf(stderr, "%s\n", [NSString stringWithFormat:L(@"Unknown argument: %@\nRun cc-pets --help for usage."),
114
+ @(argv[index])].UTF8String);
113
115
  return 2;
114
116
  }
115
117
 
package/bin/cc-pets CHANGED
@@ -6,32 +6,31 @@ PROJECT_DIR="${SCRIPT_DIR:h}"
6
6
  PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
7
7
  BUILD_APP="${PROJECT_DIR}/.build/release/CC Pets.app"
8
8
  INSTALLED_APP="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}/CC Pets.app"
9
+ source "${PROJECT_DIR}/scripts/i18n.zsh"
9
10
 
10
11
  # 只列面向用户的命令。--hook / --claude-usage / --provider-event / --render-* 等是
11
12
  # hooks、statusline 和测试调用的内部入口,列出来只会让人误用。
12
13
  print_usage() {
13
- cat <<'USAGE'
14
- 用法:cc-pets [命令]
15
-
16
- cc-pets 启动桌宠(优先使用 ~/Applications 里安装的版本)
17
- cc-pets install 安装或修复 shell / Claude Code / Codex 集成
18
- cc-pets uninstall 移除集成并恢复 status line
19
- cc-pets uninstall --purge 同时删除 App、应用数据和偏好(会先确认;保留 ~/.cc-pets 的素材与台词)
20
- cc-pets uninstall-app 只删除 ~/Applications/CC Pets.app
21
- cc-pets build 重新构建
22
- cc-pets clean 清理缓存(需先退出桌宠)
23
- cc-pets doctor 检查安装与各项集成是否正常,并给出修复建议
24
- cc-pets paths [--json] 列出配置、缓存与数据的存放位置和大小
25
- cc-pets pet <命令> 管理桌宠素材,详见 cc-pets pet help
26
- cc-pets bridge <命令> CC Bridge 跨会话消息,详见 cc-pets bridge --help
27
- cc-pets --status 输出 Codex 当前额度
28
- cc-pets --history 输出额度历史(JSON)
29
- cc-pets --foreground 在前台运行桌宠(调试用)
30
- cc-pets -v, --version 显示版本
31
- cc-pets -h, --help 显示本帮助
32
-
33
- codex-with-pet / claude-with-pet 会在启动 CLI 的同时拉起桌宠。
34
- USAGE
14
+ print -r -- "$(cc_pets_t "Usage: cc-pets [command]
15
+
16
+ cc-pets Start the pet (prefers the copy installed in ~/Applications)
17
+ cc-pets install Install or repair the shell / Claude Code / Codex integrations
18
+ cc-pets uninstall Remove the integrations and restore the status line
19
+ cc-pets uninstall --purge Also delete the app, app data and preferences (asks first; keeps pets and lines in ~/.cc-pets)
20
+ cc-pets uninstall-app Only delete ~/Applications/CC Pets.app
21
+ cc-pets build Rebuild
22
+ cc-pets clean Clear caches (quit the pet first)
23
+ cc-pets doctor Check the installation and integrations, with suggested fixes
24
+ cc-pets paths [--json] List where settings, caches and data live, and their sizes
25
+ cc-pets pet <command> Manage pet sprites; see cc-pets pet help
26
+ cc-pets bridge <command> CC Bridge cross-session messaging; see cc-pets bridge --help
27
+ cc-pets --status Print the current Codex quota
28
+ cc-pets --history Print quota history (JSON)
29
+ cc-pets --foreground Run the pet in the foreground (for debugging)
30
+ cc-pets -v, --version Show the version
31
+ cc-pets -h, --help Show this help
32
+
33
+ codex-with-pet / claude-with-pet start the pet along with the CLI.")"
35
34
  }
36
35
 
37
36
  if [[ "${1:-}" == "--help" || "${1:-}" == "-h" || "${1:-}" == "help" ]]; then
@@ -3,6 +3,7 @@ set -eu
3
3
 
4
4
  SCRIPT_DIR="${0:A:h}"
5
5
  PROJECT_DIR="${SCRIPT_DIR:h}"
6
+ source "${PROJECT_DIR}/scripts/i18n.zsh"
6
7
  PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
7
8
  BUILD_APP="${PROJECT_DIR}/.build/release/CC Pets.app"
8
9
  INSTALLED_APP="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}/CC Pets.app"
@@ -28,7 +29,7 @@ if [[ -z "${REAL_CLAUDE}" ]]; then
28
29
  done
29
30
  fi
30
31
  if [[ -z "${REAL_CLAUDE}" || ! -x "${REAL_CLAUDE}" ]]; then
31
- print -u2 "未找到可执行的 Claude Code CLI。请先安装 claude,或通过 CLAUDE_REAL_BIN 指定真实路径。"
32
+ print -u2 "$(cc_pets_t "No executable Claude Code CLI found. Install claude, or set CLAUDE_REAL_BIN to its real path.")"
32
33
  exit 127
33
34
  fi
34
35
 
@@ -3,6 +3,7 @@ set -eu
3
3
 
4
4
  SCRIPT_DIR="${0:A:h}"
5
5
  PROJECT_DIR="${SCRIPT_DIR:h}"
6
+ source "${PROJECT_DIR}/scripts/i18n.zsh"
6
7
  PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
7
8
  BUILD_APP="${PROJECT_DIR}/.build/release/CC Pets.app"
8
9
  INSTALLED_APP="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}/CC Pets.app"
@@ -26,7 +27,7 @@ if [[ -z "${REAL_CODEX}" ]]; then
26
27
  done
27
28
  fi
28
29
  if [[ -z "${REAL_CODEX}" || ! -x "${REAL_CODEX}" ]]; then
29
- print -u2 "未找到可执行的 Codex CLI。请先安装 codex,或通过 CODEX_REAL_BIN 指定真实路径。"
30
+ print -u2 "$(cc_pets_t "No executable Codex CLI found. Install codex, or set CODEX_REAL_BIN to its real path.")"
30
31
  exit 127
31
32
  fi
32
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-pets",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "A native macOS desktop pet for Codex CLI and Claude Code",
5
5
  "author": {
6
6
  "name": "Sunnyshiny",
@@ -34,7 +34,8 @@
34
34
  "scripts",
35
35
  "Resources/Info.plist",
36
36
  "Resources/AppIcon.icns",
37
- "Resources/phrases.default.txt",
37
+ "Resources/phrases.default.*.txt",
38
+ "Resources/*.lproj/*",
38
39
  "Sources/CCPets",
39
40
  "README.md",
40
41
  "README.zh-CN.md",