diff --git a/web/src/components/profile/settings.test.tsx b/web/src/components/profile/settings.test.tsx index 11eacb31..b6c9f3ac 100644 --- a/web/src/components/profile/settings.test.tsx +++ b/web/src/components/profile/settings.test.tsx @@ -19,7 +19,7 @@ beforeEach(() => { (redux.useSelector as jest.Mock).mockImplementation(() => ({ showErrorMessage: false, skippedSentences: [1], - currentUiLanguage: 'en', + currentUILocale: 'en', allLanguages: [], })); }); @@ -34,6 +34,24 @@ test('should render ui language section', async () => { expect(screen.getByText('Interface Language')).toBeTruthy(); }); +test('should render potentially not translated warning', async () => { + (redux.useSelector as jest.Mock).mockImplementation(() => ({ + showErrorMessage: false, + skippedSentences: [], + currentUILocale: 'de', + allLanguages: [], + })); + + await renderWithLocalization(); + expect(screen.getByText(/might not be fully translated/)).toBeTruthy(); +}); + +test('should not render potentially not translated warning for English', async () => { + await renderWithLocalization(); + expect(screen.getByText('Interface Language')).toBeTruthy(); + expect(screen.queryByText(/might not be fully translated/)).toBeNull(); +}); + test('should render error message', async () => { (redux.useSelector as jest.Mock).mockImplementation(() => ({ showErrorMessage: true, diff --git a/web/src/components/profile/settings.tsx b/web/src/components/profile/settings.tsx index f750e90d..623efd49 100644 --- a/web/src/components/profile/settings.tsx +++ b/web/src/components/profile/settings.tsx @@ -5,6 +5,7 @@ import { Localized } from '@fluent/react'; import cvTranslatedLocales from '../../../../locales/translated.json'; import { resetSkippedSentences } from '../../actions/sentences'; +import { DEFAULT_LOCALE } from '../../l10n'; import type { RootState } from '../../types'; import LanguageSelector from '../language-selector'; @@ -29,7 +30,8 @@ export default function Settings() { }; useEffect(() => { - const possiblyUntranslated = !CV_TRANSLATED_LOCALES.includes(currentUILocale); + const possiblyUntranslated = + currentUILocale !== DEFAULT_LOCALE && !CV_TRANSLATED_LOCALES.includes(currentUILocale); setShowTranslatedWarning(possiblyUntranslated); }, [currentUILocale]);