Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions components/email/email-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export function EmailList({
onRescheduleScheduled,
}: EmailListProps) {
const t = useTranslations('email_list');
// next-intl has no relative ("../") namespace navigation; cross-namespace keys
// must be absolute paths resolved from a root translator.
const tRoot = useTranslations();
const { client } = useAuthStore();
const {
selectedEmailIds,
Expand Down Expand Up @@ -198,10 +201,10 @@ export function EmailList({
const emailIds = Array.from(selectedEmailIds);
await batchUndoSpam(client, emailIds);
const { toast } = await import('sonner');
toast.success(t('../email_viewer.spam.toast_not_spam_batch', { count: emailIds.length }));
toast.success(tRoot('email_viewer.spam.toast_not_spam_batch', { count: emailIds.length }));
} catch {
const { toast } = await import('sonner');
toast.error(t('../email_viewer.spam.error_not_spam'));
toast.error(tRoot('email_viewer.spam.error_not_spam'));
} finally {
setTimeout(() => setIsProcessing(false), 500);
}
Expand Down Expand Up @@ -378,7 +381,7 @@ export function EmailList({
variant="ghost"
size="sm"
onClick={handleBatchUndoSpam}
title={t('../context_menu.not_spam')}
title={tRoot('context_menu.not_spam')}
disabled={isProcessing}
className="text-emerald-600 dark:text-emerald-400 hover:bg-emerald-100/50 dark:hover:bg-emerald-950/30 transition-colors disabled:opacity-50"
>
Expand Down Expand Up @@ -614,11 +617,11 @@ export function EmailList({
await batchMarkAsSpam(client, emailIds);
const { toast } = await import('sonner');
toast.success(
t('../email_viewer.spam.toast_batch', { count: emailIds.length })
tRoot('email_viewer.spam.toast_batch', { count: emailIds.length })
);
} catch {
const { toast } = await import('sonner');
toast.error(t('../email_viewer.spam.error'));
toast.error(tRoot('email_viewer.spam.error'));
}
}
}}
Expand All @@ -629,11 +632,11 @@ export function EmailList({
await batchUndoSpam(client, emailIds);
const { toast } = await import('sonner');
toast.success(
t('../email_viewer.spam.toast_not_spam_batch', { count: emailIds.length })
tRoot('email_viewer.spam.toast_not_spam_batch', { count: emailIds.length })
);
} catch {
const { toast } = await import('sonner');
toast.error(t('../email_viewer.spam.error_not_spam'));
toast.error(tRoot('email_viewer.spam.error_not_spam'));
}
}
}}
Expand Down
7 changes: 4 additions & 3 deletions components/settings/about-data-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function VersionUpdateTag() {
export function AboutDataSettings() {
const t = useTranslations('settings.advanced');
const tCommon = useTranslations('common');
const tRoot = useTranslations();
const { settingsSyncDisabled, updateSetting, resetToDefaults, exportSettings, importSettings } =
useSettingsStore();
const { settingsSyncEnabled } = useConfig();
Expand Down Expand Up @@ -99,9 +100,9 @@ export function AboutDataSettings() {
const json = event.target?.result as string;
const success = importSettings(json);
if (success) {
alert(t('../../settings.import_success'));
alert(tRoot('settings.import_success'));
} else {
alert(t('../../settings.import_error'));
alert(tRoot('settings.import_error'));
}
};
reader.readAsText(file);
Expand All @@ -120,7 +121,7 @@ export function AboutDataSettings() {
if (showResetConfirm) {
resetToDefaults();
setShowResetConfirm(false);
alert(t('../../settings.save_success'));
alert(tRoot('settings.save_success'));
} else {
setShowResetConfirm(true);
setTimeout(() => setShowResetConfirm(false), 5000);
Expand Down
7 changes: 4 additions & 3 deletions components/settings/account-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function firstScopedTab(caps: SharedAccount['capabilities']): string | null {

export function AccountSettings() {
const t = useTranslations('settings.account');
const tRoot = useTranslations();
const router = useRouter();
const { username, serverUrl, isDemoMode, primaryIdentity, authMode, client } = useAuthStore();
const activeAccountId = useAuthStore((s) => s.activeAccountId);
Expand Down Expand Up @@ -117,12 +118,12 @@ export function AccountSettings() {
<SettingsSection title={t('title')} description={t('description')}>
{/* Display Name */}
<SettingItem label={t('name_label')}>
<span className="text-sm text-foreground">{displayName || t('../../common.unknown')}</span>
<span className="text-sm text-foreground">{displayName || tRoot('common.unknown')}</span>
</SettingItem>

{/* Email Address */}
<SettingItem label={t('email.label')}>
<span className="text-sm text-foreground">{email || t('../../common.unknown')}</span>
<span className="text-sm text-foreground">{email || tRoot('common.unknown')}</span>
</SettingItem>

{/* Username / Login (show when it differs from email) */}
Expand All @@ -142,7 +143,7 @@ export function AccountSettings() {
{/* Server */}
<SettingItem label={t('server.label')}>
<span className="text-sm text-foreground truncate max-w-xs">
{serverUrl || t('../../common.unknown')}
{serverUrl || tRoot('common.unknown')}
</span>
</SettingItem>

Expand Down