fix(cua): localize complete permission instructions
This commit is contained in:
1 parent
a86170da75
commit
2d16099200
3 files changed
+10
-12
No files matched your search
@@ -80,15 +80,16 @@ function PermissionDescription({ application, permission, loading, t }: Pick<Per
|
||||
loading: boolean
|
||||
}) {
|
||||
if (!loading && application === undefined) return <p>{t(permission === 'accessibility' ? 'accessibilityUse' : 'screenRecordingUse')}</p>
|
||||
const [before, after] = t(permission === 'accessibility' ? 'accessibilityPermission' : 'screenRecordingPermission').split('{application}')
|
||||
return <p>
|
||||
{t('permissionPrefix')}{' '}
|
||||
{before}
|
||||
<span className={css.applicationBadge}>
|
||||
{application === undefined ? <span className={css.appPlaceholder} aria-hidden /> : <>
|
||||
{application.icon !== undefined && <img src={application.icon} alt="" width={20} height={20} draggable={false} />}
|
||||
<span>{application.name}</span>
|
||||
</>}
|
||||
</span>{' '}
|
||||
{t(permission === 'accessibility' ? 'accessibilityAction' : 'screenRecordingAction')}
|
||||
</span>
|
||||
{after}
|
||||
</p>
|
||||
}
|
||||
|
||||
|
||||
@@ -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<CuaPermissionLocaleKey, string> = {
|
||||
openSetup: '前往设置', later: '稍后', close: '关闭',
|
||||
accessibility: '辅助功能', screenRecording: '屏幕录制',
|
||||
accessibilityUse: '读取界面控件、点击和输入文字', screenRecordingUse: '截取所选应用的窗口',
|
||||
permissionPrefix: '在系统设置中允许',
|
||||
accessibilityAction: '读取界面、点击和输入',
|
||||
screenRecordingAction: '截取应用窗口',
|
||||
accessibilityPermission: '在系统设置中允许 {application} 读取界面、点击和输入。',
|
||||
screenRecordingPermission: '在系统设置中允许 {application} 截取应用窗口。',
|
||||
permissionHint: '在系统设置中开启对应应用;若 macOS 提示其他应用,以系统提示为准',
|
||||
permissionHintUnknown: '在系统设置中,为 macOS 提示的应用开启对应权限',
|
||||
granted: '已允许', missing: '未允许', unknown: '未确认', request: '申请权限', settings: '打开系统设置', retry: '重试',
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user