Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/src/i18n/__tests__/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ describe('i18n configuration', () => {
expect(i18n.t('podChat.header.compactMetaAccessible', { lng: 'zh-CN', members, agents })).toBe('1名成员,1个智能体');
});

it('uses the singular agent count in the Your Team header', () => {
const meta = (lng: string, count: number) => i18n.t('yourTeam.head.meta', {
lng, count, agents: count, working: 0, needsYou: 0,
});
expect(meta('en', 0)).toBe('0 agents · 0 working · 0 needs you');
expect(meta('en', 1)).toBe('1 agent · 0 working · 0 needs you');
expect(meta('en', 2)).toBe('2 agents · 0 working · 0 needs you');
expect(meta('zh-CN', 1)).toBe('1个智能体 · 0个工作中 · 0个等你');
});

it('defaults to English when no stored supported language exists', async () => {
const languages = jest.spyOn(window.navigator, 'languages', 'get').mockReturnValue(['en-US']);
const language = jest.spyOn(window.navigator, 'language', 'get').mockReturnValue('en-US');
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/i18n/__tests__/zhNumberUnitSpacing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import path from 'path';
// 159 further spaces were closed across 103 values.
//
// Which placeholders count as numerals is the load-bearing question, and it CANNOT
// be decided from this catalog: ``{{agents}}`` is a count in `yourTeam.head.meta`
// be decided from this catalog: ``{{agents}}`` is a count in `yourTeam.head.meta_other`
// and a name list joined with ' and ' in `inspector.workspace.nothingWorking_other`.
// A first cut of the sweep declared `agents` a numeral by name and closed
// 「Scout 可以使用」 in the Tools panel; `V2ConnectorTools.test.tsx` caught it. So the
Expand Down Expand Up @@ -48,7 +48,7 @@ const OPAQUE_PLACEHOLDERS = [
// The exception runs the safe way: a name that is usually opaque and is a number
// here, named by key. `agents` is a count in yourTeam.head.meta (counts.agents) and
// a name list in the inspector, so it cannot be declared for the catalog as a whole.
const NUMERAL_BY_KEY: Array<[string, string]> = [['yourTeam.head.meta', 'agents']];
const NUMERAL_BY_KEY: Array<[string, string]> = [['yourTeam.head.meta_other', 'agents']];

// A digit is this rule's numeral only when it stands alone, and that is a question
// about the TOKEN the digit sits inside, so it has two halves. `Apache-2.0 许可` and
Expand Down Expand Up @@ -236,7 +236,7 @@ describe('zh-CN number and unit spacing', () => {
expect(found('podChat.thread.moreReplies', '还有 {{count}} 项')).toBe(2);
expect(found('agentProfile.pods.activeAgo', '活跃于 {{time}}')).toBe(0);
expect(found('inspector.workspace.nothingWorking_other', '没有需要你处理的事项。{{agents}} 正在工作。')).toBe(0);
expect(found('yourTeam.head.meta', '{{agents}} 个智能体 · {{working}} 个工作中')).toBe(2);
expect(found('yourTeam.head.meta_other', '{{agents}} 个智能体 · {{working}} 个工作中')).toBe(2);
expect(found('landing.footer.copyright', '代码采用 Apache-2.0 许可')).toBe(0);
expect(found('adminAnalytics.funnel.table.returnedD1', 'D1 回访')).toBe(0);
// The trailing half of the same rule, and the value it was found on: `KB` is a
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,8 @@
"activeMeta_other": "Active {{time}} · {{count}} pods"
},
"head": {
"meta": "{{agents}} agents · {{working}} working · {{needsYou}} needs you"
"meta_one": "{{count}} agent · {{working}} working · {{needsYou}} needs you",
"meta_other": "{{count}} agents · {{working}} working · {{needsYou}} needs you"
},
"own": {
"title": "Your own agent",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@
"activeMeta_other": "活跃于{{time}} · {{count}}个 Pod"
},
"head": {
"meta": "{{agents}}个智能体 · {{working}}个工作中 · {{needsYou}}个等你"
"meta_other": "{{agents}}个智能体 · {{working}}个工作中 · {{needsYou}}个等你"
},
"own": {
"title": "你自己的智能体",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/v2/components/V2YourTeamPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ const V2YourTeamPage: React.FC = () => {
<span className="v2-team__meta">
{loading
? t('yourTeam.loading')
: t('yourTeam.head.meta', { agents: counts.agents, working: counts.working, needsYou: counts.needsYou })}
: t('yourTeam.head.meta', { count: counts.agents, agents: counts.agents, working: counts.working, needsYou: counts.needsYou })}
</span>
</div>
<div className="v2-team__actions">
Expand Down
Loading