mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 22:15:33 +00:00
fix(i18n): complete Brazilian Portuguese locale
This commit is contained in:
1 parent
bb2596e296
commit
0a80dddb9c
2 files changed
+47
-2
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { render, screen, userEvent, waitFor } from '@tests/setup/test-utils';
|
||||
import i18n from '@/lib/i18n';
|
||||
import { ContinuityOverview } from '@/components/account/continuity-overview';
|
||||
@@ -31,6 +32,17 @@ function collectPlaceholders(text: string): string[] {
|
||||
return Array.from(text.matchAll(/\{\{[^{}]+\}\}/g), (match) => match[0]).sort();
|
||||
}
|
||||
|
||||
function AuthCopyProbe() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>{t('auth.dashboardTitle')}</h1>
|
||||
<p>{t('auth.safetyNoteSession')}</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
describe('Dashboard i18n', () => {
|
||||
const storage = new Map<string, string>();
|
||||
const localStorageMock = window.localStorage as unknown as {
|
||||
@@ -94,6 +106,7 @@ describe('Dashboard i18n', () => {
|
||||
}, 10000);
|
||||
|
||||
it.each([
|
||||
{ locale: 'pt-BR', label: 'Brazilian Portuguese', browserLocale: 'pt-BR' },
|
||||
{ locale: 'vi', label: 'Vietnamese', browserLocale: 'vi-VN' },
|
||||
{ locale: 'ja', label: 'Japanese', browserLocale: 'ja-JP' },
|
||||
{ locale: 'ko', label: 'Korean', browserLocale: 'ko-KR' },
|
||||
@@ -113,6 +126,28 @@ describe('Dashboard i18n', () => {
|
||||
}
|
||||
);
|
||||
|
||||
it.each([
|
||||
['pt-BR', 'pt-BR'],
|
||||
['pt-PT', 'pt-BR'],
|
||||
])('normalizes Portuguese locale %s to %s', (browserLocale, expectedLocale) => {
|
||||
expect(normalizeLocale(browserLocale)).toBe(expectedLocale);
|
||||
});
|
||||
|
||||
it('renders semantic Brazilian Portuguese auth copy when pt-BR is selected', async () => {
|
||||
await i18n.changeLanguage('pt-BR');
|
||||
|
||||
render(<AuthCopyProbe />);
|
||||
|
||||
expect(
|
||||
screen.getByRole('heading', { name: 'Claude Codex Switch Dashboard' })
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(
|
||||
'Logins bem-sucedidos criam um cookie HttpOnly restrito a este host do painel.'
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('restores locale from persisted storage', () => {
|
||||
persistLocale('ja');
|
||||
expect(getInitialLocale()).toBe('ja');
|
||||
|
||||
Reference in new issue
Block a user