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
5 changes: 3 additions & 2 deletions app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ export function Header() {
{ code: "zh", label: "简体中文" },
{ code: "zh-HK", label: "繁體中文" },
{ code: "en-US", label: "English" },
{ code: "es", label: "Español" },
];

const handleLanguageChange = (newLang: string) => {
const prefixes = ["zh-HK", "en-US"];
const prefixes = ["zh-HK", "en-US", "es"];
const segments = location.pathname.split("/").filter(Boolean);
const hasPrefix = segments.length > 0 && prefixes.includes(segments[0]);

Expand All @@ -42,7 +43,7 @@ export function Header() {
};

// Determine home link
const prefixes = ["zh-HK", "en-US"];
const prefixes = ["zh-HK", "en-US", "es"];
const segments = location.pathname.split("/").filter(Boolean);
const currentPrefix =
segments.length > 0 && prefixes.includes(segments[0]) ? segments[0] : "";
Expand Down
2 changes: 1 addition & 1 deletion app/components/locale-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function LocaleLink({ to, children, ...props }: LocaleLinkProps) {
// Check if we're currently on a localized route
const pathSegments = location.pathname.split("/");
const currentLocale = pathSegments[1];
const isLocalizedRoute = ["zh-HK", "en-US"].includes(currentLocale);
const isLocalizedRoute = ["zh-HK", "en-US", "es"].includes(currentLocale);

// Build the localized path
let localizedTo = to;
Expand Down
2 changes: 1 addition & 1 deletion app/entry.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function main() {
.use(I18nextBrowserLanguageDetector)
.init({
fallbackLng: "zh",
supportedLngs: ["zh", "zh-HK", "en-US"],
supportedLngs: ["zh", "zh-HK", "en-US", "es"],
defaultNS: "common",
ns: ["common"],
detection: { order: ["htmlTag"], caches: [] },
Expand Down
2 changes: 1 addition & 1 deletion app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async function handleRequest(
ns,
defaultNS: "common",
fallbackLng: "zh",
supportedLngs: ["zh", "zh-HK", "en-US"],
supportedLngs: ["zh", "zh-HK", "en-US", "es"],
resources,
interpolation: {
escapeValue: false,
Expand Down
Loading