mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-24 12:26:07 +00:00
fix(i18n): harden unstable dialog and complete cursor locale key
This commit is contained in:
@@ -51,7 +51,7 @@ import {
|
|||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||||
import { useQuery, useIsMutating } from '@tanstack/react-query';
|
import { useQuery, useIsMutating } from '@tanstack/react-query';
|
||||||
import { api, type CliproxyServerConfig } from '@/lib/api-client';
|
import { api, type CliproxyServerConfig } from '@/lib/api-client';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
import {
|
import {
|
||||||
useProxyStatus,
|
useProxyStatus,
|
||||||
useStartProxy,
|
useStartProxy,
|
||||||
@@ -545,14 +545,16 @@ export function ProxyStatusWidget() {
|
|||||||
{t('proxyStatusWidget.installUnstableTitle')}
|
{t('proxyStatusWidget.installUnstableTitle')}
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
<AlertDialogDescription className="space-y-2">
|
<AlertDialogDescription className="space-y-2">
|
||||||
<p
|
<p>
|
||||||
dangerouslySetInnerHTML={{
|
<Trans
|
||||||
__html: t('proxyStatusWidget.installUnstableDesc', {
|
i18nKey="proxyStatusWidget.installUnstableDesc"
|
||||||
|
values={{
|
||||||
version: pendingInstallVersion ?? '',
|
version: pendingInstallVersion ?? '',
|
||||||
maxStable: versionsData?.maxStableVersion || '6.6.80',
|
maxStable: versionsData?.maxStableVersion || '6.6.80',
|
||||||
}),
|
}}
|
||||||
}}
|
components={{ strong: <strong /> }}
|
||||||
/>
|
/>
|
||||||
|
</p>
|
||||||
<p className="text-amber-600 dark:text-amber-400">
|
<p className="text-amber-600 dark:text-amber-400">
|
||||||
{t('proxyStatusWidget.installUnstableWarning')}
|
{t('proxyStatusWidget.installUnstableWarning')}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -965,6 +965,7 @@ const resources = {
|
|||||||
enabled: 'Enabled',
|
enabled: 'Enabled',
|
||||||
disabled: 'Disabled',
|
disabled: 'Disabled',
|
||||||
expired: 'Expired',
|
expired: 'Expired',
|
||||||
|
connected: 'Connected',
|
||||||
notConnected: 'Not connected',
|
notConnected: 'Not connected',
|
||||||
running: 'Running',
|
running: 'Running',
|
||||||
stopped: 'Stopped',
|
stopped: 'Stopped',
|
||||||
@@ -2055,6 +2056,7 @@ const resources = {
|
|||||||
enabled: '已启用',
|
enabled: '已启用',
|
||||||
disabled: '已禁用',
|
disabled: '已禁用',
|
||||||
expired: '已过期',
|
expired: '已过期',
|
||||||
|
connected: '已连接',
|
||||||
notConnected: '未连接',
|
notConnected: '未连接',
|
||||||
running: '运行中',
|
running: '运行中',
|
||||||
stopped: '已停止',
|
stopped: '已停止',
|
||||||
|
|||||||
@@ -51,10 +51,8 @@ describe('Dashboard i18n', () => {
|
|||||||
await i18n.changeLanguage('en');
|
await i18n.changeLanguage('en');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(
|
it('renders language switcher and changes locale', async () => {
|
||||||
'renders language switcher and changes locale',
|
render(<LanguageSwitcher />);
|
||||||
async () => {
|
|
||||||
render(<LanguageSwitcher />);
|
|
||||||
|
|
||||||
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
||||||
expect(screen.getByText('English')).toBeInTheDocument();
|
expect(screen.getByText('English')).toBeInTheDocument();
|
||||||
@@ -66,9 +64,7 @@ describe('Dashboard i18n', () => {
|
|||||||
expect(i18n.language).toBe('zh-CN');
|
expect(i18n.language).toBe('zh-CN');
|
||||||
});
|
});
|
||||||
expect(localStorageMock.setItem).toHaveBeenCalledWith(LOCALE_STORAGE_KEY, 'zh-CN');
|
expect(localStorageMock.setItem).toHaveBeenCalledWith(LOCALE_STORAGE_KEY, 'zh-CN');
|
||||||
},
|
}, 10000);
|
||||||
10000
|
|
||||||
);
|
|
||||||
|
|
||||||
it('restores locale from persisted storage', () => {
|
it('restores locale from persisted storage', () => {
|
||||||
persistLocale('zh-CN');
|
persistLocale('zh-CN');
|
||||||
|
|||||||
Reference in New Issue
Block a user