Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update translations (#2159)

Leendert de Borst2afb6e33c2d8
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
index 11c323d53..f4ca2f014 100644
--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
@@ -13,6 +13,7 @@ import { SqliteClient } from '@aliasvault/client/database/SqliteClient';
import { FaviconService } from '@aliasvault/client/items/FaviconService';
import { generateTotpCode } from '@aliasvault/client/items/TotpUtility';
import { filterItems, AutofillMatchingMode, extractRootDomain, isUrlAlreadyLinked } from '@aliasvault/client/rust/RustCore';
+import { familySharingText } from '@aliasvault/client/sharing/FamilySharingView';
import { SharingService } from '@aliasvault/client/sharing/SharingService';
import { clearDirtyScopes, getDirtyScopes } from '@aliasvault/client/sync/VaultDirtyState';
import { vaultRequiresManifestMigration, VaultMigrationKind } from '@aliasvault/client/sync/VaultManifestMigration';
@@ -22,7 +23,6 @@ import { type IVaultSyncEngineHost, type VaultSyncOptions, type VaultSyncPhase a
import { getVaultSyncHoldReason } from '@aliasvault/client/sync/VaultSyncHold';
import { bytesToBase64 } from '@aliasvault/client/utilities/Base64';
import { FieldKey, ItemTypes, createSystemField, type Item } from '@aliasvault/models/vault';
-import { storage } from 'wxt/utils/storage';
import { clearAllSavePromptState } from '@/entrypoints/background/SavePromptStateHandler';
import { handleClearTwoFactorState } from '@/entrypoints/background/TwoFactorStateHandler';
@@ -51,6 +51,8 @@ import type { ItemUsageAction } from '@aliasvault/client/database';
import type { ISqliteDatabase, SqliteValue } from '@aliasvault/client/platform';
import type { UnlockKeyDerivationParams } from '@aliasvault/models/metadata';
+import { storage } from '#imports';
+
/**
* Cache for the SqliteClient to avoid repeated decryption and initialization.
* The cached instance is the single source of truth for the in-memory vault.
@@ -1354,9 +1356,9 @@ type SharingActionResponse = { success: boolean; error?: string; apiErrorCode?:
/**
* Put the outcome of a sharing engine operation into the words the family sharing page shows.
* @param result - what the sync engine reported.
- * @param failureKey - the translation key of the message for a failure without a more specific reason.
+ * @param failureMessage - the message for a failure without a more specific reason.
*/
-async function sharingActionResponse(result: SharingOperationResult, failureKey: string): Promise<SharingActionResponse> {
+async function sharingActionResponse(result: SharingOperationResult, failureMessage: string): Promise<SharingActionResponse> {
if (result.success) {
return { success: true };
}
@@ -1366,7 +1368,7 @@ async function sharingActionResponse(result: SharingOperationResult, failureKey:
}
if (result.vaultUpgradeRequired) {
- return { success: false, error: await t('sharing.family.errors.vaultUpgradeRequired') };
+ return { success: false, error: familySharingText.errors.vaultUpgradeRequired };
}
if (result.errorCode === AppErrorCode.VAULT_LOCKED) {
@@ -1379,7 +1381,7 @@ async function sharingActionResponse(result: SharingOperationResult, failureKey:
* appended the way the upload path does it.
*/
const detail = result.error && result.error.length > 0 ? ` [${result.error}]` : '';
- return { success: false, error: `${await t(failureKey)}${detail}` };
+ return { success: false, error: `${failureMessage}${detail}` };
}
/**
@@ -1395,7 +1397,7 @@ export async function handleGroupCreateVault(message: { groupId: string; name: s
void handleFullVaultSync().catch(error => logFailure('Background sync after creating a shared manifest failed', error));
}
- return sharingActionResponse(result, 'sharing.family.errors.createVaultFailed');
+ return sharingActionResponse(result, familySharingText.errors.createVaultFailed);
}
/**
@@ -1405,7 +1407,7 @@ export async function handleGroupCreateVault(message: { groupId: string; name: s
* @param message - the family, the manifest, and the details to change.
*/
export async function handleGroupUpdateVault(message: { groupId: string; manifestId: string; details: SharedManifestDetails }): Promise<SharingActionResponse> {
- return sharingActionResponse(await vaultSync.updateSharedManifest(message.groupId, message.manifestId, message.details), 'common.errors.unknownErrorTryAgain');
+ return sharingActionResponse(await vaultSync.updateSharedManifest(message.groupId, message.manifestId, message.details), await t('common.errors.unknownErrorTryAgain'));
}
/**
@@ -1415,7 +1417,7 @@ export async function handleGroupUpdateVault(message: { groupId: string; manifes
* @param message - the family, the manifest, and the member being invited.
*/
export async function handleGroupInviteMember(message: { groupId: string; manifestId: string; userId: string }): Promise<SharingActionResponse> {
- return sharingActionResponse(await vaultSync.inviteToSharedManifest(message.groupId, message.manifestId, message.userId), 'sharing.family.errors.inviteFailed');
+ return sharingActionResponse(await vaultSync.inviteToSharedManifest(message.groupId, message.manifestId, message.userId), familySharingText.errors.inviteFailed);
}
/**
@@ -1438,6 +1440,6 @@ export async function handleGroupRevokeAccess(message: { groupId: string; manife
}
logFailure('Failed to revoke shared manifest access', error);
- return { success: false, error: await t('sharing.family.errors.revokeAccessFailed') };
+ return { success: false, error: familySharingText.errors.revokeAccessFailed };
}
}
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderIcon.tsx b/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderIcon.tsx
index 47adf2501..4fac9df14 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderIcon.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderIcon.tsx
@@ -1,5 +1,5 @@
+import { familySharingText } from '@aliasvault/client/sharing/FamilySharingView';
import React from 'react';
-import { useTranslation } from 'react-i18next';
type FolderIconProps = {
isShared?: boolean;
@@ -17,8 +17,6 @@ const FolderIcon: React.FC<FolderIconProps> = ({
className = 'w-4 h-4',
badgeClassName = 'bg-white dark:bg-gray-800 ring-gray-200 dark:ring-gray-600',
}) => {
- const { t } = useTranslation();
-
return (
<span className="relative flex-shrink-0">
{variant === 'filled' ? (
@@ -32,7 +30,7 @@ const FolderIcon: React.FC<FolderIconProps> = ({
)}
{isShared && (
<span
- title={t('sharing.family.sharedVault')}
+ title={familySharingText.sharedFolder}
className={`absolute -bottom-1 -right-1 flex items-center justify-center w-2.5 h-2.5 rounded-full ring-1 ${badgeClassName}`}
>
<svg className="w-2 h-2 text-primary-500 dark:text-primary-400" viewBox="0 0 24 24" fill="currentColor">
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx
index c43efbad1..f83cce5d1 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/FamilySharingSettings.tsx
@@ -1,6 +1,6 @@
import { ApiRequestError } from '@aliasvault/client/api/errors/ApiRequestError';
import { MasterPasswordService } from '@aliasvault/client/auth/MasterPasswordService';
-import { canAdministerGroup, describeMemberAccess, holdsManifestKey, ownUserIdIn, roleTranslationKey, sharingErrorTranslationKey } from '@aliasvault/client/sharing/FamilySharingView';
+import { canAdministerGroup, describeMemberAccess, familySharingText, holdsManifestKey, ownUserIdIn, roleLabel, sharingErrorMessage } from '@aliasvault/client/sharing/FamilySharingView';
import { multiManifestRendering } from '@aliasvault/client/sharing/MultiManifestRendering';
import { SharingService } from '@aliasvault/client/sharing/SharingService';
import React, { useCallback, useEffect, useState } from 'react';
@@ -69,11 +69,11 @@ const FamilySharingSettings: React.FC = () => {
setVaultNames(sqliteClient ? multiManifestRendering.displayNames(sqliteClient) : {});
setError(null);
} catch {
- setError(t('sharing.family.errors.loadFailed'));
+ setError(familySharingText.errors.loadFailed);
} finally {
setIsInitialLoading(false);
}
- }, [webApi, sqliteClient, t, setIsInitialLoading]);
+ }, [webApi, sqliteClient, setIsInitialLoading]);
useEffect(() => {
loadOverview();
@@ -120,9 +120,9 @@ const FamilySharingSettings: React.FC = () => {
? actionError.message
: actionError instanceof ApiRequestError ? actionError.apiErrorCode : null;
- const knownErrorKey = sharingErrorTranslationKey(code);
- if (knownErrorKey) {
- return t(knownErrorKey);
+ const knownError = sharingErrorMessage(code);
+ if (knownError) {
+ return knownError;
}
return code !== null ? `${fallback} [${code}]` : fallback;
@@ -154,7 +154,7 @@ const FamilySharingSettings: React.FC = () => {
unwrap(await sendMessage('GROUP_CREATE_VAULT', { groupId: group.groupId, name }));
setNewVaultNames(previous => ({ ...previous, [group.groupId]: '' }));
await loadStoredDatabase();
- }, t('sharing.family.errors.createVaultFailed'));
+ }, familySharingText.errors.createVaultFailed);
};
/**
@@ -179,8 +179,8 @@ const FamilySharingSettings: React.FC = () => {
const inviteMember = (group: GroupInfo, manifest: SharedManifestInfo, member: GroupMemberInfo): Promise<void> => run(async () => {
unwrap(await sendMessage('GROUP_INVITE_MEMBER', { groupId: group.groupId, manifestId: manifest.manifestId, userId: member.userId }));
await loadStoredDatabase();
- setNotice(t('sharing.family.invitationSent', { username: member.username }));
- }, t('sharing.family.errors.inviteFailed'));
+ setNotice(familySharingText.invitationSent(member.username));
+ }, familySharingText.errors.inviteFailed);
/**
* Accept an invitation, opening the shared manifest it names.
@@ -191,7 +191,7 @@ const FamilySharingSettings: React.FC = () => {
await sendMessage('FULL_VAULT_SYNC', {});
// Same as creating one: the sync wrote the joined vault to storage, and this window has to pick it up to render it.
await loadStoredDatabase();
- }, t('sharing.family.errors.invitationGone'));
+ }, familySharingText.errors.invitationGone);
/**
* Carry out the access removal the confirmation dialog was about.
@@ -206,7 +206,7 @@ const FamilySharingSettings: React.FC = () => {
return run(async () => {
unwrap(await sendMessage('GROUP_REVOKE_ACCESS', { groupId: removal.group.groupId, manifestId: removal.manifest.manifestId, userId: removal.member.userId }));
await loadStoredDatabase();
- }, t('sharing.family.errors.revokeAccessFailed'));
+ }, familySharingText.errors.revokeAccessFailed);
};
/**
@@ -226,15 +226,15 @@ const FamilySharingSettings: React.FC = () => {
throw new Error(t('common.errors.wrongPassword'));
}
- throw new Error(apiErrorMessage(deleteError, t('sharing.family.errors.deleteVaultFailed')));
+ throw new Error(apiErrorMessage(deleteError, familySharingText.errors.deleteVaultFailed));
}
setPendingVaultDelete(null);
await run(async () => {
await sendMessage('FULL_VAULT_SYNC', {});
await loadStoredDatabase();
- setNotice(t('sharing.family.vaultDeleted'));
- }, t('sharing.family.errors.deleteVaultFailed'));
+ setNotice(familySharingText.vaultDeleted);
+ }, familySharingText.errors.deleteVaultFailed);
};
/**
@@ -253,29 +253,29 @@ const FamilySharingSettings: React.FC = () => {
* What to call a shared manifest on screen.
* @param manifest - the vault.
*/
- const vaultLabel = (manifest: SharedManifestInfo): string => vaultNames[manifest.manifestId.toLowerCase()] ?? t('sharing.family.unnamedVault');
+ const vaultLabel = (manifest: SharedManifestInfo): string => vaultNames[manifest.manifestId.toLowerCase()] ?? familySharingText.sharedFolder;
/**
* The title and message of the confirmation dialog.
*/
const removalDialog = (): { title: string; message: string; confirmText: string; warning?: string } => {
if (!pendingRemoval) {
- return { title: '', message: '', confirmText: t('sharing.revoke') };
+ return { title: '', message: '', confirmText: familySharingText.revoke };
}
if (pendingRemoval.isSelf) {
return {
- title: t('sharing.family.leaveVault'),
- message: t('sharing.family.leaveVaultConfirm', { vault: vaultLabel(pendingRemoval.manifest) }),
- confirmText: t('sharing.family.leaveVault'),
+ title: familySharingText.leaveVault,
+ message: familySharingText.leaveVaultConfirm(vaultLabel(pendingRemoval.manifest)),
+ confirmText: familySharingText.leaveVault,
};
}
return {
- title: t('sharing.revoke'),
- message: t('sharing.family.revokeAccessConfirm', { username: pendingRemoval.member.username, vault: vaultLabel(pendingRemoval.manifest) }),
- confirmText: t('sharing.revoke'),
- warning: t('sharing.family.revokeAccessWarning'),
+ title: familySharingText.revoke,
+ message: familySharingText.revokeAccessConfirm(pendingRemoval.member.username, vaultLabel(pendingRemoval.manifest)),
+ confirmText: familySharingText.revoke,
+ warning: familySharingText.revokeAccessWarning,
};
};
@@ -307,8 +307,8 @@ const FamilySharingSettings: React.FC = () => {
isOpen={pendingVaultDelete?.stage === 'confirm'}
onClose={() => setPendingVaultDelete(null)}
onConfirm={() => setPendingVaultDelete(previous => (previous ? { ...previous, stage: 'password' } : previous))}
- title={t('sharing.family.deleteVault')}
- message={t('sharing.family.deleteVaultConfirm', { vault: pendingVaultDelete ? vaultLabel(pendingVaultDelete.manifest) : '' })}
+ title={familySharingText.deleteVault}
+ message={familySharingText.deleteVaultConfirm(pendingVaultDelete ? vaultLabel(pendingVaultDelete.manifest) : '')}
confirmText={t('common.delete')}
/>
@@ -316,19 +316,19 @@ const FamilySharingSettings: React.FC = () => {
isOpen={pendingVaultDelete?.stage === 'password'}
onClose={() => setPendingVaultDelete(null)}
onConfirm={deleteSharedVault}
- title={t('sharing.family.deleteVault')}
- message={t('sharing.family.deleteVaultPasswordPrompt', { vault: pendingVaultDelete ? vaultLabel(pendingVaultDelete.manifest) : '' })}
+ title={familySharingText.deleteVault}
+ message={familySharingText.deleteVaultPasswordPrompt(pendingVaultDelete ? vaultLabel(pendingVaultDelete.manifest) : '')}
confirmText={t('common.delete')}
/>
<div>
<div className="flex items-center gap-2">
- <PageTitle>{t('sharing.family.title')}</PageTitle>
+ <PageTitle>{familySharingText.title}</PageTitle>
<span className="px-2 py-0.5 text-xs font-semibold rounded-full bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 uppercase tracking-wide">
- {t('sharing.family.beta')}
+ {familySharingText.beta}
</span>
</div>
- <p className="text-sm text-gray-600 dark:text-gray-400">{t('sharing.family.description')}</p>
+ <p className="text-sm text-gray-600 dark:text-gray-400">{familySharingText.description}</p>
</div>
{error && <AlertMessage type="error" message={error} />}
@@ -336,13 +336,13 @@ const FamilySharingSettings: React.FC = () => {
{receivedInvitations.length > 0 && (
<section>
- <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-2">{t('sharing.family.invitations')}</h3>
+ <h3 className="text-md font-semibold text-gray-900 dark:text-white mb-2">{familySharingText.invitations}</h3>
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 divide-y divide-gray-200 dark:divide-gray-700">
{receivedInvitations.map(invitation => (
<div key={invitation.id} className="p-3 space-y-2">
<div>
- <p className="font-medium text-gray-900 dark:text-white">{invitationNames[invitation.id] ?? t('sharing.family.unnamedVault')}</p>
- <p className="text-sm text-gray-500 dark:text-gray-400">{t('sharing.family.invitedBy', { username: invitation.inviterUsername })}</p>
+ <p className="font-medium text-gray-900 dark:text-white">{invitationNames[invitation.id] ?? familySharingText.sharedFolder}</p>
+ <p className="text-sm text-gray-500 dark:text-gray-400">{familySharingText.invitedBy(invitation.inviterUsername)}</p>
</div>
<div className="flex gap-2">
<button
@@ -350,14 +350,14 @@ const FamilySharingSettings: React.FC = () => {
onClick={() => acceptInvitation(invitation.id)}
className="px-3 py-1.5 text-sm rounded-md bg-primary-500 hover:bg-primary-600 disabled:opacity-50 text-white"
>
- {t('sharing.family.accept')}
+ {familySharingText.accept}
</button>
<button
disabled={busy}
- onClick={() => run(() => SharingService.declineInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone'))}
+ onClick={() => run(() => SharingService.declineInvitation(webApi, invitation.id), familySharingText.errors.invitationGone)}
className="px-3 py-1.5 text-sm rounded-md bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 disabled:opacity-50 text-gray-700 dark:text-gray-300"
>
- {t('sharing.family.decline')}
+ {familySharingText.decline}
</button>
</div>
</div>
@@ -367,7 +367,7 @@ const FamilySharingSettings: React.FC = () => {
)}
{groups.length === 0 && receivedInvitations.length === 0 && (
- <AlertMessage type="info" message={t('sharing.family.notAvailable')} />
+ <AlertMessage type="info" message={familySharingText.notAvailable} />
)}
{groups.map(group => {
@@ -379,7 +379,7 @@ const FamilySharingSettings: React.FC = () => {
{/* The family's members. */}
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-3">
<button onClick={() => toggleRoster(group.groupId)} className="flex items-center justify-between w-full text-left">
- <span className="font-medium text-gray-900 dark:text-white">{t('sharing.members')} ({group.members.length})</span>
+ <span className="font-medium text-gray-900 dark:text-white">{familySharingText.members} ({group.members.length})</span>
<svg className={`w-5 h-5 text-gray-500 transition-transform ${isRosterExpanded(group.groupId) ? 'rotate-180' : ''}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
</svg>
@@ -395,9 +395,9 @@ const FamilySharingSettings: React.FC = () => {
<li key={member.userId} className="flex items-center justify-between gap-2 py-1.5 first:pt-0 last:pb-0">
<div className="min-w-0">
<p className="text-sm text-gray-900 dark:text-white truncate">
- {member.username}{isSelf && ` (${t('sharing.family.you')})`}
+ {member.username}{isSelf && ` (${familySharingText.you})`}
</p>
- <p className="text-xs text-gray-500 dark:text-gray-400">{t(roleTranslationKey(member))}</p>
+ <p className="text-xs text-gray-500 dark:text-gray-400">{roleLabel(member)}</p>
</div>
</li>
);
@@ -410,7 +410,7 @@ const FamilySharingSettings: React.FC = () => {
{/* One block per shared folder, each with the members who can open it. */}
{group.manifests.length > 0 && (
<div className="space-y-2">
- <h3 className="text-md font-semibold text-gray-900 dark:text-white">{t('sharing.family.sharedFolders')}</h3>
+ <h3 className="text-md font-semibold text-gray-900 dark:text-white">{familySharingText.sharedFolders}</h3>
{group.manifests.map(manifest => {
const iHoldKey = holdsManifestKey(manifest, myUserId);
@@ -454,7 +454,7 @@ const FamilySharingSettings: React.FC = () => {
}}
className="w-full px-3 py-2 text-left text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-700"
>
- {t('sharing.family.deleteVault')}
+ {familySharingText.deleteVault}
</button>
</div>
</>
@@ -465,7 +465,7 @@ const FamilySharingSettings: React.FC = () => {
{/* Inviting somebody encrypts this vault's key for them, which an admin who holds no grant on it cannot do. */}
{canAdminister && !iHoldKey && (
- <p className="text-xs text-gray-500 dark:text-gray-400">{t('sharing.family.cannotInviteWithoutAccess')}</p>
+ <p className="text-xs text-gray-500 dark:text-gray-400">{familySharingText.cannotInviteWithoutAccess}</p>
)}
<ul className="divide-y divide-gray-100 dark:divide-gray-700">
@@ -477,10 +477,10 @@ const FamilySharingSettings: React.FC = () => {
<li key={member.userId} className="flex items-center justify-between gap-2 py-1.5 first:pt-0 last:pb-0">
<div className="min-w-0">
<p className="text-sm text-gray-900 dark:text-white truncate">
- {member.username}{isSelf && ` (${t('sharing.family.you')})`}
+ {member.username}{isSelf && ` (${familySharingText.you})`}
</p>
<p className="text-xs text-gray-500 dark:text-gray-400">
- {t(access.statusKey)}
+ {access.statusText}
</p>
</div>
@@ -490,7 +490,7 @@ const FamilySharingSettings: React.FC = () => {
onClick={() => setPendingRemoval({ group, manifest, member, isSelf })}
className="shrink-0 px-2 py-1 text-xs rounded-md text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 disabled:opacity-50"
>
- {t('sharing.family.leaveVault')}
+ {familySharingText.leaveVault}
</button>
)}
@@ -500,28 +500,28 @@ const FamilySharingSettings: React.FC = () => {
onClick={() => setPendingRemoval({ group, manifest, member, isSelf })}
className="shrink-0 px-2 py-1 text-xs rounded-md text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 disabled:opacity-50"
>
- {t('sharing.revoke')}
+ {familySharingText.revoke}
</button>
)}
{access.canWithdraw && invitation && (
<button
disabled={busy}
- onClick={() => run(() => SharingService.withdrawInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone'))}
+ onClick={() => run(() => SharingService.withdrawInvitation(webApi, invitation.id), familySharingText.errors.invitationGone)}
className="shrink-0 px-2 py-1 text-xs rounded-md text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50"
>
- {t('sharing.family.withdraw')}
+ {familySharingText.withdraw}
</button>
)}
{access.canInvite && (
<button
disabled={busy || !access.isReadyForInvite}
- title={access.isReadyForInvite ? undefined : t('sharing.family.errors.userNotReady')}
+ title={access.isReadyForInvite ? undefined : familySharingText.errors.userNotReady}
onClick={() => inviteMember(group, manifest, member)}
className="shrink-0 px-2 py-1 text-xs rounded-md bg-primary-500 hover:bg-primary-600 disabled:opacity-50 text-white"
>
- {t('sharing.family.invite')}
+ {familySharingText.invite}
</button>
)}
</li>
@@ -539,13 +539,13 @@ const FamilySharingSettings: React.FC = () => {
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-3 space-y-2">
{group.manifests.length === 0 && (
<p className="text-sm text-gray-600 dark:text-gray-400">
- {canAdminister ? t('sharing.family.noSharedVaultAdmin') : t('sharing.family.noSharedVaultMember')}
+ {canAdminister ? familySharingText.noSharedVaultAdmin : familySharingText.noSharedVaultMember}
</p>
)}
{canAdminister && (
<>
- <p className="font-medium text-gray-900 dark:text-white">{t('sharing.family.createSharedVault')}</p>
+ <p className="font-medium text-gray-900 dark:text-white">{familySharingText.createSharedVault}</p>
<form
className="flex gap-2"
onSubmit={event => {
@@ -557,7 +557,7 @@ const FamilySharingSettings: React.FC = () => {
type="text"
value={newVaultNames[group.groupId] ?? ''}
onChange={event => setNewVaultNames(previous => ({ ...previous, [group.groupId]: event.target.value }))}
- placeholder={t('sharing.family.vaultNamePlaceholder')}
+ placeholder={familySharingText.vaultNamePlaceholder}
className="flex-1 min-w-0 px-3 py-1.5 text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
/>
<button
@@ -565,7 +565,7 @@ const FamilySharingSettings: React.FC = () => {
disabled={busy}
className="shrink-0 px-3 py-1.5 text-sm rounded-md bg-primary-500 hover:bg-primary-600 disabled:opacity-50 text-white"
>
- {t('sharing.family.create')}
+ {familySharingText.create}
</button>
</form>
</>
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
index e9d41306b..fc3eeca20 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
@@ -1,4 +1,5 @@
import { AppInfo } from '@aliasvault/client/platform/AppInfo';
+import { familySharingText } from '@aliasvault/client/sharing/FamilySharingView';
import { CapabilityKeys } from '@aliasvault/models/webapi';
import React, { useEffect, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -354,9 +355,9 @@ const Settings: React.FC = () => {
d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
/>
</svg>
- <span className="text-gray-900 dark:text-white text-left">{t('settings.familySharing')}</span>
+ <span className="text-gray-900 dark:text-white text-left">{familySharingText.title}</span>
<span className="ml-2 px-1.5 py-0.5 text-[10px] font-semibold rounded-full bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 uppercase tracking-wide">
- {t('sharing.family.beta')}
+ {familySharingText.beta}
</span>
</div>
<svg
diff --git a/apps/browser-extension/src/i18n/locales/en.json b/apps/browser-extension/src/i18n/locales/en.json
index 1c7e4e602..ca79b281c 100644
--- a/apps/browser-extension/src/i18n/locales/en.json
+++ b/apps/browser-extension/src/i18n/locales/en.json
@@ -537,8 +537,8 @@
"newPassword": "New Password",
"confirmNewPassword": "Confirm New Password",
"passwordsDoNotMatch": "New passwords do not match",
- "passwordTooShort": "New password must be at least {{minLength}} characters long",
- "success": "Your password has been changed successfully."
+ "passwordTooShort": "Password must be at least {{minLength}} characters long.",
+ "success": "Password changed successfully"
},
"activeSessions": {
"title": "Active Sessions",
@@ -582,63 +582,6 @@
"enableSuccess": "PIN unlock enabled successfully!",
"pinLocked": "PIN unlock has been disabled. Please use your master password to unlock your vault.",
"pinSecurityWarning": "PIN unlock in the browser extension can be less secure than your master password, as PINs typically have lower entropy and may be brute-forced if your device is compromised. Use it only on devices you fully trust."
- },
- "familySharing": "Family Sharing"
- },
- "sharing": {
- "members": "Family members",
- "owner": "Owner",
- "revoke": "Revoke",
- "family": {
- "title": "Family Sharing",
- "beta": "Beta",
- "description": "Share folders with the people in your family.",
- "notAvailable": "Family sharing is not enabled for this account yet. Once a family has been set up for you, it appears here.",
- "invitations": "Invitations",
- "invitedBy": "Invited by {{username}}",
- "accept": "Accept",
- "decline": "Decline",
- "noSharedVaultAdmin": "This family has no shared folder yet. Creating one adds a folder to your vault that every member you invite can see.",
- "noSharedVaultMember": "Nobody has created a shared folder for this family yet.",
- "createSharedVault": "Create a shared folder",
- "sharedFolders": "Shared folders",
- "hasAccess": "Has access",
- "invited": "Invited",
- "you": "You",
- "admin": "Admin",
- "member": "Member",
- "withdraw": "Withdraw",
- "leaveVault": "Leave folder",
- "leaveVaultConfirm": "Leave “{{vault}}”? You lose access to it, but stay in the family.",
- "cannotInviteWithoutAccess": "You do not have access to this folder, so you cannot invite anyone to it. Ask a member who has access to invite you first.",
- "errors": {
- "loadFailed": "Family sharing could not be loaded.",
- "createVaultFailed": "The shared folder could not be created. Please try again.",
- "vaultUpgradeRequired": "Your vault has to finish upgrading before it can be shared.",
- "revokeAccessFailed": "The access could not be changed. Please try again.",
- "inviteFailed": "The invitation could not be sent. Please try again.",
- "userNotReady": "That account has to finish upgrading AliasVault before a folder can be shared with it.",
- "alreadyInvited": "That person has already been invited.",
- "invitationGone": "That invitation is no longer available.",
- "invitationKeyOutdated": "This invitation is no longer valid because the shared folder's key has changed. Ask for a new invitation.",
- "notFamilyMember": "That person is not in this family.",
- "alreadyHasAccess": "That person already has access to this folder.",
- "lastMemberWithAccess": "Somebody has to be able to open the shared folder. Give another member access to it first.",
- "vaultLimitReached": "Max amount of shared folders reached.",
- "deleteVaultFailed": "The shared folder could not be deleted. Please try again."
- },
- "vaultNamePlaceholder": "Folder name, for example Streaming",
- "create": "Create",
- "invite": "Invite",
- "invitationSent": "Invitation sent to {{username}}.",
- "noAccess": "No access",
- "revokeAccessConfirm": "Take {{username}} out of “{{vault}}”? They lose access to it right away, but stay in the family.",
- "revokeAccessWarning": "They keep any copy of this folder they already downloaded. Change the passwords in it that you do not want them to keep using.",
- "deleteVault": "Delete folder",
- "deleteVaultConfirm": "Permanently delete “{{vault}}”? Every member of the family loses this folder and everything in it. This cannot be undone.",
- "deleteVaultPasswordPrompt": "Enter your master password to confirm deleting “{{vault}}” for the whole family.",
- "vaultDeleted": "The shared folder has been deleted.",
- "unnamedVault": "Shared folder"
}
},
"passkeys": {
diff --git a/apps/mobile-app/app/(tabs)/settings/_layout.tsx b/apps/mobile-app/app/(tabs)/settings/_layout.tsx
index 0871b1c1d..becfad3fe 100644
--- a/apps/mobile-app/app/(tabs)/settings/_layout.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/_layout.tsx
@@ -1,3 +1,4 @@
+import { familySharingText } from '@aliasvault/client/sharing/FamilySharingView';
import { Stack } from 'expo-router';
import { useTranslation } from 'react-i18next';
import { Platform, Text } from 'react-native';
@@ -102,7 +103,7 @@ export default function SettingsLayout(): React.ReactNode {
<Stack.Screen
name="family-sharing"
options={{
- title: t('sharing.family.title'),
+ title: familySharingText.title,
headerBackTitle: t('settings.title'),
...defaultHeaderOptions,
}}
diff --git a/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx b/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx
index dd2762d33..b25e097c4 100644
--- a/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/family-sharing.tsx
@@ -1,5 +1,5 @@
import { ApiRequestError } from '@aliasvault/client/api/errors/ApiRequestError';
-import { canAdministerGroup, describeMemberAccess, holdsManifestKey, ownUserIdIn, roleTranslationKey, sharingErrorTranslationKey } from '@aliasvault/client/sharing/FamilySharingView';
+import { canAdministerGroup, describeMemberAccess, familySharingText, holdsManifestKey, ownUserIdIn, roleLabel, sharingErrorMessage } from '@aliasvault/client/sharing/FamilySharingView';
import { multiManifestRendering } from '@aliasvault/client/sharing/MultiManifestRendering';
import { SharingService } from '@aliasvault/client/sharing/SharingService';
import { CapabilityKeys } from '@aliasvault/models/webapi';
@@ -76,11 +76,11 @@ export default function FamilySharingScreen(): React.ReactNode {
setError(null);
} catch {
- setError(t('sharing.family.errors.loadFailed'));
+ setError(familySharingText.errors.loadFailed);
} finally {
setIsLoading(false);
}
- }, [webApi, sqliteClient, t, setIsLoading]);
+ }, [webApi, sqliteClient, setIsLoading]);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
@@ -98,9 +98,9 @@ export default function FamilySharingScreen(): React.ReactNode {
}
const code = actionError instanceof ApiRequestError ? actionError.apiErrorCode : null;
- const knownErrorKey = sharingErrorTranslationKey(code);
- if (knownErrorKey) {
- return t(knownErrorKey);
+ const knownError = sharingErrorMessage(code);
+ if (knownError) {
+ return knownError;
}
return code !== null ? `${fallback} [${code}]` : fallback;
@@ -145,12 +145,12 @@ export default function FamilySharingScreen(): React.ReactNode {
}
if (result.vaultUpgradeRequired) {
- throw new SharingOperationError(t('sharing.family.errors.vaultUpgradeRequired'));
+ throw new SharingOperationError(familySharingText.errors.vaultUpgradeRequired);
}
- const knownErrorKey = sharingErrorTranslationKey(result.apiErrorCode);
+ const knownError = sharingErrorMessage(result.apiErrorCode);
const code = result.apiErrorCode ?? result.error;
- throw new SharingOperationError(knownErrorKey ? t(knownErrorKey) : code ? `${fallback} [${code}]` : fallback);
+ throw new SharingOperationError(knownError ?? (code ? `${fallback} [${code}]` : fallback));
};
/**
@@ -164,10 +164,10 @@ export default function FamilySharingScreen(): React.ReactNode {
}
return run(async () => {
- await runSharingOperation('createSharedManifest', { groupId: group.groupId, name }, t('sharing.family.errors.createVaultFailed'));
+ await runSharingOperation('createSharedManifest', { groupId: group.groupId, name }, familySharingText.errors.createVaultFailed);
setNewVaultNames(previous => ({ ...previous, [group.groupId]: '' }));
await syncVault();
- }, t('sharing.family.errors.createVaultFailed'));
+ }, familySharingText.errors.createVaultFailed);
};
/**
@@ -193,9 +193,9 @@ export default function FamilySharingScreen(): React.ReactNode {
* @param member - the member being invited.
*/
const inviteMember = (group: GroupInfo, manifest: SharedManifestInfo, member: GroupMemberInfo): Promise<void> => run(async () => {
- await runSharingOperation('inviteToSharedManifest', { groupId: group.groupId, manifestId: manifest.manifestId, userId: member.userId }, t('sharing.family.errors.inviteFailed'));
- setNotice(t('sharing.family.invitationSent', { username: member.username }));
- }, t('sharing.family.errors.inviteFailed'));
+ await runSharingOperation('inviteToSharedManifest', { groupId: group.groupId, manifestId: manifest.manifestId, userId: member.userId }, familySharingText.errors.inviteFailed);
+ setNotice(familySharingText.invitationSent(member.username));
+ }, familySharingText.errors.inviteFailed);
/**
* Accept an invitation. The sync that follows is what brings the shared folder into this vault.
@@ -204,27 +204,27 @@ export default function FamilySharingScreen(): React.ReactNode {
const acceptInvitation = (invitationId: string): Promise<void> => run(async () => {
await SharingService.acceptInvitation(webApi, invitationId);
await syncVault();
- }, t('sharing.family.errors.invitationGone'));
+ }, familySharingText.errors.invitationGone);
/**
* What to call a shared folder on screen.
* @param manifest - the shared folder.
*/
- const vaultLabel = (manifest: SharedManifestInfo): string => vaultNames[manifest.manifestId.toLowerCase()] ?? t('sharing.family.unnamedVault');
+ const vaultLabel = (manifest: SharedManifestInfo): string => vaultNames[manifest.manifestId.toLowerCase()] ?? familySharingText.sharedFolder;
/**
* Ask before taking a member's access away, or before giving up one's own.
*/
const confirmRemoval = (group: GroupInfo, manifest: SharedManifestInfo, member: GroupMemberInfo, isSelf: boolean): void => {
- const title = isSelf ? t('sharing.family.leaveVault') : t('sharing.revoke');
+ const title = isSelf ? familySharingText.leaveVault : familySharingText.revoke;
const message = isSelf
- ? t('sharing.family.leaveVaultConfirm', { vault: vaultLabel(manifest) })
- : `${t('sharing.family.revokeAccessConfirm', { username: member.username, vault: vaultLabel(manifest) })}\n\n${t('sharing.family.revokeAccessWarning')}`;
+ ? familySharingText.leaveVaultConfirm(vaultLabel(manifest))
+ : `${familySharingText.revokeAccessConfirm(member.username, vaultLabel(manifest))}\n\n${familySharingText.revokeAccessWarning}`;
showConfirm(title, message, title, () => run(async () => {
await SharingService.revokeAccess(webApi, group.groupId, manifest.manifestId, member.userId);
await syncVault();
- }, t('sharing.family.errors.revokeAccessFailed')), { confirmStyle: 'destructive' });
+ }, familySharingText.errors.revokeAccessFailed), { confirmStyle: 'destructive' });
};
/**
@@ -234,7 +234,7 @@ export default function FamilySharingScreen(): React.ReactNode {
* @param manifest - the shared folder to delete.
*/
const deleteSharedVault = async (group: GroupInfo, manifest: SharedManifestInfo): Promise<void> => {
- const authenticated = await VaultUnlockHelper.authenticateForAction(t('sharing.family.deleteVault'), t('settings.passwordConfirm.description'), null, t('common.delete'));
+ const authenticated = await VaultUnlockHelper.authenticateForAction(familySharingText.deleteVault, familySharingText.deleteVaultPasswordPrompt(vaultLabel(manifest)), null, t('common.delete'));
if (!authenticated) {
return;
}
@@ -252,8 +252,8 @@ export default function FamilySharingScreen(): React.ReactNode {
}
await syncVault();
- setNotice(t('sharing.family.vaultDeleted'));
- }, t('sharing.family.errors.deleteVaultFailed'));
+ setNotice(familySharingText.vaultDeleted);
+ }, familySharingText.errors.deleteVaultFailed);
};
/**
@@ -261,8 +261,8 @@ export default function FamilySharingScreen(): React.ReactNode {
*/
const confirmVaultDelete = (group: GroupInfo, manifest: SharedManifestInfo): void => {
showConfirm(
- t('sharing.family.deleteVault'),
- t('sharing.family.deleteVaultConfirm', { vault: vaultLabel(manifest) }),
+ familySharingText.deleteVault,
+ familySharingText.deleteVaultConfirm(vaultLabel(manifest)),
t('common.delete'),
() => deleteSharedVault(group, manifest),
{ confirmStyle: 'destructive' }
@@ -422,7 +422,7 @@ export default function FamilySharingScreen(): React.ReactNode {
<View key={member.userId} style={styles.memberRow}>
<View style={styles.memberText}>
<ThemedText style={styles.memberName} numberOfLines={1}>
- {member.username}{isSelf && ` (${t('sharing.family.you')})`}
+ {member.username}{isSelf && ` (${familySharingText.you})`}
</ThemedText>
<ThemedText style={styles.mutedText}>{detail}</ThemedText>
</View>
@@ -443,9 +443,9 @@ export default function FamilySharingScreen(): React.ReactNode {
<ThemedContainer>
<ThemedScrollView refreshControl={<RefreshControl refreshing={isRefreshing} onRefresh={onRefresh} colors={[colors.primary]} tintColor={colors.primary} />}>
<View style={styles.headerRow}>
- <ThemedText style={styles.headerText}>{t('sharing.family.description')}</ThemedText>
+ <ThemedText style={styles.headerText}>{familySharingText.description}</ThemedText>
<View style={styles.betaBadge}>
- <ThemedText style={styles.betaBadgeText}>{t('sharing.family.beta')}</ThemedText>
+ <ThemedText style={styles.betaBadgeText}>{familySharingText.beta}</ThemedText>
</View>
</View>
@@ -468,14 +468,14 @@ export default function FamilySharingScreen(): React.ReactNode {
<>
{receivedInvitations.length > 0 && (
<View style={styles.section}>
- <ThemedText style={styles.sectionTitle}>{t('sharing.family.invitations')}</ThemedText>
+ <ThemedText style={styles.sectionTitle}>{familySharingText.invitations}</ThemedText>
{receivedInvitations.map(invitation => (
<View key={invitation.id} style={styles.card}>
- <ThemedText style={styles.cardTitle}>{invitationNames[invitation.id] ?? t('sharing.family.unnamedVault')}</ThemedText>
- <ThemedText style={styles.mutedText}>{t('sharing.family.invitedBy', { username: invitation.inviterUsername })}</ThemedText>
+ <ThemedText style={styles.cardTitle}>{invitationNames[invitation.id] ?? familySharingText.sharedFolder}</ThemedText>
+ <ThemedText style={styles.mutedText}>{familySharingText.invitedBy(invitation.inviterUsername)}</ThemedText>
<View style={styles.buttonRow}>
- {renderAction(t('sharing.family.accept'), () => acceptInvitation(invitation.id))}
- {renderAction(t('sharing.family.decline'), () => run(() => SharingService.declineInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone')), true)}
+ {renderAction(familySharingText.accept, () => acceptInvitation(invitation.id))}
+ {renderAction(familySharingText.decline, () => run(() => SharingService.declineInvitation(webApi, invitation.id), familySharingText.errors.invitationGone), true)}
</View>
</View>
))}
@@ -484,7 +484,7 @@ export default function FamilySharingScreen(): React.ReactNode {
{groups.length === 0 && receivedInvitations.length === 0 && !error && (
<View style={styles.section}>
- <ThemedText style={styles.mutedText}>{t('sharing.family.notAvailable')}</ThemedText>
+ <ThemedText style={styles.mutedText}>{familySharingText.notAvailable}</ThemedText>
</View>
)}
@@ -498,16 +498,16 @@ export default function FamilySharingScreen(): React.ReactNode {
{/* The family's members. */}
<View style={styles.card}>
<TouchableOpacity style={styles.cardHeader} onPress={() => setExpandedRosters(previous => ({ ...previous, [group.groupId]: !isRosterExpanded }))} activeOpacity={0.7}>
- <ThemedText style={styles.cardTitle}>{t('sharing.members')} ({group.members.length})</ThemedText>
+ <ThemedText style={styles.cardTitle}>{familySharingText.members} ({group.members.length})</ThemedText>
<Ionicons name={isRosterExpanded ? 'chevron-up' : 'chevron-down'} size={20} color={colors.textMuted} />
</TouchableOpacity>
- {isRosterExpanded && group.members.map(member => renderMemberRow(member, member.userId === myUserId, t(roleTranslationKey(member))))}
+ {isRosterExpanded && group.members.map(member => renderMemberRow(member, member.userId === myUserId, roleLabel(member)))}
</View>
{/* One card per shared folder, each with the members who can open it. */}
- <ThemedText style={styles.sectionTitle}>{t('sharing.family.sharedFolders')}</ThemedText>
+ <ThemedText style={styles.sectionTitle}>{familySharingText.sharedFolders}</ThemedText>
{group.manifests.length === 0 && (
- <ThemedText style={styles.mutedText}>{canAdminister ? t('sharing.family.noSharedVaultAdmin') : t('sharing.family.noSharedVaultMember')}</ThemedText>
+ <ThemedText style={styles.mutedText}>{canAdminister ? familySharingText.noSharedVaultAdmin : familySharingText.noSharedVaultMember}</ThemedText>
)}
{group.manifests.map(manifest => (
<View key={manifest.manifestId} style={styles.card}>
@@ -515,24 +515,24 @@ export default function FamilySharingScreen(): React.ReactNode {
<ThemedText style={styles.cardTitle} numberOfLines={1}>{vaultLabel(manifest)}</ThemedText>
{/* Renaming encrypts the name with the folder's key, so it takes a member who holds it. */}
{canAdminister && holdsManifestKey(manifest, myUserId) && renderAction(t('items.folders.editFolder'), () => setPendingVaultRename({ group, manifest }))}
- {canAdminister && renderAction(t('sharing.family.deleteVault'), () => confirmVaultDelete(group, manifest), true)}
+ {canAdminister && renderAction(familySharingText.deleteVault, () => confirmVaultDelete(group, manifest), true)}
</View>
{/* Inviting somebody encrypts this folder's key for them, which an admin who holds no grant on it cannot do. */}
{canAdminister && !holdsManifestKey(manifest, myUserId) && (
- <ThemedText style={styles.mutedText}>{t('sharing.family.cannotInviteWithoutAccess')}</ThemedText>
+ <ThemedText style={styles.mutedText}>{familySharingText.cannotInviteWithoutAccess}</ThemedText>
)}
{group.members.map((member) => {
const access = describeMemberAccess(group, manifest, member, myUserId);
const invitation = access.invitation;
- return renderMemberRow(member, access.isSelf, t(access.statusKey), (
+ return renderMemberRow(member, access.isSelf, access.statusText, (
<>
- {access.canLeave && renderAction(t('sharing.family.leaveVault'), () => confirmRemoval(group, manifest, member, true), true)}
- {access.canRevoke && renderAction(t('sharing.revoke'), () => confirmRemoval(group, manifest, member, false), true)}
- {access.canWithdraw && invitation && renderAction(t('sharing.family.withdraw'), () => run(() => SharingService.withdrawInvitation(webApi, invitation.id), t('sharing.family.errors.invitationGone')))}
- {access.canInvite && renderAction(t('sharing.family.invite'), () => inviteMember(group, manifest, member), false, access.isReadyForInvite)}
+ {access.canLeave && renderAction(familySharingText.leaveVault, () => confirmRemoval(group, manifest, member, true), true)}
+ {access.canRevoke && renderAction(familySharingText.revoke, () => confirmRemoval(group, manifest, member, false), true)}
+ {access.canWithdraw && invitation && renderAction(familySharingText.withdraw, () => run(() => SharingService.withdrawInvitation(webApi, invitation.id), familySharingText.errors.invitationGone))}
+ {access.canInvite && renderAction(familySharingText.invite, () => inviteMember(group, manifest, member), false, access.isReadyForInvite)}
</>
));
})}
@@ -542,18 +542,18 @@ export default function FamilySharingScreen(): React.ReactNode {
{/* Creating another shared folder. */}
{canAdminister && (
<View style={styles.card}>
- <ThemedText style={styles.cardTitle}>{t('sharing.family.createSharedVault')}</ThemedText>
+ <ThemedText style={styles.cardTitle}>{familySharingText.createSharedVault}</ThemedText>
<View style={styles.createRow}>
<TextInput
style={styles.createInput}
value={newVaultNames[group.groupId] ?? ''}
onChangeText={text => setNewVaultNames(previous => ({ ...previous, [group.groupId]: text }))}
- placeholder={t('sharing.family.vaultNamePlaceholder')}
+ placeholder={familySharingText.vaultNamePlaceholder}
placeholderTextColor={colors.textMuted}
editable={!busy}
onSubmitEditing={() => createSharedVault(group)}
/>
- {renderAction(t('sharing.family.create'), () => createSharedVault(group))}
+ {renderAction(familySharingText.create, () => createSharedVault(group))}
</View>
</View>
)}
diff --git a/apps/mobile-app/app/(tabs)/settings/index.tsx b/apps/mobile-app/app/(tabs)/settings/index.tsx
index 15a583471..8b2120be1 100644
--- a/apps/mobile-app/app/(tabs)/settings/index.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/index.tsx
@@ -1,4 +1,5 @@
import { AppInfo } from '@aliasvault/client/platform/AppInfo';
+import { familySharingText } from '@aliasvault/client/sharing/FamilySharingView';
import { CapabilityKeys } from '@aliasvault/models/webapi';
import { Ionicons } from '@expo/vector-icons';
import { router, useFocusEffect, useNavigation } from 'expo-router';
@@ -415,9 +416,9 @@ export default function SettingsScreen() : React.ReactNode {
</View>
<View style={styles.settingItemContent}>
<View style={styles.settingItemLabel}>
- <ThemedText style={styles.settingItemLabelText}>{t('sharing.family.title')}</ThemedText>
+ <ThemedText style={styles.settingItemLabelText}>{familySharingText.title}</ThemedText>
<View style={styles.betaBadge}>
- <ThemedText style={styles.betaBadgeText}>{t('sharing.family.beta')}</ThemedText>
+ <ThemedText style={styles.betaBadgeText}>{familySharingText.beta}</ThemedText>
</View>
</View>
<Ionicons name="chevron-forward" size={20} color={colors.textMuted} />
diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.json
index 1005d6e90..cc787c4d5 100644
--- a/apps/mobile-app/i18n/locales/en.json
+++ b/apps/mobile-app/i18n/locales/en.json
@@ -193,7 +193,6 @@
"exportConfirmTitle": "Export Vault",
"exportWarning": "Warning: Exporting your vault to an unencrypted file will expose all of your passwords and sensitive information in plain text. Only do this on trusted devices and ensure you:\n\n• Store the exported file in a secure location\n• Delete the file when you no longer need it\n• Never share the exported file with others\n\nAre you sure you want to continue with the export?",
"passwordConfirm": {
- "description": "For security reasons, please enter your master password to confirm this action.",
"exportDescription": "For security reasons, please enter your master password to confirm this export."
},
"security": "Security",
@@ -341,61 +340,6 @@
}
}
},
- "sharing": {
- "members": "Family members",
- "owner": "Owner",
- "revoke": "Revoke",
- "family": {
- "title": "Family Sharing",
- "beta": "Beta",
- "description": "Share folders with the people in your family.",
- "notAvailable": "Family sharing is not enabled for this account yet. Once a family has been set up for you, it appears here.",
- "invitations": "Invitations",
- "invitedBy": "Invited by {{username}}",
- "accept": "Accept",
- "decline": "Decline",
- "noSharedVaultAdmin": "This family has no shared folder yet. Creating one adds a folder to your vault that every member you invite can see.",
- "noSharedVaultMember": "Nobody has created a shared folder for this family yet.",
- "createSharedVault": "Create a shared folder",
- "sharedFolders": "Shared folders",
- "hasAccess": "Has access",
- "invited": "Invited",
- "you": "You",
- "admin": "Admin",
- "member": "Member",
- "withdraw": "Withdraw",
- "leaveVault": "Leave folder",
- "leaveVaultConfirm": "Leave “{{vault}}”? You lose access to it, but stay in the family.",
- "cannotInviteWithoutAccess": "You do not have access to this folder, so you cannot invite anyone to it. Ask a member who has access to invite you first.",
- "errors": {
- "loadFailed": "Family sharing could not be loaded.",
- "createVaultFailed": "The shared folder could not be created. Please try again.",
- "vaultUpgradeRequired": "Your vault has to finish upgrading before it can be shared.",
- "revokeAccessFailed": "The access could not be changed. Please try again.",
- "inviteFailed": "The invitation could not be sent. Please try again.",
- "userNotReady": "That account has to finish upgrading AliasVault before a folder can be shared with it.",
- "alreadyInvited": "That person has already been invited.",
- "invitationGone": "That invitation is no longer available.",
- "invitationKeyOutdated": "This invitation is no longer valid because the shared folder's key has changed. Ask for a new invitation.",
- "notFamilyMember": "That person is not in this family.",
- "alreadyHasAccess": "That person already has access to this folder.",
- "lastMemberWithAccess": "Somebody has to be able to open the shared folder. Give another member access to it first.",
- "vaultLimitReached": "Max amount of shared folders reached.",
- "deleteVaultFailed": "The shared folder could not be deleted. Please try again."
- },
- "vaultNamePlaceholder": "Folder name, for example Streaming",
- "create": "Create",
- "invite": "Invite",
- "invitationSent": "Invitation sent to {{username}}.",
- "noAccess": "No access",
- "revokeAccessConfirm": "Take {{username}} out of “{{vault}}”? They lose access to it right away, but stay in the family.",
- "revokeAccessWarning": "They keep any copy of this folder they already downloaded. Change the passwords in it that you do not want them to keep using.",
- "deleteVault": "Delete folder",
- "deleteVaultConfirm": "Permanently delete “{{vault}}”? Every member of the family loses this folder and everything in it. This cannot be undone.",
- "vaultDeleted": "The shared folder has been deleted.",
- "unnamedVault": "Shared folder"
- }
- },
"navigation": {
"vault": "Vault",
"emails": "Emails",
diff --git a/core/client/src/sharing/FamilySharingView.ts b/core/client/src/sharing/FamilySharingView.ts
index 752a2dc2c..6ffe5a83b 100644
--- a/core/client/src/sharing/FamilySharingView.ts
+++ b/core/client/src/sharing/FamilySharingView.ts
@@ -4,6 +4,71 @@ import type { GroupInfo, GroupMemberInfo, SentManifestInvitation, SharedManifest
* What the family sharing screen shows and offers, generic and used by multiple clients.
*/
+/**
+ * The family sharing screen's text strings, in English only on purpose (temporary) as the UI is pending changes
+ * so we don't let the translation platform see this yet until its finalized. TODO: move these strings to locale files.
+ */
+export const familySharingText = {
+ title: 'Family Sharing',
+ beta: 'Beta',
+ description: 'Share folders with the people in your family.',
+ notAvailable: 'Family sharing is not enabled for this account yet. Once a family has been set up for you, it appears here.',
+ invitations: 'Invitations',
+ /** Who sent an invitation. */
+ invitedBy: (username: string): string => `Invited by ${username}`,
+ accept: 'Accept',
+ decline: 'Decline',
+ members: 'Family members',
+ owner: 'Owner',
+ admin: 'Admin',
+ member: 'Member',
+ you: 'You',
+ noSharedVaultAdmin: 'This family has no shared folder yet. Creating one adds a folder to your vault that every member you invite can see.',
+ noSharedVaultMember: 'Nobody has created a shared folder for this family yet.',
+ createSharedVault: 'Create a shared folder',
+ sharedFolder: 'Shared folder',
+ sharedFolders: 'Shared folders',
+ hasAccess: 'Has access',
+ invited: 'Invited',
+ noAccess: 'No access',
+ revoke: 'Revoke',
+ withdraw: 'Withdraw',
+ invite: 'Invite',
+ create: 'Create',
+ leaveVault: 'Leave folder',
+ /** Confirmation for leaving a shared folder. */
+ leaveVaultConfirm: (vault: string): string => `Leave “${vault}”? You lose access to it, but stay in the family.`,
+ cannotInviteWithoutAccess: 'You do not have access to this folder, so you cannot invite anyone to it. Ask a member who has access to invite you first.',
+ vaultNamePlaceholder: 'Folder name, for example Streaming',
+ /** Notice after an invitation was sent. */
+ invitationSent: (username: string): string => `Invitation sent to ${username}.`,
+ /** Confirmation for taking a member's access away. */
+ revokeAccessConfirm: (username: string, vault: string): string => `Take ${username} out of “${vault}”? They lose access to it right away, but stay in the family.`,
+ revokeAccessWarning: 'They keep any copy of this folder they already downloaded. Change the passwords in it that you do not want them to keep using.',
+ deleteVault: 'Delete folder',
+ /** Confirmation for deleting a shared folder. */
+ deleteVaultConfirm: (vault: string): string => `Permanently delete “${vault}”? Every member of the family loses this folder and everything in it. This cannot be undone.`,
+ /** Password prompt for deleting a shared folder. */
+ deleteVaultPasswordPrompt: (vault: string): string => `Enter your master password to confirm deleting “${vault}” for the whole family.`,
+ vaultDeleted: 'The shared folder has been deleted.',
+ errors: {
+ loadFailed: 'Family sharing could not be loaded.',
+ createVaultFailed: 'The shared folder could not be created. Please try again.',
+ vaultUpgradeRequired: 'Your vault has to finish upgrading before it can be shared.',
+ revokeAccessFailed: 'The access could not be changed. Please try again.',
+ inviteFailed: 'The invitation could not be sent. Please try again.',
+ userNotReady: 'That account has to finish upgrading AliasVault before a folder can be shared with it.',
+ alreadyInvited: 'That person has already been invited.',
+ invitationGone: 'That invitation is no longer available.',
+ invitationKeyOutdated: "This invitation is no longer valid because the shared folder's key has changed. Ask for a new invitation.",
+ notFamilyMember: 'That person is not in this family.',
+ alreadyHasAccess: 'That person already has access to this folder.',
+ lastMemberWithAccess: 'Somebody has to be able to open the shared folder. Give another member access to it first.',
+ vaultLimitReached: 'Max amount of shared folders reached.',
+ deleteVaultFailed: 'The shared folder could not be deleted. Please try again.',
+ },
+};
+
/**
* One member's access status and current user's available actions on it.
*/
@@ -11,7 +76,7 @@ export type MemberAccess = {
isSelf: boolean;
hasAccess: boolean;
invitation: SentManifestInvitation | null;
- statusKey: string;
+ statusText: string;
canLeave: boolean;
canRevoke: boolean;
canWithdraw: boolean;
@@ -64,7 +129,7 @@ export function describeMemberAccess(group: GroupInfo, manifest: SharedManifestI
isSelf,
hasAccess,
invitation,
- statusKey: hasAccess ? 'sharing.family.hasAccess' : invitation ? 'sharing.family.invited' : 'sharing.family.noAccess',
+ statusText: hasAccess ? familySharingText.hasAccess : invitation ? familySharingText.invited : familySharingText.noAccess,
canLeave: hasAccess && isSelf && !isAdmin,
canRevoke: hasAccess && !isSelf && isAdmin,
canWithdraw: invitation !== null && !isSelf && isAdmin,
@@ -74,32 +139,32 @@ export function describeMemberAccess(group: GroupInfo, manifest: SharedManifestI
}
/**
- * The translation key of a member's role.
+ * The label of a member's role.
* @param member - the member.
*/
-export function roleTranslationKey(member: Pick<GroupMemberInfo, 'role'>): string {
+export function roleLabel(member: Pick<GroupMemberInfo, 'role'>): string {
switch (member.role) {
- case 'Owner': return 'sharing.owner';
- case 'Admin': return 'sharing.family.admin';
- default: return 'sharing.family.member';
+ case 'Owner': return familySharingText.owner;
+ case 'Admin': return familySharingText.admin;
+ default: return familySharingText.member;
}
}
/**
- * The translation key that explains a sharing API error code.
+ * The message that explains a sharing API error code.
* @param apiErrorCode - the code the server answered with.
- * @returns The key, or null for a code this screen has no words for.
+ * @returns The message, or null for a code this screen has no words for.
*/
-export function sharingErrorTranslationKey(apiErrorCode: string | null | undefined): string | null {
+export function sharingErrorMessage(apiErrorCode: string | null | undefined): string | null {
switch (apiErrorCode) {
- case 'INVITE_RECIPIENT_NOT_READY': return 'sharing.family.errors.userNotReady';
- case 'NOT_GROUP_MEMBER': return 'sharing.family.errors.notFamilyMember';
- case 'ACCESS_ALREADY_GRANTED': return 'sharing.family.errors.alreadyHasAccess';
- case 'INVITATION_ALREADY_EXISTS': return 'sharing.family.errors.alreadyInvited';
- case 'INVITATION_NOT_FOUND': return 'sharing.family.errors.invitationGone';
- case 'INVITATION_KEY_OUTDATED': return 'sharing.family.errors.invitationKeyOutdated';
- case 'LAST_MANIFEST_GRANT_HOLDER': return 'sharing.family.errors.lastMemberWithAccess';
- case 'GROUP_MANIFEST_LIMIT_REACHED': return 'sharing.family.errors.vaultLimitReached';
+ case 'INVITE_RECIPIENT_NOT_READY': return familySharingText.errors.userNotReady;
+ case 'NOT_GROUP_MEMBER': return familySharingText.errors.notFamilyMember;
+ case 'ACCESS_ALREADY_GRANTED': return familySharingText.errors.alreadyHasAccess;
+ case 'INVITATION_ALREADY_EXISTS': return familySharingText.errors.alreadyInvited;
+ case 'INVITATION_NOT_FOUND': return familySharingText.errors.invitationGone;
+ case 'INVITATION_KEY_OUTDATED': return familySharingText.errors.invitationKeyOutdated;
+ case 'LAST_MANIFEST_GRANT_HOLDER': return familySharingText.errors.lastMemberWithAccess;
+ case 'GROUP_MANIFEST_LIMIT_REACHED': return familySharingText.errors.vaultLimitReached;
default: return null;
}
}