@agent-native/core 0.75.5 → 0.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +7 -0
- package/corpus/core/docs/AGENTS.md +1 -0
- package/corpus/core/docs/content/client.md +15 -0
- package/corpus/core/docs/content/internationalization.md +145 -0
- package/corpus/core/docs/content/locales/ar-SA/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/de-DE/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/es-ES/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/fr-FR/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/hi-IN/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/ja-JP/internationalization.md +114 -0
- package/corpus/core/docs/content/locales/ko-KR/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/pt-BR/internationalization.md +102 -0
- package/corpus/core/docs/content/locales/zh-CN/internationalization.md +102 -0
- package/corpus/core/docs/content/skills-guide.md +19 -18
- package/corpus/core/package.json +7 -1
- package/corpus/core/src/client/CommandMenu.tsx +16 -0
- package/corpus/core/src/client/app-providers.tsx +26 -1
- package/corpus/core/src/client/i18n.tsx +605 -0
- package/corpus/core/src/client/index.ts +28 -0
- package/corpus/core/src/index.browser.ts +25 -0
- package/corpus/core/src/localization/actions/get-localization-preference.ts +23 -0
- package/corpus/core/src/localization/actions/set-localization-preference.ts +30 -0
- package/corpus/core/src/localization/index.ts +2 -0
- package/corpus/core/src/localization/server.ts +131 -0
- package/corpus/core/src/localization/shared.ts +163 -0
- package/corpus/core/src/server/action-discovery.ts +8 -0
- package/corpus/core/src/server/index.ts +8 -0
- package/corpus/core/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/core/src/templates/default/.agents/skills/internationalization/SKILL.md +77 -0
- package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/core/src/templates/default/AGENTS.md +16 -15
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +29 -0
- package/corpus/core/src/templates/default/app/i18n/index.ts +13 -0
- package/corpus/core/src/templates/default/app/root.tsx +20 -1
- package/corpus/core/src/templates/default/app/routes/_index.tsx +24 -9
- package/corpus/core/src/templates/default/app/routes/settings.tsx +67 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/internationalization/SKILL.md +77 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/core/src/vite/action-types-plugin.ts +10 -0
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/analytics/app/components/layout/Header.tsx +18 -15
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +7 -5
- package/corpus/templates/analytics/app/components/layout/MobileNav.tsx +9 -3
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +5 -3
- package/corpus/templates/analytics/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/analytics/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/analytics/app/i18n/en-US.ts +3 -0
- package/corpus/templates/analytics/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/analytics/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/analytics/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/analytics/app/i18n/index.ts +31 -0
- package/corpus/templates/analytics/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/analytics/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/analytics/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/analytics/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/analytics/app/i18n-data.ts +433 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +50 -16
- package/corpus/templates/analytics/app/root.tsx +14 -1
- package/corpus/templates/analytics/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/assets/app/components/layout/Header.tsx +17 -8
- package/corpus/templates/assets/app/components/layout/Layout.tsx +10 -6
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +40 -23
- package/corpus/templates/assets/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/assets/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/assets/app/i18n/en-US.ts +3 -0
- package/corpus/templates/assets/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/assets/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/assets/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/assets/app/i18n/index.ts +31 -0
- package/corpus/templates/assets/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/assets/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/assets/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/assets/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/assets/app/i18n-data.ts +668 -0
- package/corpus/templates/assets/app/root.tsx +40 -15
- package/corpus/templates/assets/app/routes/_index.tsx +9 -10
- package/corpus/templates/assets/app/routes/settings.tsx +37 -6
- package/corpus/templates/assets/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/assets/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/brain/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +12 -8
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +23 -12
- package/corpus/templates/brain/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/brain/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/brain/app/i18n/en-US.ts +3 -0
- package/corpus/templates/brain/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/brain/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/brain/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/brain/app/i18n/index.ts +31 -0
- package/corpus/templates/brain/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/brain/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/brain/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/brain/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/brain/app/i18n-data.ts +624 -0
- package/corpus/templates/brain/app/root.tsx +27 -12
- package/corpus/templates/brain/app/routes/settings.tsx +45 -8
- package/corpus/templates/brain/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/brain/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +2 -0
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +16 -9
- package/corpus/templates/calendar/app/i18n/ar-SA.ts +57 -0
- package/corpus/templates/calendar/app/i18n/de-DE.ts +58 -0
- package/corpus/templates/calendar/app/i18n/en-US.ts +57 -0
- package/corpus/templates/calendar/app/i18n/es-ES.ts +58 -0
- package/corpus/templates/calendar/app/i18n/fr-FR.ts +58 -0
- package/corpus/templates/calendar/app/i18n/hi-IN.ts +57 -0
- package/corpus/templates/calendar/app/i18n/index.ts +31 -0
- package/corpus/templates/calendar/app/i18n/ja-JP.ts +58 -0
- package/corpus/templates/calendar/app/i18n/ko-KR.ts +57 -0
- package/corpus/templates/calendar/app/i18n/pt-BR.ts +57 -0
- package/corpus/templates/calendar/app/i18n/zh-CN.ts +57 -0
- package/corpus/templates/calendar/app/i18n-data.ts +516 -0
- package/corpus/templates/calendar/app/pages/CalendarView.tsx +2 -0
- package/corpus/templates/calendar/app/pages/Settings.tsx +63 -28
- package/corpus/templates/calendar/app/root.tsx +78 -7
- package/corpus/templates/calendar/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/calendar/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/chat/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/chat/app/components/layout/Header.tsx +17 -11
- package/corpus/templates/chat/app/components/layout/Layout.tsx +12 -8
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +47 -18
- package/corpus/templates/chat/app/i18n/ar-SA.ts +62 -0
- package/corpus/templates/chat/app/i18n/de-DE.ts +63 -0
- package/corpus/templates/chat/app/i18n/en-US.ts +63 -0
- package/corpus/templates/chat/app/i18n/es-ES.ts +63 -0
- package/corpus/templates/chat/app/i18n/fr-FR.ts +63 -0
- package/corpus/templates/chat/app/i18n/hi-IN.ts +63 -0
- package/corpus/templates/chat/app/i18n/index.ts +31 -0
- package/corpus/templates/chat/app/i18n/ja-JP.ts +63 -0
- package/corpus/templates/chat/app/i18n/ko-KR.ts +63 -0
- package/corpus/templates/chat/app/i18n/pt-BR.ts +63 -0
- package/corpus/templates/chat/app/i18n/zh-CN.ts +61 -0
- package/corpus/templates/chat/app/i18n-data.ts +475 -0
- package/corpus/templates/chat/app/root.tsx +18 -5
- package/corpus/templates/chat/app/routes/_index.tsx +9 -8
- package/corpus/templates/chat/app/routes/settings.tsx +86 -0
- package/corpus/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/clips/app/components/layout/Header.tsx +23 -17
- package/corpus/templates/clips/app/components/library/empty-state.tsx +10 -34
- package/corpus/templates/clips/app/components/library/library-layout.tsx +45 -34
- package/corpus/templates/clips/app/i18n/ar-SA.ts +182 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +184 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +179 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +183 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +184 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +180 -0
- package/corpus/templates/clips/app/i18n/index.ts +41 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +180 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +178 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +183 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +173 -0
- package/corpus/templates/clips/app/root.tsx +104 -10
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +154 -95
- package/corpus/templates/clips/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-24-clips-now-includes-a-language-picker-and-simplified-chinese-ui.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/content/app/components/EmptyState.tsx +7 -5
- package/corpus/templates/content/app/components/ThemeToggle.tsx +4 -2
- package/corpus/templates/content/app/components/layout/Header.tsx +2 -0
- package/corpus/templates/content/app/components/layout/Layout.tsx +8 -7
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +41 -1
- package/corpus/templates/content/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/content/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/content/app/i18n/en-US.ts +3 -0
- package/corpus/templates/content/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/content/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/content/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/content/app/i18n/index.ts +31 -0
- package/corpus/templates/content/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/content/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/content/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/content/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/content/app/i18n-data.ts +490 -0
- package/corpus/templates/content/app/root.tsx +110 -23
- package/corpus/templates/content/app/routes/_app.settings.tsx +84 -0
- package/corpus/templates/content/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/content/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/design/app/components/layout/Header.tsx +16 -8
- package/corpus/templates/design/app/components/layout/Layout.tsx +8 -6
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +25 -9
- package/corpus/templates/design/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/design/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/design/app/i18n/en-US.ts +3 -0
- package/corpus/templates/design/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/design/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/design/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/design/app/i18n/index.ts +31 -0
- package/corpus/templates/design/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/design/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/design/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/design/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +350 -0
- package/corpus/templates/design/app/root.tsx +40 -15
- package/corpus/templates/design/app/routes/settings.tsx +43 -0
- package/corpus/templates/design/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/design/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/dispatch/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/en-US.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/index.ts +31 -0
- package/corpus/templates/dispatch/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/dispatch/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +267 -0
- package/corpus/templates/dispatch/app/root.tsx +18 -4
- package/corpus/templates/dispatch/app/routes/settings.tsx +86 -0
- package/corpus/templates/dispatch/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/forms/app/components/layout/Header.tsx +16 -9
- package/corpus/templates/forms/app/components/layout/Layout.tsx +6 -4
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +34 -17
- package/corpus/templates/forms/app/i18n/ar-SA.ts +58 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +59 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +59 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +59 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +59 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +59 -0
- package/corpus/templates/forms/app/i18n/index.ts +31 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +59 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +59 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +59 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +56 -0
- package/corpus/templates/forms/app/root.tsx +65 -16
- package/corpus/templates/forms/app/routes/_app.settings.tsx +85 -0
- package/corpus/templates/forms/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/forms/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +29 -17
- package/corpus/templates/macros/app/components/layout/Header.tsx +16 -10
- package/corpus/templates/macros/app/i18n/ar-SA.ts +54 -0
- package/corpus/templates/macros/app/i18n/de-DE.ts +55 -0
- package/corpus/templates/macros/app/i18n/en-US.ts +55 -0
- package/corpus/templates/macros/app/i18n/es-ES.ts +55 -0
- package/corpus/templates/macros/app/i18n/fr-FR.ts +55 -0
- package/corpus/templates/macros/app/i18n/hi-IN.ts +55 -0
- package/corpus/templates/macros/app/i18n/index.ts +31 -0
- package/corpus/templates/macros/app/i18n/ja-JP.ts +55 -0
- package/corpus/templates/macros/app/i18n/ko-KR.ts +55 -0
- package/corpus/templates/macros/app/i18n/pt-BR.ts +55 -0
- package/corpus/templates/macros/app/i18n/zh-CN.ts +53 -0
- package/corpus/templates/macros/app/root.tsx +65 -15
- package/corpus/templates/macros/app/routes/settings.tsx +85 -0
- package/corpus/templates/macros/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/macros/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +9 -4
- package/corpus/templates/mail/app/i18n/ar-SA.ts +33 -0
- package/corpus/templates/mail/app/i18n/de-DE.ts +33 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +32 -0
- package/corpus/templates/mail/app/i18n/es-ES.ts +33 -0
- package/corpus/templates/mail/app/i18n/fr-FR.ts +33 -0
- package/corpus/templates/mail/app/i18n/hi-IN.ts +32 -0
- package/corpus/templates/mail/app/i18n/index.ts +31 -0
- package/corpus/templates/mail/app/i18n/ja-JP.ts +32 -0
- package/corpus/templates/mail/app/i18n/ko-KR.ts +33 -0
- package/corpus/templates/mail/app/i18n/pt-BR.ts +34 -0
- package/corpus/templates/mail/app/i18n/zh-CN.ts +32 -0
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +67 -13
- package/corpus/templates/mail/app/root.tsx +20 -0
- package/corpus/templates/mail/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/mail/changelog/2026-06-24-settings-now-link-directly-to-agent-settings-for-model-api-k.md +6 -0
- package/corpus/templates/plan/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/plan/app/components/layout/Header.tsx +19 -12
- package/corpus/templates/plan/app/components/layout/Layout.tsx +11 -7
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +41 -28
- package/corpus/templates/plan/app/i18n/ar-SA.ts +77 -0
- package/corpus/templates/plan/app/i18n/de-DE.ts +78 -0
- package/corpus/templates/plan/app/i18n/en-US.ts +78 -0
- package/corpus/templates/plan/app/i18n/es-ES.ts +78 -0
- package/corpus/templates/plan/app/i18n/fr-FR.ts +78 -0
- package/corpus/templates/plan/app/i18n/hi-IN.ts +78 -0
- package/corpus/templates/plan/app/i18n/index.ts +31 -0
- package/corpus/templates/plan/app/i18n/ja-JP.ts +79 -0
- package/corpus/templates/plan/app/i18n/ko-KR.ts +77 -0
- package/corpus/templates/plan/app/i18n/pt-BR.ts +78 -0
- package/corpus/templates/plan/app/i18n/zh-CN.ts +74 -0
- package/corpus/templates/plan/app/root.tsx +45 -8
- package/corpus/templates/plan/app/routes/settings.tsx +86 -0
- package/corpus/templates/plan/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/slides/app/components/layout/Header.tsx +23 -11
- package/corpus/templates/slides/app/components/layout/Layout.tsx +7 -6
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +23 -11
- package/corpus/templates/slides/app/i18n/ar-SA.ts +54 -0
- package/corpus/templates/slides/app/i18n/de-DE.ts +56 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +55 -0
- package/corpus/templates/slides/app/i18n/es-ES.ts +55 -0
- package/corpus/templates/slides/app/i18n/fr-FR.ts +55 -0
- package/corpus/templates/slides/app/i18n/hi-IN.ts +55 -0
- package/corpus/templates/slides/app/i18n/index.ts +31 -0
- package/corpus/templates/slides/app/i18n/ja-JP.ts +55 -0
- package/corpus/templates/slides/app/i18n/ko-KR.ts +55 -0
- package/corpus/templates/slides/app/i18n/pt-BR.ts +55 -0
- package/corpus/templates/slides/app/i18n/zh-CN.ts +53 -0
- package/corpus/templates/slides/app/root.tsx +50 -8
- package/corpus/templates/slides/app/routes/settings.tsx +85 -0
- package/corpus/templates/slides/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/slides/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/videos/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/corpus/templates/videos/app/components/NewCompositionPopover.tsx +14 -9
- package/corpus/templates/videos/app/components/Sidebar.tsx +16 -9
- package/corpus/templates/videos/app/components/StudioHeader.tsx +12 -8
- package/corpus/templates/videos/app/components/layout/Header.tsx +21 -15
- package/corpus/templates/videos/app/components/layout/Layout.tsx +10 -7
- package/corpus/templates/videos/app/components/layout/NavSidebar.tsx +21 -6
- package/corpus/templates/videos/app/i18n/ar-SA.ts +73 -0
- package/corpus/templates/videos/app/i18n/de-DE.ts +75 -0
- package/corpus/templates/videos/app/i18n/en-US.ts +74 -0
- package/corpus/templates/videos/app/i18n/es-ES.ts +75 -0
- package/corpus/templates/videos/app/i18n/fr-FR.ts +75 -0
- package/corpus/templates/videos/app/i18n/hi-IN.ts +74 -0
- package/corpus/templates/videos/app/i18n/index.ts +31 -0
- package/corpus/templates/videos/app/i18n/ja-JP.ts +74 -0
- package/corpus/templates/videos/app/i18n/ko-KR.ts +74 -0
- package/corpus/templates/videos/app/i18n/pt-BR.ts +75 -0
- package/corpus/templates/videos/app/i18n/zh-CN.ts +72 -0
- package/corpus/templates/videos/app/pages/Index.tsx +11 -9
- package/corpus/templates/videos/app/root.tsx +45 -7
- package/corpus/templates/videos/app/routes/settings.tsx +85 -0
- package/corpus/templates/videos/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/videos/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/dist/client/CommandMenu.d.ts +3 -0
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +9 -0
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/app-providers.d.ts +8 -1
- package/dist/client/app-providers.d.ts.map +1 -1
- package/dist/client/app-providers.js +7 -5
- package/dist/client/app-providers.js.map +1 -1
- package/dist/client/i18n.d.ts +54 -0
- package/dist/client/i18n.d.ts.map +1 -0
- package/dist/client/i18n.js +354 -0
- package/dist/client/i18n.js.map +1 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/localization/actions/get-localization-preference.d.ts +4 -0
- package/dist/localization/actions/get-localization-preference.d.ts.map +1 -0
- package/dist/localization/actions/get-localization-preference.js +16 -0
- package/dist/localization/actions/get-localization-preference.js.map +1 -0
- package/dist/localization/actions/set-localization-preference.d.ts +6 -0
- package/dist/localization/actions/set-localization-preference.d.ts.map +1 -0
- package/dist/localization/actions/set-localization-preference.js +24 -0
- package/dist/localization/actions/set-localization-preference.js.map +1 -0
- package/dist/localization/index.d.ts +3 -0
- package/dist/localization/index.d.ts.map +1 -0
- package/dist/localization/index.js +3 -0
- package/dist/localization/index.js.map +1 -0
- package/dist/localization/server.d.ts +25 -0
- package/dist/localization/server.d.ts.map +1 -0
- package/dist/localization/server.js +69 -0
- package/dist/localization/server.js.map +1 -0
- package/dist/localization/shared.d.ts +25 -0
- package/dist/localization/shared.d.ts.map +1 -0
- package/dist/localization/shared.js +134 -0
- package/dist/localization/shared.js.map +1 -0
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +8 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/dist/templates/default/.agents/skills/internationalization/SKILL.md +77 -0
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/dist/templates/default/AGENTS.md +16 -15
- package/dist/templates/default/app/i18n/en-US.ts +29 -0
- package/dist/templates/default/app/i18n/index.ts +13 -0
- package/dist/templates/default/app/root.tsx +20 -1
- package/dist/templates/default/app/routes/_index.tsx +24 -9
- package/dist/templates/default/app/routes/settings.tsx +67 -0
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/internationalization/SKILL.md +77 -0
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +8 -0
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/docs/AGENTS.md +1 -0
- package/docs/content/client.md +15 -0
- package/docs/content/internationalization.md +145 -0
- package/docs/content/locales/ar-SA/internationalization.md +102 -0
- package/docs/content/locales/de-DE/internationalization.md +102 -0
- package/docs/content/locales/es-ES/internationalization.md +102 -0
- package/docs/content/locales/fr-FR/internationalization.md +102 -0
- package/docs/content/locales/hi-IN/internationalization.md +102 -0
- package/docs/content/locales/ja-JP/internationalization.md +114 -0
- package/docs/content/locales/ko-KR/internationalization.md +102 -0
- package/docs/content/locales/pt-BR/internationalization.md +102 -0
- package/docs/content/locales/zh-CN/internationalization.md +102 -0
- package/docs/content/skills-guide.md +19 -18
- package/package.json +7 -1
- package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/src/templates/default/.agents/skills/internationalization/SKILL.md +77 -0
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +6 -0
- package/src/templates/default/AGENTS.md +16 -15
- package/src/templates/default/app/i18n/en-US.ts +29 -0
- package/src/templates/default/app/i18n/index.ts +13 -0
- package/src/templates/default/app/root.tsx +20 -1
- package/src/templates/default/app/routes/_index.tsx +24 -9
- package/src/templates/default/app/routes/settings.tsx +67 -0
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/internationalization/SKILL.md +77 -0
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +6 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Internationalization"
|
|
3
|
+
description: "Localize Agent Native apps with shared locale catalogs, a language picker, browser-language fallback, and locale-aware docs content."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Internationalization
|
|
7
|
+
|
|
8
|
+
Agent Native apps can localize framework and template UI through the shared
|
|
9
|
+
`@agent-native/core/client/i18n` runtime. The framework stores the user's
|
|
10
|
+
language choice in SQL settings, exposes it as actions, and falls back to
|
|
11
|
+
English when an app has not translated a string yet.
|
|
12
|
+
|
|
13
|
+
## Runtime
|
|
14
|
+
|
|
15
|
+
Use the provider through `AppProviders`:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { AppProviders, getLocaleInitScript } from "@agent-native/core/client";
|
|
19
|
+
import { i18nCatalog } from "./i18n";
|
|
20
|
+
|
|
21
|
+
const LOCALE_INIT_SCRIPT = getLocaleInitScript();
|
|
22
|
+
|
|
23
|
+
<script
|
|
24
|
+
data-agent-native-locale-init
|
|
25
|
+
dangerouslySetInnerHTML={{ __html: LOCALE_INIT_SCRIPT }}
|
|
26
|
+
/>;
|
|
27
|
+
|
|
28
|
+
<AppProviders queryClient={queryClient} i18n={{ catalog: i18nCatalog }}>
|
|
29
|
+
<Outlet />
|
|
30
|
+
</AppProviders>;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`getLocaleInitScript()` sets the initial `lang`, `dir`, and
|
|
34
|
+
`window.__AGENT_NATIVE_LOCALE__` before React hydrates. Public SSR routes can
|
|
35
|
+
call `resolveLocaleFromRequest()` from `@agent-native/core/server` and pass the
|
|
36
|
+
resolved locale/catalog into that script to avoid hydration mismatches.
|
|
37
|
+
|
|
38
|
+
## Catalogs
|
|
39
|
+
|
|
40
|
+
Each localized template keeps catalogs under `app/i18n/`:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// app/i18n/index.ts
|
|
44
|
+
import enUS from "./en-US";
|
|
45
|
+
import type { AgentNativeI18nCatalog } from "@agent-native/core/client";
|
|
46
|
+
|
|
47
|
+
export const i18nCatalog = {
|
|
48
|
+
sourceLocale: "en-US",
|
|
49
|
+
messages: enUS,
|
|
50
|
+
loadMessages: async (locale) => {
|
|
51
|
+
switch (locale) {
|
|
52
|
+
case "zh-CN":
|
|
53
|
+
return (await import("./zh-CN")).default;
|
|
54
|
+
default:
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
} satisfies AgentNativeI18nCatalog;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Always bundle `en-US`. Dynamic-import non-English catalogs so users only
|
|
62
|
+
download the active locale. The supported locale codes are `en-US`, `zh-CN`,
|
|
63
|
+
`es-ES`, `fr-FR`, `de-DE`, `ja-JP`, `ko-KR`, `pt-BR`, `hi-IN`, and `ar-SA`.
|
|
64
|
+
|
|
65
|
+
## UI
|
|
66
|
+
|
|
67
|
+
Use `useT()` for interface strings and put `<LanguagePicker />` on the app's
|
|
68
|
+
`/settings` page. Sidebar apps should expose **Settings** in the app sidebar;
|
|
69
|
+
the header language icon is only a shortcut.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import {
|
|
73
|
+
LanguagePicker,
|
|
74
|
+
openAgentSettings,
|
|
75
|
+
useT,
|
|
76
|
+
} from "@agent-native/core/client";
|
|
77
|
+
|
|
78
|
+
function SettingsPage() {
|
|
79
|
+
const t = useT();
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<h2>{t("settings.languageTitle")}</h2>
|
|
83
|
+
<LanguagePicker label={t("settings.languageLabel")} />
|
|
84
|
+
|
|
85
|
+
<h2>{t("settings.agentTitle")}</h2>
|
|
86
|
+
<p>{t("settings.agentDescription")}</p>
|
|
87
|
+
<button type="button" onClick={() => openAgentSettings()}>
|
|
88
|
+
{t("settings.openAgentSettings")}
|
|
89
|
+
</button>
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The "Agent settings" control should open the right agent sidebar's Settings tab
|
|
96
|
+
for model, API key, automation, voice, and other framework-level controls.
|
|
97
|
+
Apps may duplicate high-value framework settings in their own settings page
|
|
98
|
+
when the setting is central to the app, but the sidebar settings tab remains the
|
|
99
|
+
source of truth.
|
|
100
|
+
|
|
101
|
+
Use `useFormatters()` for dates, numbers, relative time, and lists. Do not put
|
|
102
|
+
locale-sensitive date/number formatting inside translation strings.
|
|
103
|
+
|
|
104
|
+
## Docs Site Content {#docs-site-content}
|
|
105
|
+
|
|
106
|
+
Public docs pages use the same core provider, but with
|
|
107
|
+
`persistPreference={false}` so anonymous docs traffic uses localStorage and the
|
|
108
|
+
browser language instead of SQL settings actions. The English source remains in
|
|
109
|
+
`packages/core/docs/content/*.md`. Localized page overrides live next to it under
|
|
110
|
+
`packages/core/docs/content/locales/<locale>/<slug>.md`.
|
|
111
|
+
|
|
112
|
+
Use the same BCP-47 locale codes as app catalogs. Keep the same slug as the
|
|
113
|
+
English source, preserve stable anchors with `{#anchor}` on translated headings,
|
|
114
|
+
and leave routes, action names, protocol fields, env vars, and provider names
|
|
115
|
+
untranslated. If a locale has no translated Markdown for a page, the docs site
|
|
116
|
+
falls back to English for that page while still localizing navigation and chrome.
|
|
117
|
+
|
|
118
|
+
## Actions And Persistence
|
|
119
|
+
|
|
120
|
+
Every app inherits:
|
|
121
|
+
|
|
122
|
+
- `get-localization-preference` — read the current user's `{ locale }`
|
|
123
|
+
- `set-localization-preference` — set `"system"` or a supported locale
|
|
124
|
+
|
|
125
|
+
The durable value lives in user-scoped SQL settings under `localization`.
|
|
126
|
+
`localStorage` is only used for pre-hydration and anonymous fallback. The active
|
|
127
|
+
locale is mirrored into application state as ambient context so agents can see
|
|
128
|
+
the current interface language.
|
|
129
|
+
|
|
130
|
+
## Guard
|
|
131
|
+
|
|
132
|
+
Run:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pnpm guard:i18n-catalogs
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The guard verifies supported locale filenames, key parity, placeholder parity,
|
|
139
|
+
stale keys, and CLDR plural categories through `Intl.PluralRules`. It checks
|
|
140
|
+
structure, not translation quality; high-visibility strings still need human
|
|
141
|
+
review.
|
|
142
|
+
|
|
143
|
+
Do not translate stable identifiers such as action names, routes, enum values,
|
|
144
|
+
app-state keys, database values, protocol fields, env var names, or provider
|
|
145
|
+
names.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "التدويل"
|
|
3
|
+
description: "قم بتعريب تطبيقات Agent Native باستخدام كتالوجات locale مشتركة، واختيار اللغة، والرجوع إلى لغة المتصفح، ومحتوى docs حسب locale."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# التدويل
|
|
7
|
+
|
|
8
|
+
يمكن لتطبيقات Agent Native تعريب واجهة framework و templates عبر runtime المشترك `@agent-native/core/client/i18n`. يخزن framework اختيار لغة المستخدم في SQL settings، ويعرضه كـ actions، ويرجع إلى English عندما لا تكون string مترجمة في التطبيق بعد.
|
|
9
|
+
|
|
10
|
+
## Runtime {#runtime}
|
|
11
|
+
|
|
12
|
+
استخدم provider عبر `AppProviders`:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { AppProviders, getLocaleInitScript } from "@agent-native/core/client";
|
|
16
|
+
import { i18nCatalog } from "./i18n";
|
|
17
|
+
|
|
18
|
+
const LOCALE_INIT_SCRIPT = getLocaleInitScript();
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
data-agent-native-locale-init
|
|
22
|
+
dangerouslySetInnerHTML={{ __html: LOCALE_INIT_SCRIPT }}
|
|
23
|
+
/>;
|
|
24
|
+
|
|
25
|
+
<AppProviders queryClient={queryClient} i18n={{ catalog: i18nCatalog }}>
|
|
26
|
+
<Outlet />
|
|
27
|
+
</AppProviders>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
يضبط `getLocaleInitScript()` قيم `lang` و `dir` و `window.__AGENT_NATIVE_LOCALE__` قبل React hydration. يمكن لمسارات SSR العامة استدعاء `resolveLocaleFromRequest()` من `@agent-native/core/server` وتمرير locale/catalog الناتج إلى script لتجنب hydration mismatches.
|
|
31
|
+
|
|
32
|
+
## Catalogs {#catalogs}
|
|
33
|
+
|
|
34
|
+
كل template مترجم يحتفظ بالكتالوجات تحت `app/i18n/`:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// app/i18n/index.ts
|
|
38
|
+
import enUS from "./en-US";
|
|
39
|
+
import type { AgentNativeI18nCatalog } from "@agent-native/core/client";
|
|
40
|
+
|
|
41
|
+
export const i18nCatalog = {
|
|
42
|
+
sourceLocale: "en-US",
|
|
43
|
+
messages: enUS,
|
|
44
|
+
loadMessages: async (locale) => {
|
|
45
|
+
switch (locale) {
|
|
46
|
+
case "zh-CN":
|
|
47
|
+
return (await import("./zh-CN")).default;
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
} satisfies AgentNativeI18nCatalog;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
احزم `en-US` دائماً. استخدم dynamic import للكتالوجات غير English حتى ينزل المستخدمون locale النشط فقط. locale codes المدعومة هي `en-US` و `zh-CN` و `es-ES` و `fr-FR` و `de-DE` و `ja-JP` و `ko-KR` و `pt-BR` و `hi-IN` و `ar-SA`.
|
|
56
|
+
|
|
57
|
+
## UI {#ui}
|
|
58
|
+
|
|
59
|
+
استخدم `useT()` لنصوص الواجهة و `<LanguagePicker />` في settings:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { LanguagePicker, useT } from "@agent-native/core/client";
|
|
63
|
+
|
|
64
|
+
function SettingsLanguageCard() {
|
|
65
|
+
const t = useT();
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<h2>{t("settings.languageTitle")}</h2>
|
|
69
|
+
<LanguagePicker label={t("settings.languageLabel")} />
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
استخدم `useFormatters()` للتواريخ، والأرقام، والوقت النسبي، والقوائم. لا تضع تنسيق التاريخ أو الرقم المعتمد على locale داخل strings المترجمة.
|
|
76
|
+
|
|
77
|
+
## محتوى موقع docs {#docs-site-content}
|
|
78
|
+
|
|
79
|
+
تستخدم صفحات docs العامة نفس core provider، لكن مع `persistPreference={false}` حتى يستخدم زوار docs المجهولون localStorage ولغة المتصفح بدلاً من SQL settings actions. يبقى مصدر English في `packages/core/docs/content/*.md`. توجد overrides المترجمة في `packages/core/docs/content/locales/<locale>/<slug>.md`.
|
|
80
|
+
|
|
81
|
+
استخدم نفس BCP-47 locale codes الخاصة بكتالوجات التطبيقات. حافظ على نفس slug الموجود في مصدر English، واحفظ anchors ثابتة باستخدام `{#anchor}` على headings المترجمة، ولا تترجم routes أو action names أو protocol fields أو env vars أو provider names. إذا لم يملك locale ملف Markdown مترجماً لصفحة ما، يعود موقع docs إلى English لتلك الصفحة مع استمرار تعريب navigation و chrome.
|
|
82
|
+
|
|
83
|
+
## Actions والاستمرارية {#actions-and-persistence}
|
|
84
|
+
|
|
85
|
+
كل تطبيق يرث:
|
|
86
|
+
|
|
87
|
+
- `get-localization-preference` — يقرأ `{ locale }` للمستخدم الحالي
|
|
88
|
+
- `set-localization-preference` — يضبط `"system"` أو locale مدعوماً
|
|
89
|
+
|
|
90
|
+
القيمة الدائمة موجودة في SQL settings بنطاق المستخدم تحت `localization`. يستخدم `localStorage` فقط قبل hydration وللرجوع المجهول. ينعكس locale النشط في application state كسياق محيط حتى تتمكن agents من رؤية لغة الواجهة الحالية.
|
|
91
|
+
|
|
92
|
+
## Guard {#guard}
|
|
93
|
+
|
|
94
|
+
شغّل:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm guard:i18n-catalogs
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
يتحقق guard من أسماء ملفات locale المدعومة، و key parity، و placeholder parity، و stale keys، وفئات CLDR plural عبر `Intl.PluralRules`. هو يتحقق من البنية لا جودة الترجمة؛ strings البارزة ما زالت تحتاج مراجعة بشرية.
|
|
101
|
+
|
|
102
|
+
لا تترجم المعرفات الثابتة مثل action names أو routes أو enum values أو app-state keys أو database values أو protocol fields أو env var names أو provider names.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Internationalisierung"
|
|
3
|
+
description: "Lokalisiere Agent Native Apps mit gemeinsamen Locale-Katalogen, Sprachauswahl, Browser-Fallback und locale-bewussten Docs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Internationalisierung
|
|
7
|
+
|
|
8
|
+
Agent Native Apps können Framework- und Template-UI über die gemeinsame Runtime `@agent-native/core/client/i18n` lokalisieren. Das Framework speichert die Sprachwahl des Benutzers in SQL-Settings, stellt sie als actions bereit und fällt auf English zurück, wenn eine App einen String noch nicht übersetzt hat.
|
|
9
|
+
|
|
10
|
+
## Runtime {#runtime}
|
|
11
|
+
|
|
12
|
+
Verwende den Provider über `AppProviders`:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { AppProviders, getLocaleInitScript } from "@agent-native/core/client";
|
|
16
|
+
import { i18nCatalog } from "./i18n";
|
|
17
|
+
|
|
18
|
+
const LOCALE_INIT_SCRIPT = getLocaleInitScript();
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
data-agent-native-locale-init
|
|
22
|
+
dangerouslySetInnerHTML={{ __html: LOCALE_INIT_SCRIPT }}
|
|
23
|
+
/>;
|
|
24
|
+
|
|
25
|
+
<AppProviders queryClient={queryClient} i18n={{ catalog: i18nCatalog }}>
|
|
26
|
+
<Outlet />
|
|
27
|
+
</AppProviders>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`getLocaleInitScript()` setzt das anfängliche `lang`, `dir` und `window.__AGENT_NATIVE_LOCALE__`, bevor React hydriert. Öffentliche SSR-Routen können `resolveLocaleFromRequest()` aus `@agent-native/core/server` aufrufen und den aufgelösten locale/catalog an das Script übergeben, um Hydration-Abweichungen zu vermeiden.
|
|
31
|
+
|
|
32
|
+
## Kataloge {#catalogs}
|
|
33
|
+
|
|
34
|
+
Jedes lokalisierte Template hält Kataloge unter `app/i18n/`:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// app/i18n/index.ts
|
|
38
|
+
import enUS from "./en-US";
|
|
39
|
+
import type { AgentNativeI18nCatalog } from "@agent-native/core/client";
|
|
40
|
+
|
|
41
|
+
export const i18nCatalog = {
|
|
42
|
+
sourceLocale: "en-US",
|
|
43
|
+
messages: enUS,
|
|
44
|
+
loadMessages: async (locale) => {
|
|
45
|
+
switch (locale) {
|
|
46
|
+
case "zh-CN":
|
|
47
|
+
return (await import("./zh-CN")).default;
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
} satisfies AgentNativeI18nCatalog;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Bundle immer `en-US`. Importiere Nicht-English-Kataloge dynamisch, damit Benutzer nur den aktiven locale herunterladen. Unterstützte locale codes sind `en-US`, `zh-CN`, `es-ES`, `fr-FR`, `de-DE`, `ja-JP`, `ko-KR`, `pt-BR`, `hi-IN` und `ar-SA`.
|
|
56
|
+
|
|
57
|
+
## UI {#ui}
|
|
58
|
+
|
|
59
|
+
Verwende `useT()` für UI-Texte und `<LanguagePicker />` in den Settings:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { LanguagePicker, useT } from "@agent-native/core/client";
|
|
63
|
+
|
|
64
|
+
function SettingsLanguageCard() {
|
|
65
|
+
const t = useT();
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<h2>{t("settings.languageTitle")}</h2>
|
|
69
|
+
<LanguagePicker label={t("settings.languageLabel")} />
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Verwende `useFormatters()` für Datumswerte, Zahlen, relative Zeiten und Listen. Lege locale-abhängige Datums- oder Zahlenformatierung nicht in Übersetzungsstrings ab.
|
|
76
|
+
|
|
77
|
+
## Docs-Site-Inhalt {#docs-site-content}
|
|
78
|
+
|
|
79
|
+
Öffentliche Docs-Seiten verwenden denselben core provider, aber mit `persistPreference={false}`, damit anonymer Docs-Traffic localStorage und die Browsersprache nutzt statt SQL-Settings-actions. Die English-Quelle bleibt in `packages/core/docs/content/*.md`. Lokalisierte Seiten-Overrides liegen unter `packages/core/docs/content/locales/<locale>/<slug>.md`.
|
|
80
|
+
|
|
81
|
+
Verwende dieselben BCP-47 locale codes wie App-Kataloge. Behalte denselben slug wie die English-Quelle, bewahre stabile Anker mit `{#anchor}` auf übersetzten Überschriften und übersetze keine routes, action names, protocol fields, env vars oder provider names. Wenn ein locale keine übersetzte Markdown-Datei für eine Seite hat, fällt die Docs-Site für diese Seite auf English zurück, lokalisiert aber weiterhin Navigation und Chrome.
|
|
82
|
+
|
|
83
|
+
## Actions und Persistenz {#actions-and-persistence}
|
|
84
|
+
|
|
85
|
+
Jede App erbt:
|
|
86
|
+
|
|
87
|
+
- `get-localization-preference` — liest `{ locale }` des aktuellen Benutzers
|
|
88
|
+
- `set-localization-preference` — setzt `"system"` oder einen unterstützten locale
|
|
89
|
+
|
|
90
|
+
Der dauerhafte Wert liegt in benutzerbezogenen SQL-Settings unter `localization`. `localStorage` wird nur für Pre-Hydration und anonymen Fallback genutzt. Der aktive locale wird als Umgebungskontext in application state gespiegelt, damit agents die aktuelle UI-Sprache sehen.
|
|
91
|
+
|
|
92
|
+
## Guard {#guard}
|
|
93
|
+
|
|
94
|
+
Ausführen:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm guard:i18n-catalogs
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Der Guard prüft unterstützte locale-Dateinamen, key parity, placeholder parity, stale keys und CLDR-Pluralkategorien über `Intl.PluralRules`. Er prüft Struktur, nicht Übersetzungsqualität; gut sichtbare Strings brauchen weiterhin menschliche Prüfung.
|
|
101
|
+
|
|
102
|
+
Übersetze keine stabilen Bezeichner wie action names, routes, enum values, app-state keys, database values, protocol fields, env var names oder provider names.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Internacionalización"
|
|
3
|
+
description: "Localiza apps Agent Native con catálogos compartidos, selector de idioma, fallback al navegador y contenido de docs por locale."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Internacionalización
|
|
7
|
+
|
|
8
|
+
Las apps Agent Native pueden localizar la UI del framework y de las plantillas con el runtime compartido `@agent-native/core/client/i18n`. El framework guarda la elección de idioma del usuario en settings SQL, la expone como actions y vuelve a English cuando una app aún no tradujo una cadena.
|
|
9
|
+
|
|
10
|
+
## Runtime {#runtime}
|
|
11
|
+
|
|
12
|
+
Usa el provider a través de `AppProviders`:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { AppProviders, getLocaleInitScript } from "@agent-native/core/client";
|
|
16
|
+
import { i18nCatalog } from "./i18n";
|
|
17
|
+
|
|
18
|
+
const LOCALE_INIT_SCRIPT = getLocaleInitScript();
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
data-agent-native-locale-init
|
|
22
|
+
dangerouslySetInnerHTML={{ __html: LOCALE_INIT_SCRIPT }}
|
|
23
|
+
/>;
|
|
24
|
+
|
|
25
|
+
<AppProviders queryClient={queryClient} i18n={{ catalog: i18nCatalog }}>
|
|
26
|
+
<Outlet />
|
|
27
|
+
</AppProviders>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`getLocaleInitScript()` define el `lang`, `dir` y `window.__AGENT_NATIVE_LOCALE__` iniciales antes de que React hidrate. Las rutas SSR públicas pueden llamar a `resolveLocaleFromRequest()` desde `@agent-native/core/server` y pasar el locale/catalog resuelto al script para evitar desajustes de hydration.
|
|
31
|
+
|
|
32
|
+
## Catálogos {#catalogs}
|
|
33
|
+
|
|
34
|
+
Cada plantilla localizada mantiene catálogos en `app/i18n/`:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// app/i18n/index.ts
|
|
38
|
+
import enUS from "./en-US";
|
|
39
|
+
import type { AgentNativeI18nCatalog } from "@agent-native/core/client";
|
|
40
|
+
|
|
41
|
+
export const i18nCatalog = {
|
|
42
|
+
sourceLocale: "en-US",
|
|
43
|
+
messages: enUS,
|
|
44
|
+
loadMessages: async (locale) => {
|
|
45
|
+
switch (locale) {
|
|
46
|
+
case "zh-CN":
|
|
47
|
+
return (await import("./zh-CN")).default;
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
} satisfies AgentNativeI18nCatalog;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Incluye siempre `en-US`. Importa dinámicamente los catálogos que no sean English para que cada usuario descargue solo el locale activo. Los locale codes admitidos son `en-US`, `zh-CN`, `es-ES`, `fr-FR`, `de-DE`, `ja-JP`, `ko-KR`, `pt-BR`, `hi-IN` y `ar-SA`.
|
|
56
|
+
|
|
57
|
+
## UI {#ui}
|
|
58
|
+
|
|
59
|
+
Usa `useT()` para textos de interfaz y `<LanguagePicker />` en settings:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { LanguagePicker, useT } from "@agent-native/core/client";
|
|
63
|
+
|
|
64
|
+
function SettingsLanguageCard() {
|
|
65
|
+
const t = useT();
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<h2>{t("settings.languageTitle")}</h2>
|
|
69
|
+
<LanguagePicker label={t("settings.languageLabel")} />
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Usa `useFormatters()` para fechas, números, tiempo relativo y listas. No pongas formatos sensibles al locale dentro de cadenas traducidas.
|
|
76
|
+
|
|
77
|
+
## Contenido del sitio de docs {#docs-site-content}
|
|
78
|
+
|
|
79
|
+
Las páginas públicas de docs usan el mismo core provider, pero con `persistPreference={false}` para que el tráfico anónimo use localStorage y el idioma del navegador en vez de actions de settings SQL. La fuente English queda en `packages/core/docs/content/*.md`. Las páginas localizadas que sobrescriben esa fuente viven en `packages/core/docs/content/locales/<locale>/<slug>.md`.
|
|
80
|
+
|
|
81
|
+
Usa los mismos BCP-47 locale codes que los catálogos de app. Conserva el mismo slug que la fuente English, preserva anclas estables con `{#anchor}` en headings traducidos y no traduzcas routes, action names, protocol fields, env vars ni provider names. Si un locale no tiene Markdown traducido para una página, el sitio cae a English para esa página mientras sigue localizando la navegación y el chrome.
|
|
82
|
+
|
|
83
|
+
## Actions y persistencia {#actions-and-persistence}
|
|
84
|
+
|
|
85
|
+
Cada app hereda:
|
|
86
|
+
|
|
87
|
+
- `get-localization-preference` — lee el `{ locale }` del usuario actual
|
|
88
|
+
- `set-localization-preference` — define `"system"` o un locale admitido
|
|
89
|
+
|
|
90
|
+
El valor durable vive en settings SQL con alcance de usuario bajo `localization`. `localStorage` solo se usa para pre-hydration y fallback anónimo. El locale activo se refleja en application state como contexto ambiental para que los agents vean el idioma actual de la interfaz.
|
|
91
|
+
|
|
92
|
+
## Guard {#guard}
|
|
93
|
+
|
|
94
|
+
Ejecuta:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm guard:i18n-catalogs
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
El guard verifica nombres de archivos locale admitidos, key parity, placeholder parity, stale keys y categorías plurales CLDR mediante `Intl.PluralRules`. Revisa estructura, no calidad de traducción; las cadenas de alta visibilidad necesitan revisión humana.
|
|
101
|
+
|
|
102
|
+
No traduzcas identificadores estables como action names, routes, enum values, app-state keys, database values, protocol fields, env var names o provider names.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Internationalisation"
|
|
3
|
+
description: "Localisez les apps Agent Native avec des catalogues partagés, un sélecteur de langue, un fallback navigateur et du contenu docs par locale."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Internationalisation
|
|
7
|
+
|
|
8
|
+
Les apps Agent Native peuvent localiser l'UI du framework et des modèles via le runtime partagé `@agent-native/core/client/i18n`. Le framework stocke le choix de langue de l'utilisateur dans les settings SQL, l'expose sous forme d'actions et revient à English lorsqu'une app n'a pas encore traduit une chaîne.
|
|
9
|
+
|
|
10
|
+
## Runtime {#runtime}
|
|
11
|
+
|
|
12
|
+
Utilisez le provider via `AppProviders` :
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { AppProviders, getLocaleInitScript } from "@agent-native/core/client";
|
|
16
|
+
import { i18nCatalog } from "./i18n";
|
|
17
|
+
|
|
18
|
+
const LOCALE_INIT_SCRIPT = getLocaleInitScript();
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
data-agent-native-locale-init
|
|
22
|
+
dangerouslySetInnerHTML={{ __html: LOCALE_INIT_SCRIPT }}
|
|
23
|
+
/>;
|
|
24
|
+
|
|
25
|
+
<AppProviders queryClient={queryClient} i18n={{ catalog: i18nCatalog }}>
|
|
26
|
+
<Outlet />
|
|
27
|
+
</AppProviders>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`getLocaleInitScript()` définit le `lang`, le `dir` et `window.__AGENT_NATIVE_LOCALE__` initiaux avant l'hydratation React. Les routes SSR publiques peuvent appeler `resolveLocaleFromRequest()` depuis `@agent-native/core/server` et transmettre le locale/catalog résolu au script pour éviter les écarts d'hydratation.
|
|
31
|
+
|
|
32
|
+
## Catalogues {#catalogs}
|
|
33
|
+
|
|
34
|
+
Chaque modèle localisé conserve ses catalogues dans `app/i18n/` :
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// app/i18n/index.ts
|
|
38
|
+
import enUS from "./en-US";
|
|
39
|
+
import type { AgentNativeI18nCatalog } from "@agent-native/core/client";
|
|
40
|
+
|
|
41
|
+
export const i18nCatalog = {
|
|
42
|
+
sourceLocale: "en-US",
|
|
43
|
+
messages: enUS,
|
|
44
|
+
loadMessages: async (locale) => {
|
|
45
|
+
switch (locale) {
|
|
46
|
+
case "zh-CN":
|
|
47
|
+
return (await import("./zh-CN")).default;
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
} satisfies AgentNativeI18nCatalog;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Emballez toujours `en-US`. Importez dynamiquement les catalogues non English afin que les utilisateurs ne téléchargent que le locale actif. Les locale codes pris en charge sont `en-US`, `zh-CN`, `es-ES`, `fr-FR`, `de-DE`, `ja-JP`, `ko-KR`, `pt-BR`, `hi-IN` et `ar-SA`.
|
|
56
|
+
|
|
57
|
+
## UI {#ui}
|
|
58
|
+
|
|
59
|
+
Utilisez `useT()` pour les textes d'interface et `<LanguagePicker />` dans les settings :
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { LanguagePicker, useT } from "@agent-native/core/client";
|
|
63
|
+
|
|
64
|
+
function SettingsLanguageCard() {
|
|
65
|
+
const t = useT();
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<h2>{t("settings.languageTitle")}</h2>
|
|
69
|
+
<LanguagePicker label={t("settings.languageLabel")} />
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Utilisez `useFormatters()` pour les dates, nombres, temps relatifs et listes. Ne placez pas de formatage sensible au locale dans les chaînes traduites.
|
|
76
|
+
|
|
77
|
+
## Contenu du site docs {#docs-site-content}
|
|
78
|
+
|
|
79
|
+
Les pages publiques de docs utilisent le même core provider, mais avec `persistPreference={false}` afin que le trafic anonyme utilise localStorage et la langue du navigateur au lieu des actions de settings SQL. La source English reste dans `packages/core/docs/content/*.md`. Les remplacements localisés vivent dans `packages/core/docs/content/locales/<locale>/<slug>.md`.
|
|
80
|
+
|
|
81
|
+
Utilisez les mêmes BCP-47 locale codes que les catalogues d'app. Gardez le même slug que la source English, préservez les ancres stables avec `{#anchor}` sur les titres traduits, et ne traduisez pas les routes, action names, protocol fields, env vars ou provider names. Si un locale n'a pas de Markdown traduit pour une page, le site revient à English pour cette page tout en localisant la navigation et le chrome.
|
|
82
|
+
|
|
83
|
+
## Actions et persistance {#actions-and-persistence}
|
|
84
|
+
|
|
85
|
+
Chaque app hérite de :
|
|
86
|
+
|
|
87
|
+
- `get-localization-preference` — lit le `{ locale }` de l'utilisateur actuel
|
|
88
|
+
- `set-localization-preference` — définit `"system"` ou un locale pris en charge
|
|
89
|
+
|
|
90
|
+
La valeur durable vit dans les settings SQL à portée utilisateur sous `localization`. `localStorage` sert uniquement au pre-hydration et au fallback anonyme. Le locale actif est reflété dans application state comme contexte ambiant afin que les agents voient la langue actuelle de l'interface.
|
|
91
|
+
|
|
92
|
+
## Guard {#guard}
|
|
93
|
+
|
|
94
|
+
Exécutez :
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm guard:i18n-catalogs
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Le guard vérifie les noms de fichiers locale pris en charge, key parity, placeholder parity, stale keys et catégories plurales CLDR via `Intl.PluralRules`. Il vérifie la structure, pas la qualité de traduction ; les chaînes très visibles nécessitent encore une revue humaine.
|
|
101
|
+
|
|
102
|
+
Ne traduisez pas les identifiants stables comme action names, routes, enum values, app-state keys, database values, protocol fields, env var names ou provider names.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "अंतरराष्ट्रीयकरण"
|
|
3
|
+
description: "shared locale catalogs, language picker, browser-language fallback और locale-aware docs content के साथ Agent Native apps को localize करें।"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# अंतरराष्ट्रीयकरण
|
|
7
|
+
|
|
8
|
+
Agent Native apps shared `@agent-native/core/client/i18n` runtime के जरिए framework और template UI को localize कर सकते हैं। framework उपयोगकर्ता की भाषा पसंद को SQL settings में store करता है, उसे actions के रूप में expose करता है, और जब किसी app में कोई string translate नहीं होती तो English पर fallback करता है।
|
|
9
|
+
|
|
10
|
+
## Runtime {#runtime}
|
|
11
|
+
|
|
12
|
+
Provider को `AppProviders` के जरिए इस्तेमाल करें:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { AppProviders, getLocaleInitScript } from "@agent-native/core/client";
|
|
16
|
+
import { i18nCatalog } from "./i18n";
|
|
17
|
+
|
|
18
|
+
const LOCALE_INIT_SCRIPT = getLocaleInitScript();
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
data-agent-native-locale-init
|
|
22
|
+
dangerouslySetInnerHTML={{ __html: LOCALE_INIT_SCRIPT }}
|
|
23
|
+
/>;
|
|
24
|
+
|
|
25
|
+
<AppProviders queryClient={queryClient} i18n={{ catalog: i18nCatalog }}>
|
|
26
|
+
<Outlet />
|
|
27
|
+
</AppProviders>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`getLocaleInitScript()` React hydration से पहले शुरुआती `lang`, `dir`, और `window.__AGENT_NATIVE_LOCALE__` सेट करता है। Public SSR routes `@agent-native/core/server` से `resolveLocaleFromRequest()` call कर सकते हैं और resolved locale/catalog को script में pass कर सकते हैं ताकि hydration mismatch न हो।
|
|
31
|
+
|
|
32
|
+
## Catalogs {#catalogs}
|
|
33
|
+
|
|
34
|
+
हर localized template catalogs को `app/i18n/` में रखता है:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// app/i18n/index.ts
|
|
38
|
+
import enUS from "./en-US";
|
|
39
|
+
import type { AgentNativeI18nCatalog } from "@agent-native/core/client";
|
|
40
|
+
|
|
41
|
+
export const i18nCatalog = {
|
|
42
|
+
sourceLocale: "en-US",
|
|
43
|
+
messages: enUS,
|
|
44
|
+
loadMessages: async (locale) => {
|
|
45
|
+
switch (locale) {
|
|
46
|
+
case "zh-CN":
|
|
47
|
+
return (await import("./zh-CN")).default;
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
} satisfies AgentNativeI18nCatalog;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
हमेशा `en-US` bundle करें। Non-English catalogs को dynamic import करें ताकि users केवल active locale download करें। Supported locale codes हैं `en-US`, `zh-CN`, `es-ES`, `fr-FR`, `de-DE`, `ja-JP`, `ko-KR`, `pt-BR`, `hi-IN`, और `ar-SA`।
|
|
56
|
+
|
|
57
|
+
## UI {#ui}
|
|
58
|
+
|
|
59
|
+
Interface strings के लिए `useT()` और settings में `<LanguagePicker />` इस्तेमाल करें:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { LanguagePicker, useT } from "@agent-native/core/client";
|
|
63
|
+
|
|
64
|
+
function SettingsLanguageCard() {
|
|
65
|
+
const t = useT();
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<h2>{t("settings.languageTitle")}</h2>
|
|
69
|
+
<LanguagePicker label={t("settings.languageLabel")} />
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Dates, numbers, relative time और lists के लिए `useFormatters()` इस्तेमाल करें। Locale-sensitive date/number formatting को translation strings में embed न करें।
|
|
76
|
+
|
|
77
|
+
## Docs site content {#docs-site-content}
|
|
78
|
+
|
|
79
|
+
Public docs pages वही core provider इस्तेमाल करते हैं, लेकिन `persistPreference={false}` के साथ, ताकि anonymous docs traffic SQL settings actions की जगह localStorage और browser language इस्तेमाल करे। English source `packages/core/docs/content/*.md` में रहता है। Localized page overrides `packages/core/docs/content/locales/<locale>/<slug>.md` में रहते हैं।
|
|
80
|
+
|
|
81
|
+
App catalogs जैसे ही BCP-47 locale codes इस्तेमाल करें। English source जैसा slug रखें, translated headings पर `{#anchor}` से stable anchors preserve करें, और routes, action names, protocol fields, env vars या provider names translate न करें। अगर किसी locale में किसी page का translated Markdown नहीं है, docs site उस page के लिए English fallback करेगा और navigation/chrome फिर भी localize रहेगा।
|
|
82
|
+
|
|
83
|
+
## Actions और persistence {#actions-and-persistence}
|
|
84
|
+
|
|
85
|
+
हर app को मिलता है:
|
|
86
|
+
|
|
87
|
+
- `get-localization-preference` — current user का `{ locale }` पढ़ता है
|
|
88
|
+
- `set-localization-preference` — `"system"` या supported locale सेट करता है
|
|
89
|
+
|
|
90
|
+
Durable value user-scoped SQL settings में `localization` key के तहत रहता है। `localStorage` केवल pre-hydration और anonymous fallback के लिए है। Active locale application state में ambient context के रूप में mirror होता है ताकि agents current interface language देख सकें।
|
|
91
|
+
|
|
92
|
+
## Guard {#guard}
|
|
93
|
+
|
|
94
|
+
चलाएं:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm guard:i18n-catalogs
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Guard supported locale filenames, key parity, placeholder parity, stale keys, और `Intl.PluralRules` के जरिए CLDR plural categories verify करता है। यह structure check करता है, translation quality नहीं; high-visibility strings को human review चाहिए।
|
|
101
|
+
|
|
102
|
+
Stable identifiers जैसे action names, routes, enum values, app-state keys, database values, protocol fields, env var names या provider names translate न करें।
|