Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Fix tests (#2434)
Leendert de Borst8ecde7c4ba36
diff --git a/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsx b/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsxindex f9405e0a9..36c9cf02c 100644--- a/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsx@@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next';import { StorageKeys } from '@/utils/constants/storageKeys';import { AVAILABLE_LANGUAGES, getLanguageConfig, type ILanguageConfig } from '../../../i18n/config';-import { ensureLanguageLoaded } from '../../../i18n/i18n';import { storage } from '#imports';@@ -51,7 +50,6 @@ const LanguageSwitcher: React.FC<LanguageSwitcherProps> = ({* @param lng - Language code to switch to*/const changeLanguage = async (lng: string): Promise<void> => {- await ensureLanguageLoaded(lng);await i18n.changeLanguage(lng);await storage.setItem(StorageKeys.LANGUAGE, lng);diff --git a/apps/browser-extension/src/i18n/config.ts b/apps/browser-extension/src/i18n/config.tsindex c69d96c30..3943d861e 100644--- a/apps/browser-extension/src/i18n/config.ts+++ b/apps/browser-extension/src/i18n/config.ts@@ -2,9 +2,10 @@* The UI languages of the browser extension. The translations live in core/i18n (@aliasvault/i18n).*/-import { type TranslationTree } from '@aliasvault/i18n';import { DEFAULT_LANGUAGE as CORE_DEFAULT_LANGUAGE, LANGUAGE_CODES as CORE_LANGUAGE_CODES, UI_LANGUAGES } from '@aliasvault/i18n/languages';+import type { TranslationTree } from '@aliasvault/i18n';+export interface ILanguageConfig {code: string;nativeName: string;diff --git a/apps/browser-extension/src/i18n/i18n.ts b/apps/browser-extension/src/i18n/i18n.tsindex ef8710a3b..07fb59851 100644--- a/apps/browser-extension/src/i18n/i18n.ts+++ b/apps/browser-extension/src/i18n/i18n.ts@@ -1,4 +1,4 @@-import { englishTranslations, loadTranslations, type TranslationTree } from '@aliasvault/i18n';+import { ALL_TRANSLATIONS } from '@aliasvault/i18n/all';import i18n from 'i18next';import { initReactI18next } from 'react-i18next';@@ -28,25 +28,16 @@ const detectLanguage = async (): Promise<string> => {return LANGUAGE_CODES.includes(browserLang) ? browserLang : DEFAULT_LANGUAGE;};-/**- * Load the translations of a language into i18next before switching to it. Each language is a separate chunk.- * @param code - the language code- */-export const ensureLanguageLoaded = async (code: string): Promise<void> => {- if (!i18n.hasResourceBundle(code, 'translation')) {- i18n.addResourceBundle(code, 'translation', await loadTranslations(code));- }-};-/*** Initialize i18n with async language detection*/const initI18n = async (): Promise<void> => {const language = await detectLanguage();- const resources: Record<string, { translation: TranslationTree }> = { [DEFAULT_LANGUAGE]: { translation: englishTranslations } };- if (language !== DEFAULT_LANGUAGE) {- resources[language] = { translation: await loadTranslations(language) };- }+ /*+ * The extension build puts each entry point in one file (no code splitting), so the popup bundles every language+ * up front; the background and content scripts only bundle the namespaces they use (config.ts).+ */+ const resources = Object.fromEntries(Object.entries(ALL_TRANSLATIONS).map(([code, translation]) => [code, { translation }]));await i18n.use(initReactI18next)diff --git a/apps/web/tests/e2e/01-registration.spec.ts b/apps/web/tests/e2e/01-registration.spec.tsindex 22c8b1b20..7b9f986c1 100644--- a/apps/web/tests/e2e/01-registration.spec.ts+++ b/apps/web/tests/e2e/01-registration.spec.ts@@ -21,7 +21,7 @@ test.describe('1. Registration', () => {await test.step('choose a username, checked against the server', async () => {await page.locator('#username').fill(credentials.username);- await expect(page.getByText('Username is available!')).toBeVisible();+ await expect(page.getByText('Username is available')).toBeVisible();await continueButton.click();});diff --git a/core/i18n/src/languages.ts b/core/i18n/src/languages.tsindex d28836b18..2654ef123 100644--- a/core/i18n/src/languages.ts+++ b/core/i18n/src/languages.ts@@ -4,7 +4,7 @@* language (`ui`). Languages with `ui: false` are only used by features such as the identity generator.*/-import languages from '../languages.json';+import languages from '../languages.json' with { type: 'json' };/*** Display metadata for a single language.