Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Localize main popup entrypoint pages (#992)
Leendert de Borst28c186904801
diff --git a/apps/browser-extension/src/entrypoints/background.ts b/apps/browser-extension/src/entrypoints/background.tsindex 6efa48a02..10dd96498 100644--- a/apps/browser-extension/src/entrypoints/background.ts+++ b/apps/browser-extension/src/entrypoints/background.ts@@ -37,7 +37,7 @@ export default defineBackground({// Setup context menusconst isContextMenuEnabled = await storage.getItem(GLOBAL_CONTEXT_MENU_ENABLED_KEY) ?? true;if (isContextMenuEnabled) {- setupContextMenus();+ await setupContextMenus();}// Listen for custom commandsdiff --git a/apps/browser-extension/src/entrypoints/background/ContextMenu.ts b/apps/browser-extension/src/entrypoints/background/ContextMenu.tsindex 762f5708d..a7ee1ac7a 100644--- a/apps/browser-extension/src/entrypoints/background/ContextMenu.ts+++ b/apps/browser-extension/src/entrypoints/background/ContextMenu.ts@@ -1,6 +1,7 @@import { type Browser } from '@wxt-dev/browser';import { sendMessage } from 'webext-bridge/background';+import { t } from '@/utils/contentTranslations';import { PasswordGenerator } from '@/utils/dist/shared/password-generator';import { browser } from "#imports";@@ -8,7 +9,7 @@ import { browser } from "#imports";/*** Setup the context menus.*/-export function setupContextMenus() : void {+export async function setupContextMenus() : Promise<void> {// Create root menubrowser.contextMenus.create({id: "aliasvault-root",@@ -20,7 +21,7 @@ export function setupContextMenus() : void {browser.contextMenus.create({id: "aliasvault-activate-form",parentId: "aliasvault-root",- title: "Autofill with AliasVault",+ title: await t('autofillWithAliasVault'),contexts: ["editable"],});@@ -36,7 +37,7 @@ export function setupContextMenus() : void {browser.contextMenus.create({id: "aliasvault-generate-password",parentId: "aliasvault-root",- title: "Generate random password (copy to clipboard)",+ title: await t('generateRandomPassword'),contexts: ["all"]});@@ -80,9 +81,9 @@ export function handleContextMenuClick(info: Browser.contextMenus.OnClickData, t/*** Copy provided password to clipboard.*/-function copyPasswordToClipboard(generatedPassword: string) : void {- navigator.clipboard.writeText(generatedPassword).then(() => {- showToast('Password copied to clipboard');+async function copyPasswordToClipboard(generatedPassword: string) : Promise<void> {+ navigator.clipboard.writeText(generatedPassword).then(async () => {+ showToast(await t('passwordCopiedToClipboard'));});/**diff --git a/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.tsindex 157f85b98..2314c9340 100644--- a/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.ts+++ b/apps/browser-extension/src/entrypoints/background/PopupMessageHandler.ts@@ -45,7 +45,7 @@ export function handleToggleContextMenu(message: any) : Promise<BoolResponse> {if (!message.enabled) {browser.contextMenus.removeAll();} else {- setupContextMenus();+ await setupContextMenus();}return { success: true };})();diff --git a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts b/apps/browser-extension/src/entrypoints/contentScript/Popup.tsindex 4c4ea3f11..a4409075e 100644--- a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts+++ b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts@@ -4,6 +4,7 @@ import { filterCredentials } from '@/entrypoints/contentScript/Filter';import { fillCredential } from '@/entrypoints/contentScript/Form';import { DISABLED_SITES_KEY, TEMPORARY_DISABLED_SITES_KEY, GLOBAL_AUTOFILL_POPUP_ENABLED_KEY, VAULT_LOCKED_DISMISS_UNTIL_KEY, LAST_CUSTOM_EMAIL_KEY, LAST_CUSTOM_USERNAME_KEY } from '@/utils/Constants';+import { t } from '@/utils/contentTranslations';import { CreateIdentityGenerator } from '@/utils/dist/shared/identity-generator';import type { Credential } from '@/utils/dist/shared/models/vault';import { CreatePasswordGenerator, PasswordGenerator } from '@/utils/dist/shared/password-generator';@@ -44,9 +45,10 @@ export function openAutofillPopup(input: HTMLInputElement, container: HTMLElemenconst response = await sendMessage('GET_CREDENTIALS', { }, 'background') as CredentialsResponse;if (response.success) {- createAutofillPopup(input, response.credentials, container);+ await createAutofillPopup(input, response.credentials, container);} else {- createVaultLockedPopup(input, container);+ const vaultLockedText = await t('vaultLocked');+ createVaultLockedPopup(input, container, vaultLockedText);}})();}@@ -114,7 +116,7 @@ export function createLoadingPopup(input: HTMLInputElement, message: string, roo* @param credentialList - The credential list element.* @param input - The input element that triggered the popup. Required when filling credentials to know which form to fill.*/-export function updatePopupContent(credentials: Credential[], credentialList: HTMLElement | null, input: HTMLInputElement, rootContainer: HTMLElement) : void {+export function updatePopupContent(credentials: Credential[], credentialList: HTMLElement | null, input: HTMLInputElement, rootContainer: HTMLElement, noMatchesText?: string) : void {if (!credentialList) {credentialList = document.getElementById('aliasvault-credential-list') as HTMLElement;}@@ -127,7 +129,7 @@ export function updatePopupContent(credentials: Credential[], credentialList: HTcredentialList.innerHTML = '';// Add credentials using the shared function- const credentialElements = createCredentialList(credentials, input, rootContainer);+ const credentialElements = createCredentialList(credentials, input, rootContainer, noMatchesText);credentialElements.forEach(element => credentialList.appendChild(element));}@@ -154,7 +156,16 @@ export function removeExistingPopup(container: HTMLElement) : void {/*** Create auto-fill popup*/-export function createAutofillPopup(input: HTMLInputElement, credentials: Credential[] | undefined, rootContainer: HTMLElement) : void {+export async function createAutofillPopup(input: HTMLInputElement, credentials: Credential[] | undefined, rootContainer: HTMLElement) : Promise<void> {+ // Get all translations first+ const newText = await t('new');+ const searchPlaceholder = await t('searchVault');+ const hideFor1HourText = await t('hideFor1Hour');+ const hidePermanentlyText = await t('hidePermanently');+ const noMatchesText = await t('noMatchesFound');+ const creatingText = await t('creatingNewAlias');+ const failedText = await t('failedToCreateIdentity');+// Disable browser's native autocomplete to avoid conflicts with AliasVault's autocomplete.input.setAttribute('autocomplete', 'false');const popup = createBasePopup(input, rootContainer);@@ -176,7 +187,7 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Credendocument.title);- updatePopupContent(filteredCredentials, credentialList, input, rootContainer);+ updatePopupContent(filteredCredentials, credentialList, input, rootContainer, noMatchesText);// Add dividerconst divider = document.createElement('div');@@ -195,7 +206,7 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden<line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>- New+ ${newText}`;/**@@ -214,7 +225,7 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Credenreturn;}- const loadingPopup = createLoadingPopup(input, 'Creating new alias...', rootContainer);+ const loadingPopup = createLoadingPopup(input, creatingText, rootContainer);try {// Sync with api to ensure we have the latest vault.@@ -298,7 +309,7 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Credenconsole.error('Error creating identity:', error);loadingPopup.innerHTML = `<div style="padding: 16px; color: #ef4444;">- Failed to create identity. Please try again.+ ${failedText}</div>`;setTimeout(() => {@@ -314,12 +325,14 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Credenconst searchInput = document.createElement('input');searchInput.type = 'text';searchInput.dataset.avDisable = 'true';- searchInput.placeholder = 'Search vault...';+ searchInput.placeholder = searchPlaceholder;searchInput.className = 'av-search-input';// Handle search input.let searchTimeout: NodeJS.Timeout | null = null;- searchInput.addEventListener('input', () => handleSearchInput(searchInput, credentials, rootContainer, searchTimeout, credentialList, input));+ searchInput.addEventListener('input', () => {+ handleSearchInput(searchInput, credentials, rootContainer, searchTimeout, credentialList, input, noMatchesText);+ });// Close buttonconst closeButton = document.createElement('button');@@ -346,13 +359,13 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden<svg class="av-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" stroke-linecap="round" stroke-linejoin="round"/></svg>- Hide for 1 hour (current site)+ ${hideFor1HourText}</button><button class="av-context-menu-item" data-action="permanent"><svg class="av-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 18L18 6M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"/></svg>- Hide permanently (current site)+ ${hidePermanentlyText}</button>`;@@ -400,7 +413,9 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden};// Add click handlers- addReliableClickHandler(closeButton, handleCloseClick);+ addReliableClickHandler(closeButton, (e: Event) => {+ handleCloseClick(e);+ });actionContainer.appendChild(searchInput);actionContainer.appendChild(createButton);@@ -434,7 +449,7 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden/*** Create vault locked popup.*/-export function createVaultLockedPopup(input: HTMLInputElement, rootContainer: HTMLElement): void {+export function createVaultLockedPopup(input: HTMLInputElement, rootContainer: HTMLElement, vaultLockedText?: string): void {/*** Handle unlock click.*/@@ -457,7 +472,7 @@ export function createVaultLockedPopup(input: HTMLInputElement, rootContainer: H// Add messageconst messageElement = document.createElement('div');messageElement.className = 'av-vault-locked-message';- messageElement.textContent = 'AliasVault is locked.';+ messageElement.textContent = vaultLockedText || 'AliasVault is locked.';container.appendChild(messageElement);// Add unlock button with SVG icon@@ -525,7 +540,7 @@ export function createVaultLockedPopup(input: HTMLInputElement, rootContainer: H/*** Handle popup search input by filtering credentials based on the search term.*/-function handleSearchInput(searchInput: HTMLInputElement, credentials: Credential[], rootContainer: HTMLElement, searchTimeout: NodeJS.Timeout | null, credentialList: HTMLElement | null, input: HTMLInputElement) : void {+function handleSearchInput(searchInput: HTMLInputElement, credentials: Credential[], rootContainer: HTMLElement, searchTimeout: NodeJS.Timeout | null, credentialList: HTMLElement | null, input: HTMLInputElement, noMatchesText?: string) : void {if (searchTimeout) {clearTimeout(searchTimeout);}@@ -574,7 +589,7 @@ function handleSearchInput(searchInput: HTMLInputElement, credentials: Credentia}// Update popup content with filtered results- updatePopupContent(filteredCredentials, credentialList, input, rootContainer);+ updatePopupContent(filteredCredentials, credentialList, input, rootContainer, noMatchesText);}/**@@ -583,7 +598,7 @@ function handleSearchInput(searchInput: HTMLInputElement, credentials: Credentia* @param credentials - The credentials to display.* @param input - The input element that triggered the popup. Required when filling credentials to know which form to fill.*/-function createCredentialList(credentials: Credential[], input: HTMLInputElement, rootContainer: HTMLElement): HTMLElement[] {+function createCredentialList(credentials: Credential[], input: HTMLInputElement, rootContainer: HTMLElement, noMatchesText?: string): HTMLElement[] {const elements: HTMLElement[] = [];if (credentials.length > 0) {@@ -660,7 +675,7 @@ function createCredentialList(credentials: Credential[], input: HTMLInputElement} else {const noMatches = document.createElement('div');noMatches.className = 'av-no-matches';- noMatches.textContent = 'No matches found';+ noMatches.textContent = noMatchesText || 'No matches found';elements.push(noMatches);}@@ -737,16 +752,17 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootConconst lastUsername = await storage.getItem(LAST_CUSTOM_USERNAME_KEY) as string ?? '';return new Promise((resolve) => {+ (async (): Promise<void> => {// Create modal overlay- const overlay = document.createElement('div');- overlay.id = 'aliasvault-create-popup';- overlay.className = 'av-create-popup-overlay';+ const overlay = document.createElement('div');+ overlay.id = 'aliasvault-create-popup';+ overlay.className = 'av-create-popup-overlay';- const popup = document.createElement('div');- popup.className = 'av-create-popup';+ const popup = document.createElement('div');+ popup.className = 'av-create-popup';- // Define input method base variables- const randomIdentityIcon = `+ // Define input method base variables+ const randomIdentityIcon = `<svg class="av-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8" cy="8" r="1"/>@@ -756,24 +772,36 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon<circle cx="16" cy="16" r="1"/></svg>`;- const randomIdentitySubtext = 'Generate a random identity with a random email address accessible in AliasVault.';- const randomIdentityTitle = 'Create random alias';- const randomIdentityTitleDropdown = 'Random alias';- const randomIdentitySubtextDropdown = 'Random identity with random email';+ const randomIdentitySubtext = await t('randomIdentityDescription');+ const randomIdentityTitle = await t('createRandomAlias');+ const randomIdentityTitleDropdown = await t('randomAlias');+ const randomIdentitySubtextDropdown = 'Random identity with random email';- const manualUsernamePasswordIcon = `+ const manualUsernamePasswordIcon = `<svg class="av-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="7" r="4"/><path d="M5.5 20a6.5 6.5 0 0 1 13 0"/></svg>`;- const manualUsernamePasswordSubtext = 'Specify your own email address and username.';- const manualUsernamePasswordTitle = 'Create username/password';- const manualUsernamePasswordTitleDropdown = 'Username/password';- const manualUsernamePasswordSubtextDropdown = 'Manual username and password';-- // Create the main content- popup.innerHTML = `+ const manualUsernamePasswordSubtext = await t('manualCredentialDescription');+ const manualUsernamePasswordTitle = await t('createUsernamePassword');+ const manualUsernamePasswordTitleDropdown = await t('usernamePassword');+ const manualUsernamePasswordSubtextDropdown = 'Manual username and password';++ // Get all translated strings first+ const serviceNameText = await t('serviceName');+ const enterServiceNameText = await t('enterServiceName');+ const cancelText = await t('cancel');+ const createAndSaveAliasText = await t('createAndSaveAlias');+ const emailText = await t('email');+ const enterEmailAddressText = await t('enterEmailAddress');+ const usernameText = await t('username');+ const enterUsernameText = await t('enterUsername');+ const generatedPasswordText = await t('generatedPassword');+ const createAndSaveCredentialText = await t('createAndSaveCredential');++ // Create the main content+ popup.innerHTML = `<div class="av-create-popup-header"><div class="av-create-popup-title-container"><div class="av-create-popup-title-wrapper">@@ -813,13 +841,13 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon<div class="av-create-popup-help-text">${randomIdentitySubtext}</div><div class="av-create-popup-field-group">- <label for="service-name-input">Service name</label>+ <label for="service-name-input">${serviceNameText}</label><inputtype="text"id="service-name-input"value="${suggestedNames[0] ?? ''}"class="av-create-popup-input"- placeholder="Enter service name"+ placeholder="${enterServiceNameText}">${suggestedNames.length > 1 ? `<div class="av-suggested-names">@@ -830,34 +858,34 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon<div class="av-create-popup-mode av-create-popup-random-mode"><div class="av-create-popup-actions">- <button id="cancel-btn" class="av-create-popup-cancel">Cancel</button>- <button id="save-btn" class="av-create-popup-save">Create and save alias</button>+ <button id="cancel-btn" class="av-create-popup-cancel">${cancelText}</button>+ <button id="save-btn" class="av-create-popup-save">${createAndSaveAliasText}</button></div></div><div class="av-create-popup-mode av-create-popup-custom-mode" style="display: none;"><div class="av-create-popup-field-group">- <label for="custom-email">Email</label>+ <label for="custom-email">${emailText}</label><inputtype="email"id="custom-email"class="av-create-popup-input"- placeholder="Enter email address"+ placeholder="${enterEmailAddressText}"data-default-value="${lastEmail}"></div><div class="av-create-popup-field-group">- <label for="custom-username">Username</label>+ <label for="custom-username">${usernameText}</label><inputtype="text"id="custom-username"class="av-create-popup-input"- placeholder="Enter username"+ placeholder="${enterUsernameText}"data-default-value="${lastUsername}"></div><div class="av-create-popup-field-group">- <label>Generated Password</label>+ <label>${generatedPasswordText}</label><div class="av-create-popup-password-preview"><inputtype="text"@@ -880,114 +908,114 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon</div></div><div class="av-create-popup-actions">- <button id="custom-cancel-btn" class="av-create-popup-cancel">Cancel</button>- <button id="custom-save-btn" class="av-create-popup-save">Create and save credential</button>+ <button id="custom-cancel-btn" class="av-create-popup-cancel">${cancelText}</button>+ <button id="custom-save-btn" class="av-create-popup-save">${createAndSaveCredentialText}</button></div></div>`;- overlay.appendChild(popup);- rootContainer.appendChild(overlay);-- // Animate in- requestAnimationFrame(() => {- popup.classList.add('show');- });-- // Get all the elements- const randomMode = popup.querySelector('.av-create-popup-random-mode') as HTMLElement;- const customMode = popup.querySelector('.av-create-popup-custom-mode') as HTMLElement;- const dropdownMenu = popup.querySelector('.av-create-popup-mode-dropdown-menu') as HTMLElement;- const titleContainer = popup.querySelector('.av-create-popup-title-container') as HTMLElement;- const cancelBtn = popup.querySelector('#cancel-btn') as HTMLButtonElement;- const customCancelBtn = popup.querySelector('#custom-cancel-btn') as HTMLButtonElement;- const saveBtn = popup.querySelector('#save-btn') as HTMLButtonElement;- const customSaveBtn = popup.querySelector('#custom-save-btn') as HTMLButtonElement;- const inputServiceName = popup.querySelector('#service-name-input') as HTMLInputElement;- const customEmail = popup.querySelector('#custom-email') as HTMLInputElement;- const customUsername = popup.querySelector('#custom-username') as HTMLInputElement;- const passwordPreview = popup.querySelector('#password-preview') as HTMLInputElement;- const regenerateBtn = popup.querySelector('#regenerate-password') as HTMLButtonElement;- const toggleVisibilityBtn = popup.querySelector('#toggle-password-visibility') as HTMLButtonElement;-- /**- * Setup default value for input with placeholder styling.- */- const setupDefaultValue = (input: HTMLInputElement) : void => {- const defaultValue = input.dataset.defaultValue;- if (defaultValue) {- input.value = defaultValue;- input.classList.add('av-create-popup-input-default');- }- };+ overlay.appendChild(popup);+ rootContainer.appendChild(overlay);- setupDefaultValue(customEmail);- setupDefaultValue(customUsername);+ // Animate in+ requestAnimationFrame(() => {+ popup.classList.add('show');+ });- // Handle input changes- customEmail.addEventListener('input', () => {- const value = customEmail.value.trim();- if (value || value === '') {- customEmail.classList.remove('av-create-popup-input-default');- storage.setItem(LAST_CUSTOM_EMAIL_KEY, value);- } else {- customEmail.classList.add('av-create-popup-input-default');- storage.setItem(LAST_CUSTOM_EMAIL_KEY, '');- }- });+ // Get all the elements+ const randomMode = popup.querySelector('.av-create-popup-random-mode') as HTMLElement;+ const customMode = popup.querySelector('.av-create-popup-custom-mode') as HTMLElement;+ const dropdownMenu = popup.querySelector('.av-create-popup-mode-dropdown-menu') as HTMLElement;+ const titleContainer = popup.querySelector('.av-create-popup-title-container') as HTMLElement;+ const cancelBtn = popup.querySelector('#cancel-btn') as HTMLButtonElement;+ const customCancelBtn = popup.querySelector('#custom-cancel-btn') as HTMLButtonElement;+ const saveBtn = popup.querySelector('#save-btn') as HTMLButtonElement;+ const customSaveBtn = popup.querySelector('#custom-save-btn') as HTMLButtonElement;+ const inputServiceName = popup.querySelector('#service-name-input') as HTMLInputElement;+ const customEmail = popup.querySelector('#custom-email') as HTMLInputElement;+ const customUsername = popup.querySelector('#custom-username') as HTMLInputElement;+ const passwordPreview = popup.querySelector('#password-preview') as HTMLInputElement;+ const regenerateBtn = popup.querySelector('#regenerate-password') as HTMLButtonElement;+ const toggleVisibilityBtn = popup.querySelector('#toggle-password-visibility') as HTMLButtonElement;++ /**+ * Setup default value for input with placeholder styling.+ */+ const setupDefaultValue = (input: HTMLInputElement) : void => {+ const defaultValue = input.dataset.defaultValue;+ if (defaultValue) {+ input.value = defaultValue;+ input.classList.add('av-create-popup-input-default');+ }+ };++ setupDefaultValue(customEmail);+ setupDefaultValue(customUsername);++ // Handle input changes+ customEmail.addEventListener('input', () => {+ const value = customEmail.value.trim();+ if (value || value === '') {+ customEmail.classList.remove('av-create-popup-input-default');+ storage.setItem(LAST_CUSTOM_EMAIL_KEY, value);+ } else {+ customEmail.classList.add('av-create-popup-input-default');+ storage.setItem(LAST_CUSTOM_EMAIL_KEY, '');+ }+ });- customUsername.addEventListener('input', () => {- const value = customUsername.value.trim();- if (value || value === '') {- customUsername.classList.remove('av-create-popup-input-default');- storage.setItem(LAST_CUSTOM_USERNAME_KEY, value);- } else {- customUsername.classList.add('av-create-popup-input-default');- storage.setItem(LAST_CUSTOM_USERNAME_KEY, '');- }- });+ customUsername.addEventListener('input', () => {+ const value = customUsername.value.trim();+ if (value || value === '') {+ customUsername.classList.remove('av-create-popup-input-default');+ storage.setItem(LAST_CUSTOM_USERNAME_KEY, value);+ } else {+ customUsername.classList.add('av-create-popup-input-default');+ storage.setItem(LAST_CUSTOM_USERNAME_KEY, '');+ }+ });- // Get password settings from background- let passwordGenerator: PasswordGenerator;- sendMessage('GET_PASSWORD_SETTINGS', {}, 'background').then((response) => {- const passwordSettingsResponse = response as PasswordSettingsResponse;- passwordGenerator = CreatePasswordGenerator(passwordSettingsResponse.settings ?? {- Length: 12,- UseLowercase: true,- UseUppercase: true,- UseNumbers: true,- UseSpecialChars: true,- UseNonAmbiguousChars: true+ // Get password settings from background+ let passwordGenerator: PasswordGenerator;+ sendMessage('GET_PASSWORD_SETTINGS', {}, 'background').then((response) => {+ const passwordSettingsResponse = response as PasswordSettingsResponse;+ passwordGenerator = CreatePasswordGenerator(passwordSettingsResponse.settings ?? {+ Length: 12,+ UseLowercase: true,+ UseUppercase: true,+ UseNumbers: true,+ UseSpecialChars: true,+ UseNonAmbiguousChars: true+ });+ // Generate initial password after settings are loaded+ passwordGenerator.generateRandomPassword();});- // Generate initial password after settings are loaded- passwordGenerator.generateRandomPassword();- });- /**- * Generate and set password.- */- const generatePassword = () : void => {- if (!passwordGenerator) {- return;- }+ /**+ * Generate and set password.+ */+ const generatePassword = () : void => {+ if (!passwordGenerator) {+ return;+ }- passwordPreview.value = passwordGenerator.generateRandomPassword();- passwordPreview.type = 'text';- passwordPreview.dataset.isGenerated = 'true';- updateVisibilityIcon(true);- };+ passwordPreview.value = passwordGenerator.generateRandomPassword();+ passwordPreview.type = 'text';+ passwordPreview.dataset.isGenerated = 'true';+ updateVisibilityIcon(true);+ };- // Handle regenerate button click- regenerateBtn.addEventListener('click', generatePassword);+ // Handle regenerate button click+ regenerateBtn.addEventListener('click', generatePassword);- // Add password visibility toggle functionality- const passwordInput = popup.querySelector('#password-preview') as HTMLInputElement;+ // Add password visibility toggle functionality+ const passwordInput = popup.querySelector('#password-preview') as HTMLInputElement;- /**- * Toggle password visibility icon- */- const updateVisibilityIcon = (isVisible: boolean): void => {- toggleVisibilityBtn.innerHTML = isVisible ? `+ /**+ * Toggle password visibility icon+ */+ const updateVisibilityIcon = (isVisible: boolean): void => {+ toggleVisibilityBtn.innerHTML = isVisible ? `<svg class="av-icon" viewBox="0 0 24 24"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle>@@ -998,262 +1026,263 @@ export async function createAliasCreationPopup(suggestedNames: string[], rootCon<line x1="1" y1="1" x2="23" y2="23"></line></svg>`;- };-- /**- * Toggle password visibility- */- const togglePasswordVisibility = (): void => {- const isVisible = passwordInput.type === 'text';- passwordInput.type = isVisible ? 'password' : 'text';- updateVisibilityIcon(!isVisible);- };-- toggleVisibilityBtn.addEventListener('click', togglePasswordVisibility);-- /**- * Handle password input changes- */- const handlePasswordChange = (e: Event): void => {- const target = e.target as HTMLInputElement;- const isGenerated = target.dataset.isGenerated === 'true';- const isEmpty = target.value.trim().length <= 1;-- // If manually cleared (empty or single char) and was previously generated, switch to password type- if (isEmpty && isGenerated) {- target.type = 'password';- target.dataset.isGenerated = 'false';+ };++ /**+ * Toggle password visibility+ */+ const togglePasswordVisibility = (): void => {+ const isVisible = passwordInput.type === 'text';+ passwordInput.type = isVisible ? 'password' : 'text';+ updateVisibilityIcon(!isVisible);+ };++ toggleVisibilityBtn.addEventListener('click', togglePasswordVisibility);++ /**+ * Handle password input changes+ */+ const handlePasswordChange = (e: Event): void => {+ const target = e.target as HTMLInputElement;+ const isGenerated = target.dataset.isGenerated === 'true';+ const isEmpty = target.value.trim().length <= 1;++ // If manually cleared (empty or single char) and was previously generated, switch to password type+ if (isEmpty && isGenerated) {+ target.type = 'password';+ target.dataset.isGenerated = 'false';+ updateVisibilityIcon(false);+ }+ };++ /**+ * Handle paste events+ */+ const handlePasswordPaste = (): void => {+ passwordInput.dataset.isGenerated = 'false';+ passwordInput.type = 'password';updateVisibilityIcon(false);- }- };-- /**- * Handle paste events- */- const handlePasswordPaste = (): void => {- passwordInput.dataset.isGenerated = 'false';- passwordInput.type = 'password';- updateVisibilityIcon(false);- };-- passwordInput.addEventListener('input', handlePasswordChange);- passwordInput.addEventListener('paste', handlePasswordPaste);-- /**- * Toggle dropdown visibility.- */- const toggleDropdown = () : void => {- dropdownMenu.style.display = dropdownMenu.style.display === 'none' ? 'block' : 'none';- };-- // Make title container clickable to trigger the dropdown- titleContainer.addEventListener('click', (e) => {- e.stopPropagation();- toggleDropdown();- });+ };++ passwordInput.addEventListener('input', handlePasswordChange);+ passwordInput.addEventListener('paste', handlePasswordPaste);++ /**+ * Toggle dropdown visibility.+ */+ const toggleDropdown = () : void => {+ dropdownMenu.style.display = dropdownMenu.style.display === 'none' ? 'block' : 'none';+ };++ // Make title container clickable to trigger the dropdown+ titleContainer.addEventListener('click', (e) => {+ e.stopPropagation();+ toggleDropdown();+ });- // Close dropdown when clicking outside- document.addEventListener('click', (e) => {- if (!titleContainer.contains(e.target as Node) && !dropdownMenu.contains(e.target as Node)) {- dropdownMenu.style.display = 'none';- }- });+ // Close dropdown when clicking outside+ document.addEventListener('click', (e) => {+ if (!titleContainer.contains(e.target as Node) && !dropdownMenu.contains(e.target as Node)) {+ dropdownMenu.style.display = 'none';+ }+ });- // Handle mode option clicks- dropdownMenu.querySelectorAll('.av-create-popup-mode-option').forEach(option => {- option.addEventListener('click', () => {- const mode = (option as HTMLElement).dataset.mode;- const titleWrapper = popup.querySelector('.av-create-popup-title-wrapper') as HTMLElement;- if (mode === 'random') {- titleWrapper.innerHTML = `+ // Handle mode option clicks+ dropdownMenu.querySelectorAll('.av-create-popup-mode-option').forEach(option => {+ option.addEventListener('click', () => {+ const mode = (option as HTMLElement).dataset.mode;+ const titleWrapper = popup.querySelector('.av-create-popup-title-wrapper') as HTMLElement;+ if (mode === 'random') {+ titleWrapper.innerHTML = `${randomIdentityIcon}<h3 class="av-create-popup-title">${randomIdentityTitle}</h3>`;popup.querySelector('.av-create-popup-help-text')!.textContent = randomIdentitySubtext;randomMode.style.display = 'block';customMode.style.display = 'none';- } else if (mode === 'custom') {- titleWrapper.innerHTML = `+ } else if (mode === 'custom') {+ titleWrapper.innerHTML = `${manualUsernamePasswordIcon}<h3 class="av-create-popup-title">${manualUsernamePasswordTitle}</h3>`;popup.querySelector('.av-create-popup-help-text')!.textContent = manualUsernamePasswordSubtext;randomMode.style.display = 'none';customMode.style.display = 'block';+ }+ dropdownMenu.style.display = 'none';+ });+ });++ /**+ * Close the popup.+ */+ const closePopup = (value: { serviceName: string | null, isCustomCredential: boolean, customEmail?: string, customUsername?: string, customPassword?: string } | null) : void => {+ popup.classList.remove('show');+ setTimeout(() => {+ overlay.remove();+ resolve(value);+ }, 200);+ };++ // Handle save buttons+ saveBtn.addEventListener('click', () => {+ const serviceName = inputServiceName.value.trim();+ if (serviceName) {+ closePopup({+ serviceName,+ isCustomCredential: false+ });}- dropdownMenu.style.display = 'none';});- });- /**- * Close the popup.- */- const closePopup = (value: { serviceName: string | null, isCustomCredential: boolean, customEmail?: string, customUsername?: string, customPassword?: string } | null) : void => {- popup.classList.remove('show');- setTimeout(() => {- overlay.remove();- resolve(value);- }, 200);- };+ /**+ * Handle custom save button click.+ */+ const handleCustomSave = () : void => {+ const serviceName = inputServiceName.value.trim();+ if (serviceName) {+ const email = customEmail.value.trim();+ const username = customUsername.value.trim();+ const hasDefaultEmail = customEmail.classList.contains('av-create-popup-input-default');+ const hasDefaultUsername = customUsername.classList.contains('av-create-popup-input-default');- // Handle save buttons- saveBtn.addEventListener('click', () => {- const serviceName = inputServiceName.value.trim();- if (serviceName) {- closePopup({- serviceName,- isCustomCredential: false- });- }- });+ // If using default values, use the dataset values+ const finalEmail = hasDefaultEmail ? customEmail.dataset.defaultValue : email;+ const finalUsername = hasDefaultUsername ? customUsername.dataset.defaultValue : username;- /**- * Handle custom save button click.- */- const handleCustomSave = () : void => {- const serviceName = inputServiceName.value.trim();- if (serviceName) {- const email = customEmail.value.trim();- const username = customUsername.value.trim();- const hasDefaultEmail = customEmail.classList.contains('av-create-popup-input-default');- const hasDefaultUsername = customUsername.classList.contains('av-create-popup-input-default');-- // If using default values, use the dataset values- const finalEmail = hasDefaultEmail ? customEmail.dataset.defaultValue : email;- const finalUsername = hasDefaultUsername ? customUsername.dataset.defaultValue : username;-- if (!finalEmail && !finalUsername) {+ if (!finalEmail && !finalUsername) {// Add error styling to fields- customEmail.classList.add('av-create-popup-input-error');- customUsername.classList.add('av-create-popup-input-error');-- // Add error messages after labels- const emailLabel = customEmail.previousElementSibling as HTMLLabelElement;- const usernameLabel = customUsername.previousElementSibling as HTMLLabelElement;-- if (!emailLabel.querySelector('.av-create-popup-error-text')) {- const emailError = document.createElement('span');- emailError.className = 'av-create-popup-error-text';- emailError.textContent = 'Enter email and/or username';- emailLabel.appendChild(emailError);- }-- if (!usernameLabel.querySelector('.av-create-popup-error-text')) {- const usernameError = document.createElement('span');- usernameError.className = 'av-create-popup-error-text';- usernameError.textContent = 'Enter email and/or username';- usernameLabel.appendChild(usernameError);- }-- /**- * Remove error styling.- */- const removeError = () : void => {- customEmail.classList.remove('av-create-popup-input-error');- customUsername.classList.remove('av-create-popup-input-error');- const emailError = emailLabel.querySelector('.av-create-popup-error-text');- const usernameError = usernameLabel.querySelector('.av-create-popup-error-text');- if (emailError) {- emailError.remove();+ customEmail.classList.add('av-create-popup-input-error');+ customUsername.classList.add('av-create-popup-input-error');++ // Add error messages after labels+ const emailLabel = customEmail.previousElementSibling as HTMLLabelElement;+ const usernameLabel = customUsername.previousElementSibling as HTMLLabelElement;++ if (!emailLabel.querySelector('.av-create-popup-error-text')) {+ const emailError = document.createElement('span');+ emailError.className = 'av-create-popup-error-text';+ emailError.textContent = 'Enter email and/or username';+ emailLabel.appendChild(emailError);}- if (usernameError) {- usernameError.remove();++ if (!usernameLabel.querySelector('.av-create-popup-error-text')) {+ const usernameError = document.createElement('span');+ usernameError.className = 'av-create-popup-error-text';+ usernameError.textContent = 'Enter email and/or username';+ usernameLabel.appendChild(usernameError);}- };- customEmail.addEventListener('input', removeError, { once: true });- customUsername.addEventListener('input', removeError, { once: true });+ /**+ * Remove error styling.+ */+ const removeError = () : void => {+ customEmail.classList.remove('av-create-popup-input-error');+ customUsername.classList.remove('av-create-popup-input-error');+ const emailError = emailLabel.querySelector('.av-create-popup-error-text');+ const usernameError = usernameLabel.querySelector('.av-create-popup-error-text');+ if (emailError) {+ emailError.remove();+ }+ if (usernameError) {+ usernameError.remove();+ }+ };++ customEmail.addEventListener('input', removeError, { once: true });+ customUsername.addEventListener('input', removeError, { once: true });++ return;+ }- return;+ closePopup({+ serviceName,+ isCustomCredential: true,+ customEmail: finalEmail,+ customUsername: finalUsername,+ customPassword: passwordPreview.value+ });}-- closePopup({- serviceName,- isCustomCredential: true,- customEmail: finalEmail,- customUsername: finalUsername,- customPassword: passwordPreview.value- });- }- }-- customSaveBtn.addEventListener('click', handleCustomSave);-- /**- * Handle custom form input enter key press to submit the form.- */- const handleCustomEnter = (e: KeyboardEvent) : void => {- if (e.key === 'Enter') {- handleCustomSave();}- };- inputServiceName.addEventListener('keyup', handleCustomEnter);- customEmail.addEventListener('keyup', handleCustomEnter);- customUsername.addEventListener('keyup', handleCustomEnter);- passwordPreview.addEventListener('keyup', handleCustomEnter);+ customSaveBtn.addEventListener('click', handleCustomSave);- // Handle cancel buttons- cancelBtn.addEventListener('click', () => {- closePopup(null);- });+ /**+ * Handle custom form input enter key press to submit the form.+ */+ const handleCustomEnter = (e: KeyboardEvent) : void => {+ if (e.key === 'Enter') {+ handleCustomSave();+ }+ };- customCancelBtn.addEventListener('click', () => {- closePopup(null);- });+ inputServiceName.addEventListener('keyup', handleCustomEnter);+ customEmail.addEventListener('keyup', handleCustomEnter);+ customUsername.addEventListener('keyup', handleCustomEnter);+ passwordPreview.addEventListener('keyup', handleCustomEnter);- // Handle Enter key- inputServiceName.addEventListener('keyup', (e) => {- if (e.key === 'Enter') {- const serviceName = inputServiceName.value.trim();- if (serviceName) {- closePopup({- serviceName,- isCustomCredential: false- });- }- }- });+ // Handle cancel buttons+ cancelBtn.addEventListener('click', () => {+ closePopup(null);+ });- /**- * Handle click outside.- */- const handleClickOutside = (event: MouseEvent): void => {- const target = event.target as Node;- if (target === overlay) {+ customCancelBtn.addEventListener('click', () => {closePopup(null);- }- };+ });- // Use mousedown instead of click to prevent closing when dragging text- overlay.addEventListener('mousedown', handleClickOutside);+ // Handle Enter key+ inputServiceName.addEventListener('keyup', (e) => {+ if (e.key === 'Enter') {+ const serviceName = inputServiceName.value.trim();+ if (serviceName) {+ closePopup({+ serviceName,+ isCustomCredential: false+ });+ }+ }+ });- /**- * Handle suggested name click.- */- const handleSuggestedNameClick = (e: Event) : void => {- const target = e.target as HTMLElement;- if (target.classList.contains('av-suggested-name')) {- const name = target.dataset.name;- if (name) {+ /**+ * Handle click outside.+ */+ const handleClickOutside = (event: MouseEvent): void => {+ const target = event.target as Node;+ if (target === overlay) {+ closePopup(null);+ }+ };++ // Use mousedown instead of click to prevent closing when dragging text+ overlay.addEventListener('mousedown', handleClickOutside);++ /**+ * Handle suggested name click.+ */+ const handleSuggestedNameClick = (e: Event) : void => {+ const target = e.target as HTMLElement;+ if (target.classList.contains('av-suggested-name')) {+ const name = target.dataset.name;+ if (name) {// Update input with clicked name- inputServiceName.value = name;- customUsername.value = name;+ inputServiceName.value = name;+ customUsername.value = name;- // Update the suggested names section- const suggestedNamesContainer = target.closest('.av-suggested-names');- if (suggestedNamesContainer) {+ // Update the suggested names section+ const suggestedNamesContainer = target.closest('.av-suggested-names');+ if (suggestedNamesContainer) {// Update the suggestions HTML using the helper function- suggestedNamesContainer.innerHTML = getSuggestedNamesHtml(suggestedNames, name);+ suggestedNamesContainer.innerHTML = getSuggestedNamesHtml(suggestedNames, name);+ }}}- }- };+ };- popup.addEventListener('click', handleSuggestedNameClick);+ popup.addEventListener('click', handleSuggestedNameClick);- // Focus the input field- inputServiceName.select();+ // Focus the input field+ inputServiceName.select();+ })();});}diff --git a/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx b/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsxindex 198347f23..d395ecf69 100644--- a/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/FormInput.tsx@@ -1,4 +1,5 @@import React, { forwardRef } from 'react';+import { useTranslation } from 'react-i18next';/*** Button configuration for form input.@@ -78,6 +79,7 @@ export const FormInput = forwardRef<HTMLInputElement, FormInputProps>(({showPassword: controlledShowPassword,onShowPasswordChange}, ref) => {+ const { t } = useTranslation('common');const [internalShowPassword, setInternalShowPassword] = React.useState(false);/**@@ -112,7 +114,7 @@ export const FormInput = forwardRef<HTMLInputElement, FormInputProps>(({* Toggle password visibility.*/onClick: (): void => setShowPassword(!showPassword),- title: showPassword ? 'Hide password' : 'Show password'+ title: showPassword ? t('hidePassword') : t('showPassword')}]: buttons;diff --git a/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx b/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsxindex e489e06bb..ee543a893 100644--- a/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/FormInputCopyToClipboard.tsx@@ -1,4 +1,5 @@import React, { useState, useEffect } from 'react';+import { useTranslation } from 'react-i18next';import { ClipboardCopyService } from '@/entrypoints/popup/utils/ClipboardCopyService';@@ -60,6 +61,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =value,type = 'text'}) => {+ const { t } = useTranslation('common');const [showPassword, setShowPassword] = useState(false);const [copied, setCopied] = useState(false);@@ -112,7 +114,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =<buttontype="button"className="p-1 text-green-500 dark:text-green-400 transition-colors duration-200"- title="Copied!"+ title={t('copied')}><svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><Icon name="check" />@@ -123,7 +125,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =type="button"onClick={copyToClipboard}className="p-1 text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200"- title="Copy to clipboard"+ title={t('copyToClipboard')}><svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><Icon name="copy" />@@ -135,7 +137,7 @@ export const FormInputCopyToClipboard: React.FC<FormInputCopyToClipboardProps> =type="button"onClick={() => setShowPassword(!showPassword)}className="p-1 text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white transition-colors duration-200"- title={showPassword ? 'Hide password' : 'Show password'}+ title={showPassword ? t('hidePassword') : t('showPassword')}><svg className="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><Icon name={showPassword ? 'visibility-off' : 'visibility'} />diff --git a/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsx b/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsxindex 2349e1a7c..56a5eb8d2 100644--- a/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/LanguageSwitcher.tsx@@ -17,10 +17,15 @@ type LanguageSwitcherProps = {size?: 'sm' | 'md';};+/**+ * Language switcher component that allows users to switch between supported languages+ * @param props - Component props including variant and size+ * @returns JSX element for the language switcher+ */const LanguageSwitcher: React.FC<LanguageSwitcherProps> = ({variant = 'dropdown',size = 'md'-}) => {+}): React.JSX.Element => {const { i18n } = useTranslation('common');const [isOpen, setIsOpen] = useState(false);const dropdownRef = useRef<HTMLDivElement>(null);@@ -28,8 +33,12 @@ const LanguageSwitcher: React.FC<LanguageSwitcherProps> = ({const currentLanguage = languages.find(lang => lang.code === i18n.language) || languages[0];// Close dropdown when clicking outside- useEffect(() => {- const handleClickOutside = (event: MouseEvent) => {+ useEffect((): (() => void) => {+ /**+ * Handle clicks outside the dropdown to close it+ * @param event - Mouse event+ */+ const handleClickOutside = (event: MouseEvent): void => {if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {setIsOpen(false);}@@ -41,7 +50,11 @@ const LanguageSwitcher: React.FC<LanguageSwitcherProps> = ({};}, []);- const changeLanguage = async (lng: string) => {+ /**+ * Change the application language+ * @param lng - Language code to switch to+ */+ const changeLanguage = async (lng: string): Promise<void> => {await i18n.changeLanguage(lng);localStorage.setItem('aliasvault-language', lng);setIsOpen(false);diff --git a/apps/browser-extension/src/entrypoints/popup/components/Layout/Header.tsx b/apps/browser-extension/src/entrypoints/popup/components/Layout/Header.tsxindex 75b223b47..f5929ae10 100644--- a/apps/browser-extension/src/entrypoints/popup/components/Layout/Header.tsx+++ b/apps/browser-extension/src/entrypoints/popup/components/Layout/Header.tsx@@ -1,4 +1,5 @@import React from 'react';+import { useTranslation } from 'react-i18next';import { useNavigate, useLocation } from 'react-router-dom';import { useAuth } from '@/entrypoints/popup/context/AuthContext';@@ -22,6 +23,7 @@ const Header: React.FC<HeaderProps> = ({routes = [],rightButtons}) => {+ const { t } = useTranslation('common');const authContext = useAuth();const navigate = useNavigate();const location = useLocation();@@ -86,7 +88,7 @@ const Header: React.FC<HeaderProps> = ({className="flex items-center hover:opacity-80 transition-opacity"><img src="/assets/images/logo.svg" alt="AliasVault" className="h-8 w-8 mr-2" />- <h1 className="text-gray-900 dark:text-white text-xl font-bold">AliasVault</h1>+ <h1 className="text-gray-900 dark:text-white text-xl font-bold">{t('appName')}</h1>{/* Hide beta badge on Safari as it's not allowed to show non-production badges */}{!import.meta.env.SAFARI && (<span className="text-primary-500 text-[10px] ml-1 font-normal">BETA</span>@@ -106,7 +108,7 @@ const Header: React.FC<HeaderProps> = ({onClick={(handleSettings)}className="p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700">- <span className="sr-only">Settings</span>+ <span className="sr-only">{t('settings')}</span><svg className="w-5 h-5" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z" clipRule="evenodd" /></svg>diff --git a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsxindex 43f18740a..acae0eba4 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/CredentialsList.tsx@@ -158,14 +158,14 @@ const CredentialsList: React.FC = () => {return (<div><div className="flex justify-between items-center mb-4">- <h2 className="text-gray-900 dark:text-white text-xl">Credentials</h2>+ <h2 className="text-gray-900 dark:text-white text-xl">{t('title')}</h2><ReloadButton onClick={syncVaultAndRefresh} /></div>{credentials.length > 0 ? (<inputtype="text"- placeholder="Search credentials..."+ placeholder={t('searchPlaceholder')}value={searchTerm}onChange={(e) => setSearchTerm(e.target.value)}autoFocus@@ -178,13 +178,13 @@ const CredentialsList: React.FC = () => {{credentials.length === 0 ? (<div className="text-gray-500 dark:text-gray-400 space-y-2 mb-10"><p className="text-sm">- Welcome to AliasVault!+ {t('welcomeTitle')}</p><p className="text-sm">- To use the AliasVault browser extension: navigate to a website and use the AliasVault autofill popup to create a new credential.+ {t('welcomeDescription')}</p><p className="text-sm">- If you want to create manual identities, open the full AliasVault app via the popout icon in the top right corner.+ {t('manualCreationHint')}</p></div>) : (diff --git a/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsxindex 03e7b216d..0dd5326dd 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/Settings.tsx@@ -80,14 +80,14 @@ const Settings: React.FC = () => {<><HeaderButtononClick={() => PopoutUtility.openInNewPopup()}- title="Open in new window"+ title={t('openInNewWindow')}iconType={HeaderIconType.EXPAND}/></>)}<HeaderButtononClick={openClientTab}- title="Open web app"+ title={t('openWebApp')}iconType={HeaderIconType.EXTERNAL_LINK}/></div>@@ -95,7 +95,7 @@ const Settings: React.FC = () => {setHeaderButtons(headerButtonsJSX);return () => setHeaderButtons(null);- }, [setHeaderButtons]);+ }, [setHeaderButtons, t]);/*** Load settings.@@ -258,7 +258,7 @@ const Settings: React.FC = () => {return (<div className="space-y-6"><div className="flex justify-between items-center mb-4">- <h2 className="text-gray-900 dark:text-white text-xl">Settings</h2>+ <h2 className="text-gray-900 dark:text-white text-xl">{t('title')}</h2></div>{/* User Menu Section */}@@ -279,7 +279,7 @@ const Settings: React.FC = () => {{authContext.username}</p><p className="text-xs text-gray-500 dark:text-gray-400">- Logged in+ {t('loggedIn')}</p></div></div>@@ -287,7 +287,7 @@ const Settings: React.FC = () => {onClick={handleLogout}className="px-4 py-2 text-sm font-medium text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300">- Logout+ {t('logout')}</button></div></div>@@ -296,14 +296,14 @@ const Settings: React.FC = () => {{/* Global Settings Section */}<section>- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">Global Settings</h3>+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('globalSettings')}</h3><div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700"><div className="p-4 space-y-4"><div className="flex items-center justify-between"><div>- <p className="text-sm font-medium text-gray-900 dark:text-white">Autofill popup</p>+ <p className="text-sm font-medium text-gray-900 dark:text-white">{t('autofillPopup')}</p><p className={`text-sm mt-1 ${settings.isGloballyEnabled ? 'text-gray-600 dark:text-gray-400' : 'text-red-600 dark:text-red-400'}`}>- {settings.isGloballyEnabled ? 'Active on all sites (unless disabled below)' : 'Disabled on all sites'}+ {settings.isGloballyEnabled ? t('activeOnAllSites') : t('disabledOnAllSites')}</p></div><button@@ -314,15 +314,15 @@ const Settings: React.FC = () => {: 'bg-red-500 hover:bg-red-600 text-white'}`}>- {settings.isGloballyEnabled ? 'Enabled' : 'Disabled'}+ {settings.isGloballyEnabled ? t('enabled') : t('disabled')}</button></div><div className="flex items-center justify-between"><div>- <p className="text-sm font-medium text-gray-900 dark:text-white">Right-click context menu</p>+ <p className="text-sm font-medium text-gray-900 dark:text-white">{t('rightClickContextMenu')}</p><p className={`text-sm mt-1 ${settings.isContextMenuEnabled ? 'text-gray-600 dark:text-gray-400' : 'text-red-600 dark:text-red-400'}`}>- {settings.isContextMenuEnabled ? 'Enabled' : 'Disabled'}+ {settings.isContextMenuEnabled ? t('enabled') : t('disabled')}</p></div><button@@ -333,7 +333,7 @@ const Settings: React.FC = () => {: 'bg-red-500 hover:bg-red-600 text-white'}`}>- {settings.isContextMenuEnabled ? 'Enabled' : 'Disabled'}+ {settings.isContextMenuEnabled ? t('enabled') : t('disabled')}</button></div></div>@@ -343,18 +343,18 @@ const Settings: React.FC = () => {{/* Site-Specific Settings Section */}{settings.isGloballyEnabled && (<section>- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">Site-Specific Settings</h3>+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('siteSpecificSettings')}</h3><div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700"><div className="p-4"><div className="flex items-center justify-between"><div>- <p className="text-sm font-medium text-gray-900 dark:text-white">Autofill popup on: {settings.currentUrl}</p>+ <p className="text-sm font-medium text-gray-900 dark:text-white">{t('autofillPopupOn')}{settings.currentUrl}</p><p className={`text-sm mt-1 ${settings.isEnabled ? 'text-gray-600 dark:text-gray-400' : 'text-red-600 dark:text-red-400'}`}>- {settings.isEnabled ? 'Enabled for this site' : 'Disabled for this site'}+ {settings.isEnabled ? t('enabledForThisSite') : t('disabledForThisSite')}</p>{!settings.isEnabled && settings.temporaryDisabledUrls[settings.currentUrl] && (<p className="text-xs text-gray-500 dark:text-gray-400 mt-1">- Temporarily disabled until {new Date(settings.temporaryDisabledUrls[settings.currentUrl]).toLocaleTimeString()}+ {t('temporarilyDisabledUntil')}{new Date(settings.temporaryDisabledUrls[settings.currentUrl]).toLocaleTimeString()}</p>)}</div>@@ -367,7 +367,7 @@ const Settings: React.FC = () => {: 'bg-red-500 hover:bg-red-600 text-white'}`}>- {settings.isEnabled ? 'Enabled' : 'Disabled'}+ {settings.isEnabled ? t('enabled') : t('disabled')}</button>)}</div>@@ -377,7 +377,7 @@ const Settings: React.FC = () => {onClick={resetSettings}className="w-full px-4 py-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-md text-gray-700 dark:text-gray-300 transition-colors text-sm">- Reset all site-specific settings+ {t('resetAllSiteSettings')}</button></div></div>@@ -387,7 +387,7 @@ const Settings: React.FC = () => {{/* Appearance Settings Section */}<section>- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">Appearance</h3>+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('appearance')}</h3><div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700"><div className="p-4"><div className="mb-4">@@ -397,7 +397,7 @@ const Settings: React.FC = () => {</div></div><div>- <p className="text-sm font-medium text-gray-900 dark:text-white mb-2">Theme</p>+ <p className="text-sm font-medium text-gray-900 dark:text-white mb-2">{t('theme')}</p><div className="flex flex-col space-y-2"><label className="flex items-center"><input@@ -408,7 +408,7 @@ const Settings: React.FC = () => {onChange={() => setThemePreference('system')}className="mr-2"/>- <span className="text-sm text-gray-700 dark:text-gray-300">Use default</span>+ <span className="text-sm text-gray-700 dark:text-gray-300">{t('useDefault')}</span></label><label className="flex items-center"><input@@ -419,7 +419,7 @@ const Settings: React.FC = () => {onChange={() => setThemePreference('light')}className="mr-2"/>- <span className="text-sm text-gray-700 dark:text-gray-300">Light</span>+ <span className="text-sm text-gray-700 dark:text-gray-300">{t('light')}</span></label><label className="flex items-center"><input@@ -430,7 +430,7 @@ const Settings: React.FC = () => {onChange={() => setThemePreference('dark')}className="mr-2"/>- <span className="text-sm text-gray-700 dark:text-gray-300">Dark</span>+ <span className="text-sm text-gray-700 dark:text-gray-300">{t('dark')}</span></label></div></div>@@ -441,18 +441,18 @@ const Settings: React.FC = () => {{/* Keyboard Shortcuts Section */}{import.meta.env.CHROME && (<section>- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">Keyboard Shortcuts</h3>+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-3">{t('keyboardShortcuts')}</h3><div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700"><div className="p-4"><div className="flex items-center justify-between"><div>- <p className="text-sm font-medium text-gray-900 dark:text-white">Configure keyboard shortcuts</p>+ <p className="text-sm font-medium text-gray-900 dark:text-white">{t('configureKeyboardShortcuts')}</p></div><buttononClick={openKeyboardShortcuts}className="px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-md transition-colors">- Configure+ {t('configure')}</button></div></div>@@ -461,7 +461,7 @@ const Settings: React.FC = () => {)}<div className="text-center text-gray-400 dark:text-gray-600">- Version {AppInfo.VERSION} ({getDisplayUrl()})+ {t('versionPrefix')}{AppInfo.VERSION} ({getDisplayUrl()})</div></div>);diff --git a/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx b/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsxindex b894f5554..3de573e64 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/Unlock.tsx@@ -70,7 +70,7 @@ const Unlock: React.FC = () => {return () => {setHeaderButtons(null);};- }, [setHeaderButtons]);+ }, [setHeaderButtons, t]);/*** Handle submitdiff --git a/apps/browser-extension/src/locales/en/common.json b/apps/browser-extension/src/locales/en/common.jsonindex c65602855..1339b7bf9 100644--- a/apps/browser-extension/src/locales/en/common.json+++ b/apps/browser-extension/src/locales/en/common.json@@ -27,5 +27,38 @@"openInNewWindow": "Open in new window","language": "Language","enabled": "Enabled",- "disabled": "Disabled"+ "disabled": "Disabled",+ "showPassword": "Show password",+ "hidePassword": "Hide password",+ "copyToClipboard": "Copy to clipboard",+ "loadingEmails": "Loading emails...",+ "loadingTotpCodes": "Loading TOTP codes...",+ "settings": "Settings",+ "recentEmails": "Recent emails",+ "loginCredentials": "Login credentials",+ "twoFactorAuthentication": "Two-factor authentication",+ "alias": "Alias",+ "notes": "Notes",+ "switchAccounts": "Switch accounts?",+ "addNewCredential": "Add new credential",+ "deleteEmail": "Delete email",+ "emailNotFound": "Email not found",+ "deleteEmailTitle": "Delete Email",+ "deleteEmailConfirm": "Are you sure you want to delete this email? This action cannot be undone.",+ "from": "From:",+ "to": "To:",+ "date": "Date:",+ "emailContent": "Email content",+ "attachments": "Attachments",+ "upgradeVault": "Upgrade Vault",+ "versionInformation": "Version Information",+ "upgrading": "Upgrading...",+ "fullName": "Full Name",+ "firstName": "First Name",+ "lastName": "Last Name",+ "birthDate": "Birth Date",+ "nickname": "Nickname",+ "email": "Email",+ "username": "Username",+ "password": "Password"}\ No newline at end of filediff --git a/apps/browser-extension/src/locales/en/credentials.json b/apps/browser-extension/src/locales/en/credentials.jsonindex b827273e0..7b31d8e9f 100644--- a/apps/browser-extension/src/locales/en/credentials.json+++ b/apps/browser-extension/src/locales/en/credentials.json@@ -26,6 +26,10 @@"noCredentials": "No credentials found","noCredentialsDescription": "Add your first credential to get started","searchCredentials": "Search credentials...",+ "searchPlaceholder": "Search credentials...",+ "welcomeTitle": "Welcome to AliasVault!",+ "welcomeDescription": "To use the AliasVault browser extension: navigate to a website and use the AliasVault autofill popup to create a new credential.",+ "manualCreationHint": "If you want to create manual identities, open the full AliasVault app via the popout icon in the top right corner.","lastUsed": "Last used","createdAt": "Created","updatedAt": "Last updated",diff --git a/apps/browser-extension/src/locales/en/settings.json b/apps/browser-extension/src/locales/en/settings.jsonindex 69bfcdfbb..856e801d4 100644--- a/apps/browser-extension/src/locales/en/settings.json+++ b/apps/browser-extension/src/locales/en/settings.json@@ -56,6 +56,31 @@"license": "License","saveSuccess": "Settings saved successfully","resetSuccess": "Settings reset successfully",+ "openInNewWindow": "Open in new window",+ "openWebApp": "Open web app",+ "loggedIn": "Logged in",+ "logout": "Logout",+ "globalSettings": "Global Settings",+ "autofillPopup": "Autofill popup",+ "activeOnAllSites": "Active on all sites (unless disabled below)",+ "disabledOnAllSites": "Disabled on all sites",+ "enabled": "Enabled",+ "disabled": "Disabled",+ "rightClickContextMenu": "Right-click context menu",+ "siteSpecificSettings": "Site-Specific Settings",+ "autofillPopupOn": "Autofill popup on: ",+ "enabledForThisSite": "Enabled for this site",+ "disabledForThisSite": "Disabled for this site",+ "temporarilyDisabledUntil": "Temporarily disabled until ",+ "resetAllSiteSettings": "Reset all site-specific settings",+ "appearance": "Appearance",+ "useDefault": "Use default",+ "light": "Light",+ "dark": "Dark",+ "keyboardShortcuts": "Keyboard Shortcuts",+ "configureKeyboardShortcuts": "Configure keyboard shortcuts",+ "configure": "Configure",+ "versionPrefix": "Version ","errors": {"invalidServerUrl": "Please enter a valid server URL","saveError": "Failed to save settings",diff --git a/apps/browser-extension/src/locales/nl/auth.json b/apps/browser-extension/src/locales/nl/auth.jsonindex 3121cfbea..3ad552365 100644--- a/apps/browser-extension/src/locales/nl/auth.json+++ b/apps/browser-extension/src/locales/nl/auth.json@@ -16,7 +16,7 @@"twoFactorNote": "Opmerking: als u geen toegang heeft tot uw authenticator-apparaat, kunt u uw 2FA resetten met een herstelcode door in te loggen via de website.","masterPassword": "Hoofdwachtwoord","unlockVault": "Kluis Ontgrendelen",- "unlockTitle": "Ontgrendel Uw Kluis",+ "unlockTitle": "Ontgrendel je kluis","unlockDescription": "Voer uw hoofdwachtwoord in om uw kluis te ontgrendelen.","logout": "Uitloggen","logoutConfirm": "Weet u zeker dat u wilt uitloggen?",diff --git a/apps/browser-extension/src/locales/nl/common.json b/apps/browser-extension/src/locales/nl/common.jsonindex b94ac8924..8e0119379 100644--- a/apps/browser-extension/src/locales/nl/common.json+++ b/apps/browser-extension/src/locales/nl/common.json@@ -27,5 +27,38 @@"openInNewWindow": "Openen in nieuw venster","language": "Taal","enabled": "Ingeschakeld",- "disabled": "Uitgeschakeld"+ "disabled": "Uitgeschakeld",+ "showPassword": "Wachtwoord tonen",+ "hidePassword": "Wachtwoord verbergen",+ "copyToClipboard": "Naar klembord kopiëren",+ "loadingEmails": "E-mails laden...",+ "loadingTotpCodes": "TOTP-codes laden...",+ "settings": "Instellingen",+ "recentEmails": "Recente e-mails",+ "loginCredentials": "Inloggegevens",+ "twoFactorAuthentication": "Twee-factor authenticatie",+ "alias": "Alias",+ "notes": "Notities",+ "switchAccounts": "Accounts wisselen?",+ "addNewCredential": "Nieuwe inloggegevens toevoegen",+ "deleteEmail": "E-mail verwijderen",+ "emailNotFound": "E-mail niet gevonden",+ "deleteEmailTitle": "E-mail Verwijderen",+ "deleteEmailConfirm": "Weet u zeker dat u deze e-mail wilt verwijderen? Deze actie kan niet ongedaan worden gemaakt.",+ "from": "Van:",+ "to": "Naar:",+ "date": "Datum:",+ "emailContent": "E-mailinhoud",+ "attachments": "Bijlagen",+ "upgradeVault": "Kluis Upgraden",+ "versionInformation": "Versieinformatie",+ "upgrading": "Aan het upgraden...",+ "fullName": "Volledige Naam",+ "firstName": "Voornaam",+ "lastName": "Achternaam",+ "birthDate": "Geboortedatum",+ "nickname": "Bijnaam",+ "email": "E-mail",+ "username": "Gebruikersnaam",+ "password": "Wachtwoord"}\ No newline at end of filediff --git a/apps/browser-extension/src/locales/nl/credentials.json b/apps/browser-extension/src/locales/nl/credentials.jsonindex fccf8c18a..4027a0cec 100644--- a/apps/browser-extension/src/locales/nl/credentials.json+++ b/apps/browser-extension/src/locales/nl/credentials.json@@ -26,6 +26,10 @@"noCredentials": "Geen inloggegevens gevonden","noCredentialsDescription": "Voeg uw eerste inloggegevens toe om te beginnen","searchCredentials": "Zoek inloggegevens...",+ "searchPlaceholder": "Inloggegevens zoeken...",+ "welcomeTitle": "Welkom bij AliasVault!",+ "welcomeDescription": "Om de AliasVault browser extensie te gebruiken: navigeer naar een website en gebruik de AliasVault automatisch invullen popup om nieuwe inloggegevens aan te maken.",+ "manualCreationHint": "Als je handmatig identiteiten wilt aanmaken, open dan de volledige AliasVault app via het uitklapicoon in de rechterbovenhoek.","lastUsed": "Laatst gebruikt","createdAt": "Aangemaakt","updatedAt": "Laatst bijgewerkt",diff --git a/apps/browser-extension/src/locales/nl/settings.json b/apps/browser-extension/src/locales/nl/settings.jsonindex a3d7730ab..9320ea490 100644--- a/apps/browser-extension/src/locales/nl/settings.json+++ b/apps/browser-extension/src/locales/nl/settings.json@@ -56,6 +56,31 @@"license": "Licentie","saveSuccess": "Instellingen succesvol opgeslagen","resetSuccess": "Instellingen succesvol gereset",+ "openInNewWindow": "Openen in nieuw venster",+ "openWebApp": "Web-app openen",+ "loggedIn": "Ingelogd",+ "logout": "Uitloggen",+ "globalSettings": "Globale Instellingen",+ "autofillPopup": "Automatisch invullen popup",+ "activeOnAllSites": "Actief op alle sites (tenzij hieronder uitgeschakeld)",+ "disabledOnAllSites": "Uitgeschakeld op alle sites",+ "enabled": "Ingeschakeld",+ "disabled": "Uitgeschakeld",+ "rightClickContextMenu": "Rechts-klik contextmenu",+ "siteSpecificSettings": "Site-specifieke Instellingen",+ "autofillPopupOn": "Automatisch invullen popup op: ",+ "enabledForThisSite": "Ingeschakeld voor deze site",+ "disabledForThisSite": "Uitgeschakeld voor deze site",+ "temporarilyDisabledUntil": "Tijdelijk uitgeschakeld tot ",+ "resetAllSiteSettings": "Alle site-specifieke instellingen resetten",+ "appearance": "Uiterlijk",+ "useDefault": "Standaard gebruiken",+ "light": "Licht",+ "dark": "Donker",+ "keyboardShortcuts": "Toetsenbordsnelkoppelingen",+ "configureKeyboardShortcuts": "Toetsenbordsnelkoppelingen configureren",+ "configure": "Configureren",+ "versionPrefix": "Versie ","errors": {"invalidServerUrl": "Voer een geldige server-URL in","saveError": "Opslaan van instellingen mislukt",diff --git a/apps/browser-extension/src/utils/contentTranslations.ts b/apps/browser-extension/src/utils/contentTranslations.tsnew file mode 100644index 000000000..cffe2d7bc--- /dev/null+++ b/apps/browser-extension/src/utils/contentTranslations.ts@@ -0,0 +1,162 @@+import { storage } from '#imports';++/**+ * Translation keys for content scripts+ */+export interface IContentTranslations {+ // Common+ new: string;+ cancel: string;+ search: string;++ // Status messages+ vaultLocked: string;+ creatingNewAlias: string;+ noMatchesFound: string;++ // Form labels and placeholders+ searchVault: string;+ serviceName: string;+ email: string;+ username: string;+ generatedPassword: string;+ enterServiceName: string;+ enterEmailAddress: string;+ enterUsername: string;++ // Context menu+ hideFor1Hour: string;+ hidePermanently: string;++ // Create alias popup+ createRandomAlias: string;+ createUsernamePassword: string;+ randomAlias: string;+ usernamePassword: string;+ createAndSaveAlias: string;+ createAndSaveCredential: string;+ randomIdentityDescription: string;+ manualCredentialDescription: string;++ // Error messages+ failedToCreateIdentity: string;+ enterEmailAndOrUsername: string;++ // Context menu+ autofillWithAliasVault: string;+ generateRandomPassword: string;+ passwordCopiedToClipboard: string;+}++/**+ * English translations+ */+const enTranslations: IContentTranslations = {+ new: 'New',+ cancel: 'Cancel',+ search: 'Search',+ vaultLocked: 'AliasVault is locked.',+ creatingNewAlias: 'Creating new alias...',+ noMatchesFound: 'No matches found',+ searchVault: 'Search vault...',+ serviceName: 'Service name',+ email: 'Email',+ username: 'Username',+ generatedPassword: 'Generated Password',+ enterServiceName: 'Enter service name',+ enterEmailAddress: 'Enter email address',+ enterUsername: 'Enter username',+ hideFor1Hour: 'Hide for 1 hour (current site)',+ hidePermanently: 'Hide permanently (current site)',+ createRandomAlias: 'Create random alias',+ createUsernamePassword: 'Create username/password',+ randomAlias: 'Random alias',+ usernamePassword: 'Username/password',+ createAndSaveAlias: 'Create and save alias',+ createAndSaveCredential: 'Create and save credential',+ randomIdentityDescription: 'Generate a random identity with a random email address accessible in AliasVault.',+ manualCredentialDescription: 'Specify your own email address and username.',+ failedToCreateIdentity: 'Failed to create identity. Please try again.',+ enterEmailAndOrUsername: 'Enter email and/or username',+ autofillWithAliasVault: 'Autofill with AliasVault',+ generateRandomPassword: 'Generate random password (copy to clipboard)',+ passwordCopiedToClipboard: 'Password copied to clipboard'+};++/**+ * Dutch translations+ */+const nlTranslations: IContentTranslations = {+ new: 'Nieuw',+ cancel: 'Annuleren',+ search: 'Zoeken',+ vaultLocked: 'AliasVault is vergrendeld.',+ creatingNewAlias: 'Nieuwe alias aanmaken...',+ noMatchesFound: 'Geen resultaten gevonden',+ searchVault: 'Kluis doorzoeken...',+ serviceName: 'Servicenaam',+ email: 'E-mail',+ username: 'Gebruikersnaam',+ generatedPassword: 'Gegenereerd wachtwoord',+ enterServiceName: 'Voer servicenaam in',+ enterEmailAddress: 'Voer e-mailadres in',+ enterUsername: 'Voer gebruikersnaam in',+ hideFor1Hour: 'Verberg voor 1 uur (huidige site)',+ hidePermanently: 'Permanent verbergen (huidige site)',+ createRandomAlias: 'Willekeurige alias aanmaken',+ createUsernamePassword: 'Gebruikersnaam/wachtwoord aanmaken',+ randomAlias: 'Willekeurige alias',+ usernamePassword: 'Gebruikersnaam/wachtwoord',+ createAndSaveAlias: 'Alias aanmaken en opslaan',+ createAndSaveCredential: 'Inloggegevens aanmaken en opslaan',+ randomIdentityDescription: 'Genereer een willekeurige identiteit met een willekeurig e-mailadres toegankelijk in AliasVault.',+ manualCredentialDescription: 'Specificeer je eigen e-mailadres en gebruikersnaam.',+ failedToCreateIdentity: 'Identiteit aanmaken mislukt. Probeer opnieuw.',+ enterEmailAndOrUsername: 'Voer e-mail en/of gebruikersnaam in',+ autofillWithAliasVault: 'Automatisch invullen met AliasVault',+ generateRandomPassword: 'Willekeurig wachtwoord genereren (kopiëren naar klembord)',+ passwordCopiedToClipboard: 'Wachtwoord gekopieerd naar klembord'+};++/**+ * All available translations+ */+const translations = {+ en: enTranslations,+ nl: nlTranslations+};++/**+ * Get current language from storage+ */+export async function getCurrentLanguage(): Promise<string> {+ // Try to get from localStorage first (same as React app)+ try {+ const stored = localStorage.getItem('aliasvault-language');+ if (stored && ['en', 'nl'].includes(stored)) {+ return stored;+ }+ } catch {+ // localStorage might not be available in all contexts+ }++ // Fall back to storage API+ const lang = await storage.getItem('local:aliasvault-language') as string;+ return lang || 'en';+}++/**+ * Get translation for a key+ */+export async function t(key: keyof IContentTranslations): Promise<string> {+ const lang = await getCurrentLanguage();+ return translations[lang as keyof typeof translations]?.[key] || translations.en[key];+}++/**+ * Get all translations for current language+ */+export async function getTranslations(): Promise<IContentTranslations> {+ const lang = await getCurrentLanguage();+ return translations[lang as keyof typeof translations] || translations.en;+}diff --git a/apps/browser-extension/src/utils/i18n.ts b/apps/browser-extension/src/utils/i18n.tsindex 1a68c8a3f..d7e525ff1 100644--- a/apps/browser-extension/src/utils/i18n.ts+++ b/apps/browser-extension/src/utils/i18n.ts@@ -2,17 +2,16 @@ import i18n from 'i18next';import { initReactI18next } from 'react-i18next';// Import all translations-import commonEn from '../locales/en/common.json';import authEn from '../locales/en/auth.json';+import commonEn from '../locales/en/common.json';import credentialsEn from '../locales/en/credentials.json';-import settingsEn from '../locales/en/settings.json';import emailsEn from '../locales/en/emails.json';--import commonNl from '../locales/nl/common.json';+import settingsEn from '../locales/en/settings.json';import authNl from '../locales/nl/auth.json';+import commonNl from '../locales/nl/common.json';import credentialsNl from '../locales/nl/credentials.json';-import settingsNl from '../locales/nl/settings.json';import emailsNl from '../locales/nl/emails.json';+import settingsNl from '../locales/nl/settings.json';const resources = {en: {@@ -32,6 +31,9 @@ const resources = {};// Detect browser language+/**+ * Detect the user's preferred language from localStorage or browser settings+ */const detectLanguage = (): string => {// Check localStorage firstconst stored = localStorage.getItem('aliasvault-language');