feat(i18n): extract strings from navigation, dialogs, onboarding, settings, and login
- Add useTranslation() to TopNav, BottomTabBar, FabMenu, UserMenu - Internationalize ConfirmDialog, AuthPromptModal, ExternalLinkDialog - Extract all onboarding flow strings (Welcome, HobbyPicker, ItemBrowser, Review, Done) - Internationalize settings page (weight unit, currency, API keys, import/export) - Internationalize login page and root error boundary - All dialogs in __root.tsx use t() for UI chrome Phase 34, Plan 02 (core navigation and global UI)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Link, useMatchRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAuth } from "../hooks/useAuth";
|
||||
import { LucideIcon } from "../lib/iconData";
|
||||
import { useUIStore } from "../stores/uiStore";
|
||||
@@ -42,6 +43,7 @@ function NavLinkOrButton({
|
||||
}
|
||||
|
||||
export function TopNav() {
|
||||
const { t } = useTranslation();
|
||||
const { data: auth } = useAuth();
|
||||
const isAuthenticated = !!auth?.user;
|
||||
const openAuthPrompt = useUIStore((s) => s.openAuthPrompt);
|
||||
@@ -82,7 +84,7 @@ export function TopNav() {
|
||||
isAuthenticated={isAuthenticated}
|
||||
onAuthPrompt={openAuthPrompt}
|
||||
>
|
||||
Home
|
||||
{t("nav.home")}
|
||||
</NavLinkOrButton>
|
||||
<NavLinkOrButton
|
||||
to="/collection"
|
||||
@@ -91,7 +93,7 @@ export function TopNav() {
|
||||
isAuthenticated={isAuthenticated}
|
||||
onAuthPrompt={openAuthPrompt}
|
||||
>
|
||||
Collection
|
||||
{t("nav.collection")}
|
||||
</NavLinkOrButton>
|
||||
<NavLinkOrButton
|
||||
to="/setups"
|
||||
@@ -100,7 +102,7 @@ export function TopNav() {
|
||||
isAuthenticated={isAuthenticated}
|
||||
onAuthPrompt={openAuthPrompt}
|
||||
>
|
||||
Setups
|
||||
{t("nav.setups")}
|
||||
</NavLinkOrButton>
|
||||
</nav>
|
||||
|
||||
@@ -124,7 +126,7 @@ export function TopNav() {
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") handleSearch();
|
||||
}}
|
||||
placeholder="Search catalog..."
|
||||
placeholder={t("nav.searchPlaceholder")}
|
||||
className="bg-gray-50 border border-gray-200 rounded-lg pl-9 pr-3 py-2 text-sm text-gray-900 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-200 focus:border-gray-300 w-48 lg:w-64 transition-colors"
|
||||
/>
|
||||
</div>
|
||||
@@ -137,7 +139,7 @@ export function TopNav() {
|
||||
to="/login"
|
||||
className="text-xs text-gray-500 hover:text-gray-700 transition-colors"
|
||||
>
|
||||
Sign in
|
||||
{t("auth.signIn")}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user