From 7b2841fb93b353337c1560dcabec1ed21acf5b3e Mon Sep 17 00:00:00 2001 From: Vladimir Haltakov Date: Fri, 6 Nov 2026 00:20:45 +0200 Subject: [PATCH 01/37] Localize scheduler navigation, preview and initial MCP messages --- package.json | 3 +- scheduler/app/globals.css | 26 +++++ scheduler/app/layout.tsx | 30 +++--- scheduler/components/navbar.tsx | 29 +++--- scheduler/components/user-menu.tsx | 26 +++-- scheduler/components/visual/navigation.tsx | 8 +- .../components/visual/preview-switcher.tsx | 13 ++- scheduler/lib/i18n/check-catalogs.mjs | 26 +++++ scheduler/lib/i18n/client.tsx | 45 ++++++++ scheduler/lib/i18n/locales.ts | 57 ++++++++++ scheduler/lib/i18n/messages/ar.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/bg.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/de.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/en.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/es.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/fr.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/hi.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/id.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/it.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/ja.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/ko.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/pt-BR.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/tr.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/zh-Hans.json | 98 ++++++++++++++++++ scheduler/lib/i18n/messages/zh-Hant.json | 98 ++++++++++++++++++ scheduler/lib/i18n/request.ts | 16 +++ scheduler/lib/i18n/resources.ts | 24 +++++ scheduler/lib/i18n/translate.ts | 27 +++++ scheduler/lib/mcp/locale.ts | 27 +++++ scheduler/lib/mcp/registration.ts | 61 +++++------ scheduler/lib/mcp/server.ts | 9 +- scheduler/lib/mcp/ui/widget-assets.ts | 16 +-- scheduler/mcp-ui/extensions/design-system.css | 26 +++++ scheduler/mcp-ui/extensions/host.ts | 5 +- scheduler/mcp-ui/extensions/workspace-app.tsx | 11 +- scheduler/mcp-ui/post-preview.css | 26 +++++ scheduler/mcp-ui/post-preview.tsx | 52 +++++----- scheduler/mcp-ui/schedule.tsx | 4 +- scheduler/mcp-ui/use-host-locale.ts | 46 ++++++++ scheduler/mcp-ui/use-mcp-tool-data.ts | 4 + scheduler/package.json | 6 +- scheduler/tests/lib/mcp/registration.test.ts | 22 ++++ vendor/README.md | 1 + vendor/simple-post-preview-0.4.0-i18n.0.tgz | Bin 0 -> 71095 bytes ...simple-post-preview-react-0.4.0-i18n.0.tgz | Bin 0 -> 1973 bytes yarn.lock | 42 ++++++-- 46 files changed, 2036 insertions(+), 122 deletions(-) create mode 100644 scheduler/lib/i18n/check-catalogs.mjs create mode 100644 scheduler/lib/i18n/client.tsx create mode 100644 scheduler/lib/i18n/locales.ts create mode 100644 scheduler/lib/i18n/messages/ar.json create mode 100644 scheduler/lib/i18n/messages/bg.json create mode 100644 scheduler/lib/i18n/messages/de.json create mode 100644 scheduler/lib/i18n/messages/en.json create mode 100644 scheduler/lib/i18n/messages/es.json create mode 100644 scheduler/lib/i18n/messages/fr.json create mode 100644 scheduler/lib/i18n/messages/hi.json create mode 100644 scheduler/lib/i18n/messages/id.json create mode 100644 scheduler/lib/i18n/messages/it.json create mode 100644 scheduler/lib/i18n/messages/ja.json create mode 100644 scheduler/lib/i18n/messages/ko.json create mode 100644 scheduler/lib/i18n/messages/pt-BR.json create mode 100644 scheduler/lib/i18n/messages/tr.json create mode 100644 scheduler/lib/i18n/messages/zh-Hans.json create mode 100644 scheduler/lib/i18n/messages/zh-Hant.json create mode 100644 scheduler/lib/i18n/request.ts create mode 100644 scheduler/lib/i18n/resources.ts create mode 100644 scheduler/lib/i18n/translate.ts create mode 100644 scheduler/lib/mcp/locale.ts create mode 100644 scheduler/mcp-ui/use-host-locale.ts create mode 100644 vendor/README.md create mode 100644 vendor/simple-post-preview-0.4.0-i18n.0.tgz create mode 100644 vendor/simple-post-preview-react-0.4.0-i18n.0.tgz diff --git a/package.json b/package.json index 18e23c49..78f13455 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "muse:check": "node --test integrations/meta-muse/integration.test.mjs" }, "resolutions": { - "postcss": "^8.5.16" + "postcss": "^8.5.16", + "@simple-post/preview@npm:0.4.0-i18n.0": "file:./vendor/simple-post-preview-0.4.0-i18n.0.tgz" }, "engines": { "node": ">=22.23.4 <23 || >=24.22.1 <25 || >=26.12.1 <27" diff --git a/scheduler/app/globals.css b/scheduler/app/globals.css index f3ef22f2..84407ca3 100644 --- a/scheduler/app/globals.css +++ b/scheduler/app/globals.css @@ -3,3 +3,29 @@ @source "../features"; @import "../components/visual/theme.css"; + +/* Use region-appropriate glyph shapes when the Latin brand fonts lack them. */ +:lang(ja) { + --ui-local-font: "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP"; +} +:lang(ko) { + --ui-local-font: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR"; +} +:lang(zh-Hans) { + --ui-local-font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC"; +} +:lang(zh-Hant) { + --ui-local-font: "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC"; +} +:lang(ar) { + --ui-local-font: "Noto Sans Arabic", "Geeza Pro", "Segoe UI"; +} +:lang(hi) { + --ui-local-font: "Noto Sans Devanagari", "Kohinoor Devanagari", "Mangal"; +} + +html:is(:lang(ja), :lang(ko), :lang(zh-Hans), :lang(zh-Hant), :lang(ar), :lang(hi)) { + --font-body: var(--ui-local-font), system-ui, sans-serif; + --font-sans: var(--ui-local-font), system-ui, sans-serif; + --font-display: var(--ui-local-font), system-ui, sans-serif; +} diff --git a/scheduler/app/layout.tsx b/scheduler/app/layout.tsx index ef58ecd0..f8181e69 100644 --- a/scheduler/app/layout.tsx +++ b/scheduler/app/layout.tsx @@ -1,3 +1,6 @@ +import { UiLocaleProvider } from "@/lib/i18n/client"; +import { direction } from "@/lib/i18n/locales"; +import { getUiTranslation } from "@/lib/i18n/request"; import type React from "react"; import { Suspense } from "react"; @@ -55,24 +58,27 @@ export const metadata: Metadata = { }, }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { + const { locale, messages, t } = await getUiTranslation(); return ( - + - - - {!env.SELF_HOSTED && process.env.NODE_ENV === "production" && ( - - - - )} - Loading...}>{children} - - + + + + {!env.SELF_HOSTED && process.env.NODE_ENV === "production" && ( + + + + )} + {t("loading")}}>{children} + + + ); diff --git a/scheduler/components/navbar.tsx b/scheduler/components/navbar.tsx index f861bb19..bf5d85cd 100644 --- a/scheduler/components/navbar.tsx +++ b/scheduler/components/navbar.tsx @@ -1,5 +1,7 @@ "use client"; +import { useUiTranslation } from "@/lib/i18n/client"; + import { useEffect, useState, type ReactNode } from "react"; import Link from "next/link"; @@ -21,6 +23,7 @@ interface NavbarProps { } export function Navbar({ actions }: NavbarProps) { + const { locale, t } = useUiTranslation(); const readOnly = useWorkspaceReadOnly(); const { data: billing } = useBillingStatus(); const pathname = usePathname() ?? "/"; @@ -47,7 +50,7 @@ export function Navbar({ actions }: NavbarProps) { + aria-label={t("simplePostHome")}> @@ -78,36 +81,36 @@ export function Navbar({ actions }: NavbarProps) { )} /> -
+
{!readOnly && actions} {showCreateCta && ( )} - + {t("help")}
{readOnly && billing?.trial && !pathname.startsWith("/billing") && pathname !== "/subscribe" && ( )} diff --git a/scheduler/components/user-menu.tsx b/scheduler/components/user-menu.tsx index 9f060730..1fc8ea88 100644 --- a/scheduler/components/user-menu.tsx +++ b/scheduler/components/user-menu.tsx @@ -1,5 +1,7 @@ "use client"; +import { UiLanguageSelect, useUiTranslation } from "@/lib/i18n/client"; + import { useState } from "react"; import Link from "next/link"; @@ -20,6 +22,7 @@ import { useSession, authClient } from "@/lib/auth/auth-client"; import { logClientError } from "@/lib/logger/client"; export function UserMenu() { + const { t } = useUiTranslation(); const { data: session } = useSession(); const selfHosted = useSelfHosted(); const [isLoading, setIsLoading] = useState(false); @@ -50,7 +53,7 @@ export function UserMenu() { return ( @@ -60,29 +63,35 @@ export function UserMenu() {
-

{session.user.name || "User"}

- {session.user.email &&

{session.user.email}

} +

+ {session.user.name || t("user")} +

+ {session.user.email && ( +

+ {session.user.email} +

+ )}
- Settings + {t("settings")} {!selfHosted && ( - Subscription + {t("subscription")} )} - API Keys + {t("apiKeys")} @@ -91,9 +100,12 @@ export function UserMenu() { AI Integrations + + + - {isLoading ? "Signing out..." : "Sign out"} + {isLoading ? t("signingOut") : t("signOut")}
diff --git a/scheduler/components/visual/navigation.tsx b/scheduler/components/visual/navigation.tsx index d4a3fb03..099695d2 100644 --- a/scheduler/components/visual/navigation.tsx +++ b/scheduler/components/visual/navigation.tsx @@ -1,3 +1,4 @@ +import { useUiTranslation } from "@/lib/i18n/client"; import type { ReactNode } from "react"; import { LayoutGrid, Users } from "lucide-react"; @@ -19,12 +20,13 @@ export function WorkspaceNavigation({ active: "posts" | "accounts" | null; renderItem: (props: { id: "posts" | "accounts"; label: string; className: string; children: ReactNode }) => ReactNode; }) { + const { t } = useUiTranslation(); return ( -