diff --git a/packages/experimental/client-ui-cua/src/client/PermissionPanel.tsx b/packages/experimental/client-ui-cua/src/client/PermissionPanel.tsx index b80edfee6c..faa83a783d 100644 --- a/packages/experimental/client-ui-cua/src/client/PermissionPanel.tsx +++ b/packages/experimental/client-ui-cua/src/client/PermissionPanel.tsx @@ -80,15 +80,16 @@ function PermissionDescription({ application, permission, loading, t }: Pick{t(permission === 'accessibility' ? 'accessibilityUse' : 'screenRecordingUse')}

+ const [before, after] = t(permission === 'accessibility' ? 'accessibilityPermission' : 'screenRecordingPermission').split('{application}') return

- {t('permissionPrefix')}{' '} + {before} {application === undefined ? : <> {application.icon !== undefined && } {application.name} } - {' '} - {t(permission === 'accessibility' ? 'accessibilityAction' : 'screenRecordingAction')} + + {after}

} diff --git a/packages/experimental/client-ui-cua/src/client/locales.ts b/packages/experimental/client-ui-cua/src/client/locales.ts index 03e86f33d0..52f286700e 100644 --- a/packages/experimental/client-ui-cua/src/client/locales.ts +++ b/packages/experimental/client-ui-cua/src/client/locales.ts @@ -17,9 +17,8 @@ export const en = { openSetup: 'Open settings', later: 'Later', close: 'Close', accessibility: 'Accessibility', screenRecording: 'Screen Recording', accessibilityUse: 'Read interface controls, click, and type.', screenRecordingUse: 'Capture the selected application window.', - permissionPrefix: 'In System Settings, allow', - accessibilityAction: 'to read interface controls, click, and type.', - screenRecordingAction: 'to capture application windows.', + accessibilityPermission: 'In System Settings, allow {application} to read interface controls, click, and type.', + screenRecordingPermission: 'In System Settings, allow {application} to capture application windows.', permissionHint: 'Enable the application in System Settings. Follow the macOS prompt if it names another application.', permissionHintUnknown: 'Enable these permissions for the application named in the macOS prompt.', granted: 'Allowed', missing: 'Not allowed', unknown: 'Unknown', request: 'Request permission', settings: 'Open System Settings', retry: 'Retry', @@ -48,9 +47,8 @@ export const zh: Record = { openSetup: '前往设置', later: '稍后', close: '关闭', accessibility: '辅助功能', screenRecording: '屏幕录制', accessibilityUse: '读取界面控件、点击和输入文字', screenRecordingUse: '截取所选应用的窗口', - permissionPrefix: '在系统设置中允许', - accessibilityAction: '读取界面、点击和输入', - screenRecordingAction: '截取应用窗口', + accessibilityPermission: '在系统设置中允许 {application} 读取界面、点击和输入。', + screenRecordingPermission: '在系统设置中允许 {application} 截取应用窗口。', permissionHint: '在系统设置中开启对应应用;若 macOS 提示其他应用,以系统提示为准', permissionHintUnknown: '在系统设置中,为 macOS 提示的应用开启对应权限', granted: '已允许', missing: '未允许', unknown: '未确认', request: '申请权限', settings: '打开系统设置', retry: '重试', diff --git a/packages/experimental/client-ui-cua/tests/panel.client.spec.tsx b/packages/experimental/client-ui-cua/tests/panel.client.spec.tsx index 5f21465344..e29768cdf9 100644 --- a/packages/experimental/client-ui-cua/tests/panel.client.spec.tsx +++ b/packages/experimental/client-ui-cua/tests/panel.client.spec.tsx @@ -229,13 +229,12 @@ it.each([en, zh])('shows three requirements with the target application beside e expect(within(requirements).getAllByRole('group')).toHaveLength(3) expect(screen.getByRole('region', { name: dictionary.applicationsTitle })).toBeTruthy() const accessibility = within(requirements).getByRole('group', { name: dictionary.accessibility }) - expect(accessibility.textContent).toContain(dictionary.permissionPrefix) expect(within(accessibility).getByText(application.name)).toBeTruthy() - expect(accessibility.textContent).toContain(dictionary.accessibilityAction) + expect(accessibility.textContent).toContain(dictionary.accessibilityPermission.replace('{application}', application.name)) expect(accessibility.querySelector('img')?.getAttribute('src')).toBe(application.icon) const recording = within(requirements).getByRole('group', { name: dictionary.screenRecording }) expect(within(recording).getByText(application.name)).toBeTruthy() - expect(recording.textContent).toContain(dictionary.screenRecordingAction) + expect(recording.textContent).toContain(dictionary.screenRecordingPermission.replace('{application}', application.name)) expect(within(requirements).getByText(dictionary.permissionHint)).toBeTruthy() f.publish({ system: { ...f.state.getSnapshot().system, error: 'offline' } }) expect(screen.queryByText(application.name)).toBeNull()