From 51db5fa0fbc4b0aedec5586e1ecda5afd84ab983 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 14:42:13 +0000 Subject: [PATCH] feat(example-starter): ship all 11 platform locales, one translation file per locale supportedLocales lists every PLATFORM_LOCALE_TAGS tag; Simplified Chinese moves from zh-CN to the zh-Hans write tag; nine AI-written bundles added (zh-Hant derived from zh-Hans); a pin holds the list, files and key parity. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L9qibvqSPRf68vj73hQF3s --- .changeset/39322-starter-eleven-locales.md | 15 ++ examples/app-starter/README.md | 5 +- examples/app-starter/objectstack.config.ts | 5 +- .../src/translations/ar.translation.ts | 166 +++++++++++++ .../src/translations/de.translation.ts | 184 ++++++++++++++ .../src/translations/en.translation.ts | 59 +++++ .../src/translations/es.translation.ts | 186 ++++++++++++++ .../src/translations/fr.translation.ts | 181 ++++++++++++++ .../app-starter/src/translations/index.ts | 32 ++- .../src/translations/ja.translation.ts | 151 ++++++++++++ .../src/translations/ko.translation.ts | 151 ++++++++++++ .../src/translations/pt-BR.translation.ts | 186 ++++++++++++++ .../src/translations/ru.translation.ts | 183 ++++++++++++++ .../src/translations/starter.translation.ts | 227 ------------------ .../src/translations/zh-Hans.translation.ts | 151 ++++++++++++ .../src/translations/zh-Hant.translation.ts | 151 ++++++++++++ .../test/translations-locales-39322.test.ts | 59 +++++ 17 files changed, 1862 insertions(+), 230 deletions(-) create mode 100644 .changeset/39322-starter-eleven-locales.md create mode 100644 examples/app-starter/src/translations/ar.translation.ts create mode 100644 examples/app-starter/src/translations/de.translation.ts create mode 100644 examples/app-starter/src/translations/en.translation.ts create mode 100644 examples/app-starter/src/translations/es.translation.ts create mode 100644 examples/app-starter/src/translations/fr.translation.ts create mode 100644 examples/app-starter/src/translations/ja.translation.ts create mode 100644 examples/app-starter/src/translations/ko.translation.ts create mode 100644 examples/app-starter/src/translations/pt-BR.translation.ts create mode 100644 examples/app-starter/src/translations/ru.translation.ts delete mode 100644 examples/app-starter/src/translations/starter.translation.ts create mode 100644 examples/app-starter/src/translations/zh-Hans.translation.ts create mode 100644 examples/app-starter/src/translations/zh-Hant.translation.ts create mode 100644 examples/app-starter/test/translations-locales-39322.test.ts diff --git a/.changeset/39322-starter-eleven-locales.md b/.changeset/39322-starter-eleven-locales.md new file mode 100644 index 00000000000..6a1078076d4 --- /dev/null +++ b/.changeset/39322-starter-eleven-locales.md @@ -0,0 +1,15 @@ +--- +'@objectstack/example-starter': patch +--- + +feat(example-starter): the Starter ships all 11 platform locales, one translation file per locale, and writes Simplified Chinese as `zh-Hans` + +Clause-②: no +Metadata-protocol: none + +Who sees it: an organization that installs the Starter from the marketplace and works in a language other than English or Simplified Chinese. + +- **`supportedLocales` lists every platform locale**, written out: `en`, `zh-Hans`, `zh-Hant`, `es`, `ar`, `fr`, `pt-BR`, `ru`, `de`, `ja`, `ko`. The Console's language menu offers only the locales an app lists, so all eleven now appear for the Starter. +- **Simplified Chinese moves from `zh-CN` to `zh-Hans`**, the platform's write tag; `zh-CN` stays readable as an alias of it. The Chinese text is unchanged. +- **`src/translations/` holds one file per locale** (`en.translation.ts`, `zh-Hans.translation.ts`, …) and `index.ts` puts them into one bundle. The nine new languages are AI-written from the English source; `zh-Hant` is derived from `zh-Hans`. +- `os i18n check --strict` reads 100% for all eleven locales (95 keys each). diff --git a/examples/app-starter/README.md b/examples/app-starter/README.md index 31e122ffbd3..d191a3e5d27 100644 --- a/examples/app-starter/README.md +++ b/examples/app-starter/README.md @@ -22,7 +22,10 @@ notes in one menu. - `src/knowledge/` — `biz_articles`, a knowledge source over the published help articles: each `##` section of an article is one passage. See [Searching the help articles](#searching-the-help-articles). -- `src/translations/` — English and Simplified Chinese. +- `src/translations/` — one file per platform locale, all 11: English + (`en`, the source), Simplified and Traditional Chinese (`zh-Hans`, + `zh-Hant`), Spanish, Arabic, French, Brazilian Portuguese, Russian, German, + Japanese and Korean. `os i18n check --strict` holds them complete. The API names carry the `biz_` namespace, so a tenant can install this starter beside a CRM package without a name clash. Uninstalling the package diff --git a/examples/app-starter/objectstack.config.ts b/examples/app-starter/objectstack.config.ts index e97098e392b..a38180206fe 100644 --- a/examples/app-starter/objectstack.config.ts +++ b/examples/app-starter/objectstack.config.ts @@ -58,9 +58,12 @@ export default defineStack({ // is held and nothing is indexed or offered to AI clients. knowledgeSources: [ArticlesKnowledge], + // Every platform locale (`PLATFORM_LOCALE_TAGS`), written out: the Console's + // language menu offers only the locales an app lists. `zh-Hans` is the write + // tag for Simplified Chinese; `zh-CN` is only read as an alias of it. i18n: { defaultLocale: 'en', - supportedLocales: ['en', 'zh-CN'], + supportedLocales: ['en', 'zh-Hans', 'zh-Hant', 'es', 'ar', 'fr', 'pt-BR', 'ru', 'de', 'ja', 'ko'], fallbackLocale: 'en', }, translations: Object.values(translations), diff --git a/examples/app-starter/src/translations/ar.translation.ts b/examples/app-starter/src/translations/ar.translation.ts new file mode 100644 index 00000000000..ac29a071a3a --- /dev/null +++ b/examples/app-starter/src/translations/ar.translation.ts @@ -0,0 +1,166 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Arabic (`ar`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const ar: TranslationData = { + packages: { + 'com.example.starter': { + name: 'تطبيق البداية', + description: 'الشركات وجهات الاتصال ومقالات المساعدة، مع مهام المنصة وملاحظاتها في القائمة.', + }, + }, + objects: { + biz_company: { + label: 'شركة', + pluralLabel: 'الشركات', + description: 'شركة تتعامل معها المؤسسة.', + fields: { + name: { label: 'اسم الشركة' }, + type: { + label: 'النوع', + options: { prospect: 'عميل محتمل', customer: 'عميل', partner: 'شريك', supplier: 'مورّد', other: 'أخرى' }, + }, + industry: { + label: 'القطاع', + options: { + technology: 'التقنية', + manufacturing: 'التصنيع', + retail: 'التجزئة', + finance: 'المالية', + healthcare: 'الرعاية الصحية', + education: 'التعليم', + other: 'أخرى', + }, + }, + website: { label: 'الموقع الإلكتروني' }, + phone: { label: 'الهاتف' }, + address: { label: 'العنوان' }, + description: { label: 'الوصف' }, + owner_id: { label: 'المالك' }, + }, + _views: { + all: { label: 'جميع الشركات' }, + by_type: { label: 'الشركات حسب النوع' }, + }, + _sections: { + basic: { label: 'المعلومات الأساسية' }, + contact_info: { label: 'معلومات الاتصال' }, + more: { label: 'المزيد' }, + }, + }, + biz_contact: { + label: 'جهة اتصال', + pluralLabel: 'جهات الاتصال', + description: 'شخص في شركة تتعامل معها المؤسسة.', + fields: { + name: { label: 'الاسم' }, + company: { label: 'الشركة' }, + title: { label: 'المسمى الوظيفي' }, + influence: { + label: 'التأثير', + options: { decision_maker: 'صاحب القرار', influencer: 'مؤثر', user: 'مستخدم', other: 'أخرى' }, + }, + email: { label: 'البريد الإلكتروني' }, + phone: { label: 'الهاتف' }, + notes: { label: 'ملاحظات' }, + owner_id: { label: 'المالك' }, + }, + _views: { + all: { label: 'جميع جهات الاتصال' }, + by_influence: { label: 'جهات الاتصال حسب التأثير' }, + }, + _sections: { + basic: { label: 'المعلومات الأساسية' }, + contact_info: { label: 'معلومات الاتصال' }, + more: { label: 'المزيد' }, + }, + }, + biz_article: { + label: 'مقالة', + pluralLabel: 'المقالات', + description: 'مقالة مساعدة: دليل إرشادي أو سؤال شائع أو صفحة مرجعية.', + fields: { + title: { label: 'العنوان' }, + body: { label: 'النص' }, + category: { + label: 'الفئة', + options: { how_to: 'دليل إرشادي', faq: 'الأسئلة الشائعة', reference: 'مرجع' }, + }, + status: { + label: 'الحالة', + options: { draft: 'مسودة', published: 'منشور' }, + }, + owner_id: { label: 'المالك' }, + }, + _views: { + all: { label: 'جميع المقالات' }, + }, + _sections: { + basic: { label: 'المقالة' }, + }, + }, + }, + apps: { + biz_app: { + label: 'تطبيق البداية', + description: 'الشركات وجهات الاتصال ومقالات المساعدة، مع مهام المنصة وملاحظاتها في القائمة.', + }, + }, + datasets: { + biz_company_metrics: { + label: 'مقاييس الشركات', + description: 'عدد الشركات حسب النوع والقطاع', + dimensions: { + type: { label: 'النوع', description: 'علاقة الشركة بالمؤسسة: عميل محتمل أو عميل أو شريك أو مورّد أو أخرى.' }, + industry: { + label: 'القطاع', + description: 'القطاع الذي تعمل فيه الشركة: التقنية أو التصنيع أو التجزئة أو المالية أو الرعاية الصحية أو التعليم أو أخرى. تُحتسب الشركة التي لم يُحدَّد قطاعها ضمن «بلا قطاع».', + }, + }, + measures: { + company_count: { label: 'عدد الشركات', description: 'عدد الشركات بغض النظر عن نوعها.' }, + }, + }, + biz_contact_metrics: { + label: 'مقاييس جهات الاتصال', + description: 'عدد جهات الاتصال حسب الشركة والتأثير', + dimensions: { + company: { + label: 'الشركة', + description: 'الشركة التي تعمل فيها جهة الاتصال؛ وتعرض النتائج اسم الشركة. تُحتسب جهة الاتصال التي لا شركة لها ضمن «بلا شركة».', + }, + influence: { + label: 'التأثير', + description: 'مدى تأثير جهة الاتصال في قرارات الشركة: صاحب القرار أو مؤثر أو مستخدم أو أخرى.', + }, + }, + measures: { + contact_count: { label: 'عدد جهات الاتصال', description: 'عدد جهات الاتصال.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: 'نظرة عامة', + description: 'الشركات وجهات الاتصال في لمحة.', + widgets: { + total_companies: { title: 'الشركات', description: 'كل الشركات بغض النظر عن نوعها.' }, + customers: { title: 'العملاء', description: 'الشركات من نوع «عميل».' }, + total_contacts: { title: 'جهات الاتصال', description: 'كل جهات الاتصال.' }, + companies_by_type: { title: 'الشركات حسب النوع', description: 'عدد الشركات من كل نوع.' }, + companies_by_industry: { title: 'الشركات حسب القطاع', description: 'توزيع الشركات على القطاعات.' }, + contacts_by_company: { title: 'جهات الاتصال حسب الشركة', description: 'عدد جهات الاتصال في كل شركة.' }, + }, + }, + }, + permissions: { + biz_staff: { label: 'موظفو تطبيق البداية', description: 'يعرض الشركات وجهات الاتصال ومقالات المساعدة ويصدّرها.' }, + }, +}; diff --git a/examples/app-starter/src/translations/de.translation.ts b/examples/app-starter/src/translations/de.translation.ts new file mode 100644 index 00000000000..353ac8969a0 --- /dev/null +++ b/examples/app-starter/src/translations/de.translation.ts @@ -0,0 +1,184 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — German (`de`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const de: TranslationData = { + packages: { + 'com.example.starter': { + name: 'Starter-App', + description: 'Unternehmen, Kontakte und Hilfeartikel, mit den Aufgaben und Notizen der Plattform im Menü.', + }, + }, + objects: { + biz_company: { + label: 'Unternehmen', + pluralLabel: 'Unternehmen', + description: 'Ein Unternehmen, mit dem die Organisation zusammenarbeitet.', + fields: { + name: { label: 'Firmenname' }, + type: { + label: 'Typ', + options: { + prospect: 'Interessent', + customer: 'Kunde', + partner: 'Partner', + supplier: 'Lieferant', + other: 'Sonstige', + }, + }, + industry: { + label: 'Branche', + options: { + technology: 'Technologie', + manufacturing: 'Fertigung', + retail: 'Einzelhandel', + finance: 'Finanzen', + healthcare: 'Gesundheitswesen', + education: 'Bildung', + other: 'Sonstige', + }, + }, + website: { label: 'Website' }, + phone: { label: 'Telefon' }, + address: { label: 'Adresse' }, + description: { label: 'Beschreibung' }, + owner_id: { label: 'Verantwortlich' }, + }, + _views: { + all: { label: 'Alle Unternehmen' }, + by_type: { label: 'Unternehmen nach Typ' }, + }, + _sections: { + basic: { label: 'Grunddaten' }, + contact_info: { label: 'Kontaktdaten' }, + more: { label: 'Weitere' }, + }, + }, + biz_contact: { + label: 'Kontakt', + pluralLabel: 'Kontakte', + description: 'Eine Person bei einem Unternehmen, mit dem die Organisation zusammenarbeitet.', + fields: { + name: { label: 'Name' }, + company: { label: 'Unternehmen' }, + title: { label: 'Position' }, + influence: { + label: 'Einfluss', + options: { decision_maker: 'Entscheider', influencer: 'Beeinflusser', user: 'Anwender', other: 'Sonstige' }, + }, + email: { label: 'E-Mail' }, + phone: { label: 'Telefon' }, + notes: { label: 'Notizen' }, + owner_id: { label: 'Verantwortlich' }, + }, + _views: { + all: { label: 'Alle Kontakte' }, + by_influence: { label: 'Kontakte nach Einfluss' }, + }, + _sections: { + basic: { label: 'Grunddaten' }, + contact_info: { label: 'Kontaktdaten' }, + more: { label: 'Weitere' }, + }, + }, + biz_article: { + label: 'Artikel', + pluralLabel: 'Artikel', + description: 'Ein Hilfeartikel: eine Anleitung, eine häufige Frage oder eine Referenzseite.', + fields: { + title: { label: 'Titel' }, + body: { label: 'Inhalt' }, + category: { + label: 'Kategorie', + options: { how_to: 'Anleitung', faq: 'FAQ', reference: 'Referenz' }, + }, + status: { + label: 'Status', + options: { draft: 'Entwurf', published: 'Veröffentlicht' }, + }, + owner_id: { label: 'Verantwortlich' }, + }, + _views: { + all: { label: 'Alle Artikel' }, + }, + _sections: { + basic: { label: 'Artikel' }, + }, + }, + }, + apps: { + biz_app: { + label: 'Starter-App', + description: 'Unternehmen, Kontakte und Hilfeartikel, mit den Aufgaben und Notizen der Plattform im Menü.', + }, + }, + datasets: { + biz_company_metrics: { + label: 'Unternehmenskennzahlen', + description: 'Wie viele Unternehmen es gibt, nach Typ und Branche', + dimensions: { + type: { + label: 'Typ', + description: 'Was das Unternehmen für die Organisation ist: Interessent, Kunde, Partner, Lieferant oder Sonstige.', + }, + industry: { + label: 'Branche', + description: 'Die Branche des Unternehmens: Technologie, Fertigung, Einzelhandel, Finanzen, Gesundheitswesen, Bildung oder Sonstige. Ein Unternehmen ohne Branche wird unter „keine Branche“ gezählt.', + }, + }, + measures: { + company_count: { label: 'Unternehmen', description: 'Wie viele Unternehmen es gibt, unabhängig vom Typ.' }, + }, + }, + biz_contact_metrics: { + label: 'Kontaktkennzahlen', + description: 'Wie viele Kontakte es gibt, nach Unternehmen und Einfluss', + dimensions: { + company: { + label: 'Unternehmen', + description: 'Das Unternehmen, bei dem der Kontakt arbeitet; die Ergebnisse zeigen den Firmennamen. Ein Kontakt ohne Unternehmen wird unter „kein Unternehmen“ gezählt.', + }, + influence: { + label: 'Einfluss', + description: 'Wie viel der Kontakt bei Entscheidungen des Unternehmens mitredet: Entscheider, Beeinflusser, Anwender oder Sonstige.', + }, + }, + measures: { + contact_count: { label: 'Kontakte', description: 'Wie viele Kontakte es gibt.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: 'Übersicht', + description: 'Unternehmen und Kontakte auf einen Blick.', + widgets: { + total_companies: { title: 'Unternehmen', description: 'Alle Unternehmen, unabhängig vom Typ.' }, + customers: { title: 'Kunden', description: 'Unternehmen vom Typ Kunde.' }, + total_contacts: { title: 'Kontakte', description: 'Alle Kontakte.' }, + companies_by_type: { title: 'Unternehmen nach Typ', description: 'Wie viele Unternehmen es je Typ gibt.' }, + companies_by_industry: { + title: 'Unternehmen nach Branche', + description: 'Wie sich die Unternehmen auf Branchen verteilen.', + }, + contacts_by_company: { + title: 'Kontakte nach Unternehmen', + description: 'Wie viele Kontakte jedes Unternehmen hat.', + }, + }, + }, + }, + permissions: { + biz_staff: { + label: 'Starter-App-Mitarbeitende', + description: 'Liest und exportiert Unternehmen, Kontakte und Hilfeartikel.', + }, + }, +}; diff --git a/examples/app-starter/src/translations/en.translation.ts b/examples/app-starter/src/translations/en.translation.ts new file mode 100644 index 00000000000..abc00da8fe1 --- /dev/null +++ b/examples/app-starter/src/translations/en.translation.ts @@ -0,0 +1,59 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — English (`en`), the source language. + * + * The tasks and notes entries of the menu carry no label of their own, so + * they show the platform's translations of `sys_task` and `sys_note`. + */ +export const en: TranslationData = { + objects: { + biz_company: { + label: 'Company', + pluralLabel: 'Companies', + fields: { + name: { label: 'Company Name' }, + type: { label: 'Type' }, + industry: { label: 'Industry' }, + website: { label: 'Website' }, + phone: { label: 'Phone' }, + address: { label: 'Address' }, + description: { label: 'Description' }, + owner_id: { label: 'Owner' }, + }, + }, + biz_contact: { + label: 'Contact', + pluralLabel: 'Contacts', + fields: { + name: { label: 'Name' }, + company: { label: 'Company' }, + title: { label: 'Job Title' }, + influence: { label: 'Influence' }, + email: { label: 'Email' }, + phone: { label: 'Phone' }, + notes: { label: 'Notes' }, + owner_id: { label: 'Owner' }, + }, + }, + biz_article: { + label: 'Article', + pluralLabel: 'Articles', + fields: { + title: { label: 'Title' }, + body: { label: 'Body' }, + category: { label: 'Category' }, + status: { label: 'Status' }, + owner_id: { label: 'Owner' }, + }, + }, + }, + apps: { + biz_app: { + label: 'Starter', + description: 'Companies, contacts and help articles, with tasks and notes', + }, + }, +}; diff --git a/examples/app-starter/src/translations/es.translation.ts b/examples/app-starter/src/translations/es.translation.ts new file mode 100644 index 00000000000..54c6cfb6a79 --- /dev/null +++ b/examples/app-starter/src/translations/es.translation.ts @@ -0,0 +1,186 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Spanish (`es`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const es: TranslationData = { + packages: { + 'com.example.starter': { + name: 'Aplicación de inicio', + description: 'Empresas, contactos y artículos de ayuda, con las tareas y notas de la plataforma en el menú.', + }, + }, + objects: { + biz_company: { + label: 'Empresa', + pluralLabel: 'Empresas', + description: 'Una empresa con la que trabaja la organización.', + fields: { + name: { label: 'Nombre de la empresa' }, + type: { + label: 'Tipo', + options: { + prospect: 'Cliente potencial', + customer: 'Cliente', + partner: 'Socio', + supplier: 'Proveedor', + other: 'Otro', + }, + }, + industry: { + label: 'Sector', + options: { + technology: 'Tecnología', + manufacturing: 'Manufactura', + retail: 'Comercio minorista', + finance: 'Finanzas', + healthcare: 'Salud', + education: 'Educación', + other: 'Otro', + }, + }, + website: { label: 'Sitio web' }, + phone: { label: 'Teléfono' }, + address: { label: 'Dirección' }, + description: { label: 'Descripción' }, + owner_id: { label: 'Propietario' }, + }, + _views: { + all: { label: 'Todas las empresas' }, + by_type: { label: 'Empresas por tipo' }, + }, + _sections: { + basic: { label: 'Información básica' }, + contact_info: { label: 'Datos de contacto' }, + more: { label: 'Más' }, + }, + }, + biz_contact: { + label: 'Contacto', + pluralLabel: 'Contactos', + description: 'Una persona de una empresa con la que trabaja la organización.', + fields: { + name: { label: 'Nombre' }, + company: { label: 'Empresa' }, + title: { label: 'Cargo' }, + influence: { + label: 'Influencia', + options: { + decision_maker: 'Responsable de decisiones', + influencer: 'Influenciador', + user: 'Usuario', + other: 'Otro', + }, + }, + email: { label: 'Correo electrónico' }, + phone: { label: 'Teléfono' }, + notes: { label: 'Notas' }, + owner_id: { label: 'Propietario' }, + }, + _views: { + all: { label: 'Todos los contactos' }, + by_influence: { label: 'Contactos por influencia' }, + }, + _sections: { + basic: { label: 'Información básica' }, + contact_info: { label: 'Datos de contacto' }, + more: { label: 'Más' }, + }, + }, + biz_article: { + label: 'Artículo', + pluralLabel: 'Artículos', + description: 'Un artículo de ayuda: una guía práctica, una pregunta frecuente o una página de referencia.', + fields: { + title: { label: 'Título' }, + body: { label: 'Cuerpo' }, + category: { + label: 'Categoría', + options: { how_to: 'Guía práctica', faq: 'Preguntas frecuentes', reference: 'Referencia' }, + }, + status: { + label: 'Estado', + options: { draft: 'Borrador', published: 'Publicado' }, + }, + owner_id: { label: 'Propietario' }, + }, + _views: { + all: { label: 'Todos los artículos' }, + }, + _sections: { + basic: { label: 'Artículo' }, + }, + }, + }, + apps: { + biz_app: { + label: 'Aplicación de inicio', + description: 'Empresas, contactos y artículos de ayuda, con las tareas y notas de la plataforma en el menú.', + }, + }, + datasets: { + biz_company_metrics: { + label: 'Métricas de empresas', + description: 'Cuántas empresas hay, por tipo y por sector', + dimensions: { + type: { + label: 'Tipo', + description: 'Qué es la empresa para la organización: Cliente potencial, Cliente, Socio, Proveedor u Otro.', + }, + industry: { + label: 'Sector', + description: 'El sector de la empresa: Tecnología, Manufactura, Comercio minorista, Finanzas, Salud, Educación u Otro. Una empresa sin sector se cuenta como «sin sector».', + }, + }, + measures: { + company_count: { label: 'Empresas', description: 'Cuántas empresas hay, sea cual sea su tipo.' }, + }, + }, + biz_contact_metrics: { + label: 'Métricas de contactos', + description: 'Cuántos contactos hay, por empresa y por influencia', + dimensions: { + company: { + label: 'Empresa', + description: 'La empresa donde trabaja el contacto; los resultados muestran el nombre de la empresa. Un contacto sin empresa se cuenta como «sin empresa».', + }, + influence: { + label: 'Influencia', + description: 'Cuánto pesa el contacto en las decisiones de la empresa: Responsable de decisiones, Influenciador, Usuario u Otro.', + }, + }, + measures: { + contact_count: { label: 'Contactos', description: 'Cuántos contactos hay.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: 'Resumen', + description: 'Empresas y contactos de un vistazo.', + widgets: { + total_companies: { title: 'Empresas', description: 'Todas las empresas, sea cual sea su tipo.' }, + customers: { title: 'Clientes', description: 'Empresas de tipo Cliente.' }, + total_contacts: { title: 'Contactos', description: 'Todos los contactos.' }, + companies_by_type: { title: 'Empresas por tipo', description: 'Cuántas empresas hay de cada tipo.' }, + companies_by_industry: { + title: 'Empresas por sector', + description: 'Cómo se reparten las empresas entre sectores.', + }, + contacts_by_company: { title: 'Contactos por empresa', description: 'Cuántos contactos tiene cada empresa.' }, + }, + }, + }, + permissions: { + biz_staff: { + label: 'Personal de la aplicación de inicio', + description: 'Consulta y exporta empresas, contactos y artículos de ayuda.', + }, + }, +}; diff --git a/examples/app-starter/src/translations/fr.translation.ts b/examples/app-starter/src/translations/fr.translation.ts new file mode 100644 index 00000000000..5a74ccb1b61 --- /dev/null +++ b/examples/app-starter/src/translations/fr.translation.ts @@ -0,0 +1,181 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — French (`fr`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const fr: TranslationData = { + packages: { + 'com.example.starter': { + name: 'Application de démarrage', + description: 'Entreprises, contacts et articles d\'aide, avec les tâches et notes de la plateforme dans le menu.', + }, + }, + objects: { + biz_company: { + label: 'Entreprise', + pluralLabel: 'Entreprises', + description: 'Une entreprise avec laquelle l\'organisation travaille.', + fields: { + name: { label: 'Nom de l\'entreprise' }, + type: { + label: 'Type', + options: { + prospect: 'Prospect', + customer: 'Client', + partner: 'Partenaire', + supplier: 'Fournisseur', + other: 'Autre', + }, + }, + industry: { + label: 'Secteur', + options: { + technology: 'Technologie', + manufacturing: 'Industrie manufacturière', + retail: 'Commerce de détail', + finance: 'Finance', + healthcare: 'Santé', + education: 'Éducation', + other: 'Autre', + }, + }, + website: { label: 'Site web' }, + phone: { label: 'Téléphone' }, + address: { label: 'Adresse' }, + description: { label: 'Description' }, + owner_id: { label: 'Propriétaire' }, + }, + _views: { + all: { label: 'Toutes les entreprises' }, + by_type: { label: 'Entreprises par type' }, + }, + _sections: { + basic: { label: 'Informations générales' }, + contact_info: { label: 'Coordonnées' }, + more: { label: 'Plus' }, + }, + }, + biz_contact: { + label: 'Contact', + pluralLabel: 'Contacts', + description: 'Une personne d\'une entreprise avec laquelle l\'organisation travaille.', + fields: { + name: { label: 'Nom' }, + company: { label: 'Entreprise' }, + title: { label: 'Poste' }, + influence: { + label: 'Influence', + options: { decision_maker: 'Décideur', influencer: 'Influenceur', user: 'Utilisateur', other: 'Autre' }, + }, + email: { label: 'E-mail' }, + phone: { label: 'Téléphone' }, + notes: { label: 'Notes' }, + owner_id: { label: 'Propriétaire' }, + }, + _views: { + all: { label: 'Tous les contacts' }, + by_influence: { label: 'Contacts par influence' }, + }, + _sections: { + basic: { label: 'Informations générales' }, + contact_info: { label: 'Coordonnées' }, + more: { label: 'Plus' }, + }, + }, + biz_article: { + label: 'Article', + pluralLabel: 'Articles', + description: 'Un article d\'aide : un guide pratique, une question fréquente ou une page de référence.', + fields: { + title: { label: 'Titre' }, + body: { label: 'Contenu' }, + category: { + label: 'Catégorie', + options: { how_to: 'Guide pratique', faq: 'FAQ', reference: 'Référence' }, + }, + status: { + label: 'Statut', + options: { draft: 'Brouillon', published: 'Publié' }, + }, + owner_id: { label: 'Propriétaire' }, + }, + _views: { + all: { label: 'Tous les articles' }, + }, + _sections: { + basic: { label: 'Article' }, + }, + }, + }, + apps: { + biz_app: { + label: 'Application de démarrage', + description: 'Entreprises, contacts et articles d\'aide, avec les tâches et notes de la plateforme dans le menu.', + }, + }, + datasets: { + biz_company_metrics: { + label: 'Indicateurs des entreprises', + description: 'Nombre d\'entreprises, par type et par secteur', + dimensions: { + type: { + label: 'Type', + description: 'Ce que l\'entreprise est pour l\'organisation : Prospect, Client, Partenaire, Fournisseur ou Autre.', + }, + industry: { + label: 'Secteur', + description: 'Le secteur de l\'entreprise : Technologie, Industrie manufacturière, Commerce de détail, Finance, Santé, Éducation ou Autre. Une entreprise sans secteur est comptée sous « aucun secteur ».', + }, + }, + measures: { + company_count: { label: 'Entreprises', description: 'Nombre d\'entreprises, quel que soit leur type.' }, + }, + }, + biz_contact_metrics: { + label: 'Indicateurs des contacts', + description: 'Nombre de contacts, par entreprise et par influence', + dimensions: { + company: { + label: 'Entreprise', + description: 'L\'entreprise où travaille le contact ; les résultats affichent le nom de l\'entreprise. Un contact sans entreprise est compté sous « aucune entreprise ».', + }, + influence: { + label: 'Influence', + description: 'Le poids du contact dans les décisions de l\'entreprise : Décideur, Influenceur, Utilisateur ou Autre.', + }, + }, + measures: { + contact_count: { label: 'Contacts', description: 'Nombre de contacts.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: 'Vue d\'ensemble', + description: 'Entreprises et contacts en un coup d\'œil.', + widgets: { + total_companies: { title: 'Entreprises', description: 'Toutes les entreprises, quel que soit leur type.' }, + customers: { title: 'Clients', description: 'Entreprises de type Client.' }, + total_contacts: { title: 'Contacts', description: 'Tous les contacts.' }, + companies_by_type: { title: 'Entreprises par type', description: 'Nombre d\'entreprises de chaque type.' }, + companies_by_industry: { + title: 'Entreprises par secteur', + description: 'Répartition des entreprises par secteur.', + }, + contacts_by_company: { title: 'Contacts par entreprise', description: 'Nombre de contacts par entreprise.' }, + }, + }, + }, + permissions: { + biz_staff: { + label: 'Personnel de l\'application de démarrage', + description: 'Consulte et exporte les entreprises, contacts et articles d\'aide.', + }, + }, +}; diff --git a/examples/app-starter/src/translations/index.ts b/examples/app-starter/src/translations/index.ts index 0ff9ba64d14..ffcde195dae 100644 --- a/examples/app-starter/src/translations/index.ts +++ b/examples/app-starter/src/translations/index.ts @@ -1,3 +1,33 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. -export { StarterTranslationBundle } from './starter.translation.js'; +import { defineTranslationBundle } from '@objectstack/spec/system'; +import { en } from './en.translation.js'; +import { zhHans } from './zh-Hans.translation.js'; +import { zhHant } from './zh-Hant.translation.js'; +import { es } from './es.translation.js'; +import { ar } from './ar.translation.js'; +import { fr } from './fr.translation.js'; +import { ptBR } from './pt-BR.translation.js'; +import { ru } from './ru.translation.js'; +import { de } from './de.translation.js'; +import { ja } from './ja.translation.js'; +import { ko } from './ko.translation.js'; + +/** + * Starter translation bundle — one file per platform locale + * (`PLATFORM_LOCALE_TAGS`), in the table's order. `zh-Hans` is the write tag + * for Simplified Chinese; `zh-CN` is only read as an alias of it. + */ +export const StarterTranslationBundle = defineTranslationBundle({ + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant, + es, + ar, + fr, + 'pt-BR': ptBR, + ru, + de, + ja, + ko, +}); diff --git a/examples/app-starter/src/translations/ja.translation.ts b/examples/app-starter/src/translations/ja.translation.ts new file mode 100644 index 00000000000..76e3f0f3af6 --- /dev/null +++ b/examples/app-starter/src/translations/ja.translation.ts @@ -0,0 +1,151 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Japanese (`ja`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const ja: TranslationData = { + packages: { + 'com.example.starter': { name: 'スターター', description: '会社、連絡先、ヘルプ記事。メニューにはプラットフォームのタスクとメモもあります。' }, + }, + objects: { + biz_company: { + label: '会社', + pluralLabel: '会社', + description: '組織が取引している会社。', + fields: { + name: { label: '会社名' }, + type: { + label: '種別', + options: { prospect: '見込み客', customer: '顧客', partner: 'パートナー', supplier: '仕入先', other: 'その他' }, + }, + industry: { + label: '業種', + options: { + technology: 'テクノロジー', + manufacturing: '製造', + retail: '小売', + finance: '金融', + healthcare: '医療', + education: '教育', + other: 'その他', + }, + }, + website: { label: 'Web サイト' }, + phone: { label: '電話' }, + address: { label: '住所' }, + description: { label: '説明' }, + owner_id: { label: '所有者' }, + }, + _views: { + all: { label: 'すべての会社' }, + by_type: { label: '種別ごとの会社' }, + }, + _sections: { + basic: { label: '基本情報' }, + contact_info: { label: '連絡先情報' }, + more: { label: 'その他' }, + }, + }, + biz_contact: { + label: '連絡先', + pluralLabel: '連絡先', + description: '組織が取引している会社の担当者。', + fields: { + name: { label: '氏名' }, + company: { label: '会社' }, + title: { label: '役職' }, + influence: { + label: '影響力', + options: { decision_maker: '意思決定者', influencer: '影響者', user: '利用者', other: 'その他' }, + }, + email: { label: 'メール' }, + phone: { label: '電話' }, + notes: { label: 'メモ' }, + owner_id: { label: '所有者' }, + }, + _views: { + all: { label: 'すべての連絡先' }, + by_influence: { label: '影響力ごとの連絡先' }, + }, + _sections: { + basic: { label: '基本情報' }, + contact_info: { label: '連絡先情報' }, + more: { label: 'その他' }, + }, + }, + biz_article: { + label: '記事', + pluralLabel: '記事', + description: 'ヘルプ記事:操作ガイド、よくある質問、またはリファレンス。', + fields: { + title: { label: 'タイトル' }, + body: { label: '本文' }, + category: { + label: 'カテゴリ', + options: { how_to: '操作ガイド', faq: 'よくある質問', reference: 'リファレンス' }, + }, + status: { + label: 'ステータス', + options: { draft: '下書き', published: '公開済み' }, + }, + owner_id: { label: '所有者' }, + }, + _views: { + all: { label: 'すべての記事' }, + }, + _sections: { + basic: { label: '記事' }, + }, + }, + }, + apps: { + biz_app: { label: 'スターター', description: '会社、連絡先、ヘルプ記事。メニューにはプラットフォームのタスクとメモもあります。' }, + }, + datasets: { + biz_company_metrics: { + label: '会社の指標', + description: '会社の数(種別・業種別)', + dimensions: { + type: { label: '種別', description: '会社と組織の関係:見込み客、顧客、パートナー、仕入先、その他。' }, + industry: { label: '業種', description: '会社の業種:テクノロジー、製造、小売、金融、医療、教育、その他。業種が未設定の会社は「業種なし」に数えられます。' }, + }, + measures: { + company_count: { label: '会社数', description: '種別を問わない会社の数。' }, + }, + }, + biz_contact_metrics: { + label: '連絡先の指標', + description: '連絡先の数(会社・影響力別)', + dimensions: { + company: { label: '会社', description: '連絡先が勤める会社。結果には会社名が表示されます。会社のない連絡先は「会社なし」に数えられます。' }, + influence: { label: '影響力', description: '会社の意思決定における連絡先の影響度:意思決定者、影響者、利用者、その他。' }, + }, + measures: { + contact_count: { label: '連絡先数', description: '連絡先の数。' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: '概要', + description: '会社と連絡先をひと目で。', + widgets: { + total_companies: { title: '会社', description: '種別を問わないすべての会社。' }, + customers: { title: '顧客', description: '種別が「顧客」の会社。' }, + total_contacts: { title: '連絡先', description: 'すべての連絡先。' }, + companies_by_type: { title: '種別ごとの会社', description: '種別ごとの会社の数。' }, + companies_by_industry: { title: '業種ごとの会社', description: '業種ごとの会社の分布。' }, + contacts_by_company: { title: '会社ごとの連絡先', description: '会社ごとの連絡先の数。' }, + }, + }, + }, + permissions: { + biz_staff: { label: 'スターターのスタッフ', description: '会社、連絡先、ヘルプ記事を閲覧・エクスポートします。' }, + }, +}; diff --git a/examples/app-starter/src/translations/ko.translation.ts b/examples/app-starter/src/translations/ko.translation.ts new file mode 100644 index 00000000000..66dcc92e629 --- /dev/null +++ b/examples/app-starter/src/translations/ko.translation.ts @@ -0,0 +1,151 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Korean (`ko`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const ko: TranslationData = { + packages: { + 'com.example.starter': { name: '스타터', description: '회사, 연락처, 도움말 문서와 함께 메뉴에 플랫폼의 작업과 메모가 있습니다.' }, + }, + objects: { + biz_company: { + label: '회사', + pluralLabel: '회사', + description: '조직이 함께 일하는 회사입니다.', + fields: { + name: { label: '회사명' }, + type: { + label: '유형', + options: { prospect: '잠재 고객', customer: '고객', partner: '파트너', supplier: '공급업체', other: '기타' }, + }, + industry: { + label: '업종', + options: { + technology: '기술', + manufacturing: '제조', + retail: '소매', + finance: '금융', + healthcare: '의료', + education: '교육', + other: '기타', + }, + }, + website: { label: '웹사이트' }, + phone: { label: '전화' }, + address: { label: '주소' }, + description: { label: '설명' }, + owner_id: { label: '소유자' }, + }, + _views: { + all: { label: '모든 회사' }, + by_type: { label: '유형별 회사' }, + }, + _sections: { + basic: { label: '기본 정보' }, + contact_info: { label: '연락처 정보' }, + more: { label: '더 보기' }, + }, + }, + biz_contact: { + label: '연락처', + pluralLabel: '연락처', + description: '조직이 함께 일하는 회사의 사람입니다.', + fields: { + name: { label: '이름' }, + company: { label: '회사' }, + title: { label: '직함' }, + influence: { + label: '영향력', + options: { decision_maker: '의사 결정자', influencer: '영향력자', user: '사용자', other: '기타' }, + }, + email: { label: '이메일' }, + phone: { label: '전화' }, + notes: { label: '메모' }, + owner_id: { label: '소유자' }, + }, + _views: { + all: { label: '모든 연락처' }, + by_influence: { label: '영향력별 연락처' }, + }, + _sections: { + basic: { label: '기본 정보' }, + contact_info: { label: '연락처 정보' }, + more: { label: '더 보기' }, + }, + }, + biz_article: { + label: '문서', + pluralLabel: '문서', + description: '도움말 문서: 사용 방법, 자주 묻는 질문 또는 참고 자료입니다.', + fields: { + title: { label: '제목' }, + body: { label: '본문' }, + category: { + label: '범주', + options: { how_to: '사용 방법', faq: '자주 묻는 질문', reference: '참고 자료' }, + }, + status: { + label: '상태', + options: { draft: '초안', published: '게시됨' }, + }, + owner_id: { label: '소유자' }, + }, + _views: { + all: { label: '모든 문서' }, + }, + _sections: { + basic: { label: '문서' }, + }, + }, + }, + apps: { + biz_app: { label: '스타터', description: '회사, 연락처, 도움말 문서와 함께 메뉴에 플랫폼의 작업과 메모가 있습니다.' }, + }, + datasets: { + biz_company_metrics: { + label: '회사 지표', + description: '유형별, 업종별 회사 수', + dimensions: { + type: { label: '유형', description: '조직에 대한 회사의 관계: 잠재 고객, 고객, 파트너, 공급업체 또는 기타.' }, + industry: { label: '업종', description: '회사의 업종: 기술, 제조, 소매, 금융, 의료, 교육 또는 기타. 업종이 없는 회사는 \'업종 없음\'으로 집계됩니다.' }, + }, + measures: { + company_count: { label: '회사 수', description: '유형과 관계없는 회사 수입니다.' }, + }, + }, + biz_contact_metrics: { + label: '연락처 지표', + description: '회사별, 영향력별 연락처 수', + dimensions: { + company: { label: '회사', description: '연락처가 일하는 회사이며, 결과에는 회사 이름이 표시됩니다. 회사가 없는 연락처는 \'회사 없음\'으로 집계됩니다.' }, + influence: { label: '영향력', description: '회사 의사 결정에서 연락처의 영향력: 의사 결정자, 영향력자, 사용자 또는 기타.' }, + }, + measures: { + contact_count: { label: '연락처 수', description: '연락처 수입니다.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: '개요', + description: '회사와 연락처를 한눈에.', + widgets: { + total_companies: { title: '회사', description: '유형과 관계없는 모든 회사입니다.' }, + customers: { title: '고객', description: '유형이 \'고객\'인 회사입니다.' }, + total_contacts: { title: '연락처', description: '모든 연락처입니다.' }, + companies_by_type: { title: '유형별 회사', description: '유형별 회사 수입니다.' }, + companies_by_industry: { title: '업종별 회사', description: '업종별 회사 분포입니다.' }, + contacts_by_company: { title: '회사별 연락처', description: '회사별 연락처 수입니다.' }, + }, + }, + }, + permissions: { + biz_staff: { label: '스타터 직원', description: '회사, 연락처, 도움말 문서를 조회하고 내보냅니다.' }, + }, +}; diff --git a/examples/app-starter/src/translations/pt-BR.translation.ts b/examples/app-starter/src/translations/pt-BR.translation.ts new file mode 100644 index 00000000000..700018d8103 --- /dev/null +++ b/examples/app-starter/src/translations/pt-BR.translation.ts @@ -0,0 +1,186 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Brazilian Portuguese (`pt-BR`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const ptBR: TranslationData = { + packages: { + 'com.example.starter': { + name: 'Aplicativo inicial', + description: 'Empresas, contatos e artigos de ajuda, com as tarefas e notas da plataforma no menu.', + }, + }, + objects: { + biz_company: { + label: 'Empresa', + pluralLabel: 'Empresas', + description: 'Uma empresa com a qual a organização trabalha.', + fields: { + name: { label: 'Nome da empresa' }, + type: { + label: 'Tipo', + options: { + prospect: 'Cliente potencial', + customer: 'Cliente', + partner: 'Parceiro', + supplier: 'Fornecedor', + other: 'Outro', + }, + }, + industry: { + label: 'Setor', + options: { + technology: 'Tecnologia', + manufacturing: 'Manufatura', + retail: 'Varejo', + finance: 'Finanças', + healthcare: 'Saúde', + education: 'Educação', + other: 'Outro', + }, + }, + website: { label: 'Site' }, + phone: { label: 'Telefone' }, + address: { label: 'Endereço' }, + description: { label: 'Descrição' }, + owner_id: { label: 'Proprietário' }, + }, + _views: { + all: { label: 'Todas as empresas' }, + by_type: { label: 'Empresas por tipo' }, + }, + _sections: { + basic: { label: 'Informações básicas' }, + contact_info: { label: 'Informações de contato' }, + more: { label: 'Mais' }, + }, + }, + biz_contact: { + label: 'Contato', + pluralLabel: 'Contatos', + description: 'Uma pessoa de uma empresa com a qual a organização trabalha.', + fields: { + name: { label: 'Nome' }, + company: { label: 'Empresa' }, + title: { label: 'Cargo' }, + influence: { + label: 'Influência', + options: { + decision_maker: 'Tomador de decisão', + influencer: 'Influenciador', + user: 'Usuário', + other: 'Outro', + }, + }, + email: { label: 'E-mail' }, + phone: { label: 'Telefone' }, + notes: { label: 'Observações' }, + owner_id: { label: 'Proprietário' }, + }, + _views: { + all: { label: 'Todos os contatos' }, + by_influence: { label: 'Contatos por influência' }, + }, + _sections: { + basic: { label: 'Informações básicas' }, + contact_info: { label: 'Informações de contato' }, + more: { label: 'Mais' }, + }, + }, + biz_article: { + label: 'Artigo', + pluralLabel: 'Artigos', + description: 'Um artigo de ajuda: um guia prático, uma pergunta frequente ou uma página de referência.', + fields: { + title: { label: 'Título' }, + body: { label: 'Conteúdo' }, + category: { + label: 'Categoria', + options: { how_to: 'Guia prático', faq: 'Perguntas frequentes', reference: 'Referência' }, + }, + status: { + label: 'Status', + options: { draft: 'Rascunho', published: 'Publicado' }, + }, + owner_id: { label: 'Proprietário' }, + }, + _views: { + all: { label: 'Todos os artigos' }, + }, + _sections: { + basic: { label: 'Artigo' }, + }, + }, + }, + apps: { + biz_app: { + label: 'Aplicativo inicial', + description: 'Empresas, contatos e artigos de ajuda, com as tarefas e notas da plataforma no menu.', + }, + }, + datasets: { + biz_company_metrics: { + label: 'Métricas de empresas', + description: 'Quantas empresas há, por tipo e por setor', + dimensions: { + type: { + label: 'Tipo', + description: 'O que a empresa é para a organização: Cliente potencial, Cliente, Parceiro, Fornecedor ou Outro.', + }, + industry: { + label: 'Setor', + description: 'O setor da empresa: Tecnologia, Manufatura, Varejo, Finanças, Saúde, Educação ou Outro. Uma empresa sem setor é contada como “sem setor”.', + }, + }, + measures: { + company_count: { label: 'Empresas', description: 'Quantas empresas há, de qualquer tipo.' }, + }, + }, + biz_contact_metrics: { + label: 'Métricas de contatos', + description: 'Quantos contatos há, por empresa e por influência', + dimensions: { + company: { + label: 'Empresa', + description: 'A empresa onde o contato trabalha; os resultados mostram o nome da empresa. Um contato sem empresa é contado como “sem empresa”.', + }, + influence: { + label: 'Influência', + description: 'O peso do contato nas decisões da empresa: Tomador de decisão, Influenciador, Usuário ou Outro.', + }, + }, + measures: { + contact_count: { label: 'Contatos', description: 'Quantos contatos há.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: 'Visão geral', + description: 'Empresas e contatos em resumo.', + widgets: { + total_companies: { title: 'Empresas', description: 'Todas as empresas, de qualquer tipo.' }, + customers: { title: 'Clientes', description: 'Empresas do tipo Cliente.' }, + total_contacts: { title: 'Contatos', description: 'Todos os contatos.' }, + companies_by_type: { title: 'Empresas por tipo', description: 'Quantas empresas há de cada tipo.' }, + companies_by_industry: { + title: 'Empresas por setor', + description: 'Como as empresas se distribuem entre setores.', + }, + contacts_by_company: { title: 'Contatos por empresa', description: 'Quantos contatos cada empresa tem.' }, + }, + }, + }, + permissions: { + biz_staff: { + label: 'Equipe do aplicativo inicial', + description: 'Consulta e exporta empresas, contatos e artigos de ajuda.', + }, + }, +}; diff --git a/examples/app-starter/src/translations/ru.translation.ts b/examples/app-starter/src/translations/ru.translation.ts new file mode 100644 index 00000000000..f2c9c9f9b9c --- /dev/null +++ b/examples/app-starter/src/translations/ru.translation.ts @@ -0,0 +1,183 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Russian (`ru`). + * + * AI-written from the English source. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const ru: TranslationData = { + packages: { + 'com.example.starter': { + name: 'Стартовое приложение', + description: 'Компании, контакты и справочные статьи, а также задачи и заметки платформы в меню.', + }, + }, + objects: { + biz_company: { + label: 'Компания', + pluralLabel: 'Компании', + description: 'Компания, с которой работает организация.', + fields: { + name: { label: 'Название компании' }, + type: { + label: 'Тип', + options: { + prospect: 'Потенциальный клиент', + customer: 'Клиент', + partner: 'Партнёр', + supplier: 'Поставщик', + other: 'Другое', + }, + }, + industry: { + label: 'Отрасль', + options: { + technology: 'Технологии', + manufacturing: 'Производство', + retail: 'Розничная торговля', + finance: 'Финансы', + healthcare: 'Здравоохранение', + education: 'Образование', + other: 'Другое', + }, + }, + website: { label: 'Веб-сайт' }, + phone: { label: 'Телефон' }, + address: { label: 'Адрес' }, + description: { label: 'Описание' }, + owner_id: { label: 'Владелец' }, + }, + _views: { + all: { label: 'Все компании' }, + by_type: { label: 'Компании по типу' }, + }, + _sections: { + basic: { label: 'Основная информация' }, + contact_info: { label: 'Контактные данные' }, + more: { label: 'Ещё' }, + }, + }, + biz_contact: { + label: 'Контакт', + pluralLabel: 'Контакты', + description: 'Сотрудник компании, с которой работает организация.', + fields: { + name: { label: 'Имя' }, + company: { label: 'Компания' }, + title: { label: 'Должность' }, + influence: { + label: 'Влияние', + options: { + decision_maker: 'Лицо, принимающее решения', + influencer: 'Влиятельное лицо', + user: 'Пользователь', + other: 'Другое', + }, + }, + email: { label: 'Эл. почта' }, + phone: { label: 'Телефон' }, + notes: { label: 'Заметки' }, + owner_id: { label: 'Владелец' }, + }, + _views: { + all: { label: 'Все контакты' }, + by_influence: { label: 'Контакты по влиянию' }, + }, + _sections: { + basic: { label: 'Основная информация' }, + contact_info: { label: 'Контактные данные' }, + more: { label: 'Ещё' }, + }, + }, + biz_article: { + label: 'Статья', + pluralLabel: 'Статьи', + description: 'Справочная статья: инструкция, частый вопрос или справочная страница.', + fields: { + title: { label: 'Заголовок' }, + body: { label: 'Текст' }, + category: { + label: 'Категория', + options: { how_to: 'Инструкция', faq: 'Частые вопросы', reference: 'Справка' }, + }, + status: { + label: 'Статус', + options: { draft: 'Черновик', published: 'Опубликовано' }, + }, + owner_id: { label: 'Владелец' }, + }, + _views: { + all: { label: 'Все статьи' }, + }, + _sections: { + basic: { label: 'Статья' }, + }, + }, + }, + apps: { + biz_app: { + label: 'Стартовое приложение', + description: 'Компании, контакты и справочные статьи, а также задачи и заметки платформы в меню.', + }, + }, + datasets: { + biz_company_metrics: { + label: 'Показатели компаний', + description: 'Сколько компаний, по типу и отрасли', + dimensions: { + type: { + label: 'Тип', + description: 'Кем компания является для организации: потенциальный клиент, клиент, партнёр, поставщик или другое.', + }, + industry: { + label: 'Отрасль', + description: 'Отрасль компании: технологии, производство, розничная торговля, финансы, здравоохранение, образование или другое. Компания без отрасли учитывается как «без отрасли».', + }, + }, + measures: { + company_count: { label: 'Компании', description: 'Сколько всего компаний, независимо от типа.' }, + }, + }, + biz_contact_metrics: { + label: 'Показатели контактов', + description: 'Сколько контактов, по компании и влиянию', + dimensions: { + company: { + label: 'Компания', + description: 'Компания, в которой работает контакт; в результатах показано название компании. Контакт без компании учитывается как «без компании».', + }, + influence: { + label: 'Влияние', + description: 'Насколько контакт влияет на решения компании: лицо, принимающее решения, влиятельное лицо, пользователь или другое.', + }, + }, + measures: { + contact_count: { label: 'Контакты', description: 'Сколько всего контактов.' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: 'Обзор', + description: 'Компании и контакты с первого взгляда.', + widgets: { + total_companies: { title: 'Компании', description: 'Все компании, независимо от типа.' }, + customers: { title: 'Клиенты', description: 'Компании с типом «Клиент».' }, + total_contacts: { title: 'Контакты', description: 'Все контакты.' }, + companies_by_type: { title: 'Компании по типу', description: 'Сколько компаний каждого типа.' }, + companies_by_industry: { title: 'Компании по отраслям', description: 'Распределение компаний по отраслям.' }, + contacts_by_company: { title: 'Контакты по компаниям', description: 'Сколько контактов у каждой компании.' }, + }, + }, + }, + permissions: { + biz_staff: { + label: 'Сотрудники стартового приложения', + description: 'Просмотр и экспорт компаний, контактов и справочных статей.', + }, + }, +}; diff --git a/examples/app-starter/src/translations/starter.translation.ts b/examples/app-starter/src/translations/starter.translation.ts deleted file mode 100644 index 407081b862a..00000000000 --- a/examples/app-starter/src/translations/starter.translation.ts +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -import { defineTranslationBundle } from '@objectstack/spec/system'; - -/** - * Starter translation bundle — English and Simplified Chinese. - * - * The tasks and notes entries of the menu carry no label of their own, so - * they show the platform's translations of `sys_task` and `sys_note`. - */ -export const StarterTranslationBundle = defineTranslationBundle({ - en: { - objects: { - biz_company: { - label: 'Company', - pluralLabel: 'Companies', - fields: { - name: { label: 'Company Name' }, - type: { label: 'Type' }, - industry: { label: 'Industry' }, - website: { label: 'Website' }, - phone: { label: 'Phone' }, - address: { label: 'Address' }, - description: { label: 'Description' }, - owner_id: { label: 'Owner' }, - }, - }, - biz_contact: { - label: 'Contact', - pluralLabel: 'Contacts', - fields: { - name: { label: 'Name' }, - company: { label: 'Company' }, - title: { label: 'Job Title' }, - influence: { label: 'Influence' }, - email: { label: 'Email' }, - phone: { label: 'Phone' }, - notes: { label: 'Notes' }, - owner_id: { label: 'Owner' }, - }, - }, - biz_article: { - label: 'Article', - pluralLabel: 'Articles', - fields: { - title: { label: 'Title' }, - body: { label: 'Body' }, - category: { label: 'Category' }, - status: { label: 'Status' }, - owner_id: { label: 'Owner' }, - }, - }, - }, - apps: { - biz_app: { - label: 'Starter', - description: 'Companies, contacts and help articles, with tasks and notes', - }, - }, - }, - - 'zh-CN': { - // The package's own name, keyed by its manifest id (objectstack#35513). - packages: { - 'com.example.starter': { name: '入门示例', description: '公司、联系人与知识文章,菜单中附带平台的任务和备注。' }, - }, - objects: { - biz_company: { - label: '公司', - pluralLabel: '公司', - description: '与本组织往来的公司。', - fields: { - name: { label: '公司名称' }, - type: { - label: '类型', - options: { - prospect: '潜在客户', - customer: '客户', - partner: '合作伙伴', - supplier: '供应商', - other: '其他', - }, - }, - industry: { - label: '行业', - options: { - technology: '科技', - manufacturing: '制造', - retail: '零售', - finance: '金融', - healthcare: '医疗', - education: '教育', - other: '其他', - }, - }, - website: { label: '网站' }, - phone: { label: '电话' }, - address: { label: '地址' }, - description: { label: '描述' }, - owner_id: { label: '负责人' }, - }, - _views: { - all: { label: '全部公司' }, - by_type: { label: '按类型看板' }, - }, - _sections: { - basic: { label: '基本信息' }, - contact_info: { label: '联系方式' }, - more: { label: '更多' }, - }, - }, - biz_contact: { - label: '联系人', - pluralLabel: '联系人', - description: '往来公司里的人,不是本组织的员工。', - fields: { - name: { label: '姓名' }, - company: { label: '所属公司' }, - title: { label: '职位' }, - influence: { - label: '影响力', - options: { - decision_maker: '决策人', - influencer: '影响者', - user: '使用者', - other: '其他', - }, - }, - email: { label: '邮箱' }, - phone: { label: '电话' }, - notes: { label: '备注' }, - owner_id: { label: '负责人' }, - }, - _views: { - all: { label: '全部联系人' }, - by_influence: { label: '按影响力看板' }, - }, - _sections: { - basic: { label: '基本信息' }, - contact_info: { label: '联系方式' }, - more: { label: '更多' }, - }, - }, - biz_article: { - label: '知识文章', - pluralLabel: '知识文章', - description: '帮助文章:操作指南、常见问题或参考资料。', - fields: { - title: { label: '标题' }, - body: { label: '正文' }, - category: { - label: '分类', - options: { - how_to: '操作指南', - faq: '常见问题', - reference: '参考资料', - }, - }, - status: { - label: '状态', - options: { - draft: '草稿', - published: '已发布', - }, - }, - owner_id: { label: '负责人' }, - }, - _views: { - all: { label: '全部文章' }, - }, - _sections: { - basic: { label: '文章' }, - }, - }, - }, - apps: { - biz_app: { - label: '起步应用', - description: '公司、联系人与知识文章,菜单中附带平台的任务和备注。', - }, - }, - datasets: { - biz_company_metrics: { - label: '公司统计', - description: '公司有多少家,按类型和行业分', - dimensions: { - type: { label: '类型', description: '公司与本组织的关系:潜在客户、客户、合作伙伴、供应商或其他。' }, - industry: { - label: '行业', - description: '公司所在的行业:科技、制造、零售、金融、医疗、教育或其他。未填行业的公司归入“无行业”。', - }, - }, - measures: { - company_count: { label: '公司数', description: '公司有多少家,不论类型。' }, - }, - }, - biz_contact_metrics: { - label: '联系人统计', - description: '联系人有多少位,按公司和影响力分', - dimensions: { - company: { label: '公司', description: '联系人所在的公司,结果显示公司名称。没有公司的联系人归入“无公司”。' }, - influence: { label: '影响力', description: '联系人在公司决策中的分量:决策人、影响者、使用者或其他。' }, - }, - measures: { - contact_count: { label: '联系人数', description: '联系人有多少位。' }, - }, - }, - }, - dashboards: { - biz_overview_dashboard: { - label: '概览', - description: '公司和联系人一览。', - widgets: { - total_companies: { title: '公司', description: '全部公司,不论类型。' }, - customers: { title: '客户', description: '类型为“客户”的公司。' }, - total_contacts: { title: '联系人', description: '全部联系人。' }, - companies_by_type: { title: '公司类型分布', description: '每种类型各有多少家公司。' }, - companies_by_industry: { title: '公司行业分布', description: '公司在各行业的分布。' }, - contacts_by_company: { title: '各公司联系人', description: '每家公司有多少位联系人。' }, - }, - }, - }, - permissions: { - biz_staff: { label: '入门示例员工', description: '查看并导出公司、联系人与知识文章。' }, - }, - }, -}); diff --git a/examples/app-starter/src/translations/zh-Hans.translation.ts b/examples/app-starter/src/translations/zh-Hans.translation.ts new file mode 100644 index 00000000000..f2f78c7f1b7 --- /dev/null +++ b/examples/app-starter/src/translations/zh-Hans.translation.ts @@ -0,0 +1,151 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Simplified Chinese (`zh-Hans`). + * + * AI-written from the English source. Carried over from the former `zh-CN` bundle, now under the platform tag. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const zhHans: TranslationData = { + packages: { + 'com.example.starter': { name: '入门示例', description: '公司、联系人与知识文章,菜单中附带平台的任务和备注。' }, + }, + objects: { + biz_company: { + label: '公司', + pluralLabel: '公司', + description: '与本组织往来的公司。', + fields: { + name: { label: '公司名称' }, + type: { + label: '类型', + options: { prospect: '潜在客户', customer: '客户', partner: '合作伙伴', supplier: '供应商', other: '其他' }, + }, + industry: { + label: '行业', + options: { + technology: '科技', + manufacturing: '制造', + retail: '零售', + finance: '金融', + healthcare: '医疗', + education: '教育', + other: '其他', + }, + }, + website: { label: '网站' }, + phone: { label: '电话' }, + address: { label: '地址' }, + description: { label: '描述' }, + owner_id: { label: '负责人' }, + }, + _views: { + all: { label: '全部公司' }, + by_type: { label: '按类型看板' }, + }, + _sections: { + basic: { label: '基本信息' }, + contact_info: { label: '联系方式' }, + more: { label: '更多' }, + }, + }, + biz_contact: { + label: '联系人', + pluralLabel: '联系人', + description: '往来公司里的人,不是本组织的员工。', + fields: { + name: { label: '姓名' }, + company: { label: '所属公司' }, + title: { label: '职位' }, + influence: { + label: '影响力', + options: { decision_maker: '决策人', influencer: '影响者', user: '使用者', other: '其他' }, + }, + email: { label: '邮箱' }, + phone: { label: '电话' }, + notes: { label: '备注' }, + owner_id: { label: '负责人' }, + }, + _views: { + all: { label: '全部联系人' }, + by_influence: { label: '按影响力看板' }, + }, + _sections: { + basic: { label: '基本信息' }, + contact_info: { label: '联系方式' }, + more: { label: '更多' }, + }, + }, + biz_article: { + label: '知识文章', + pluralLabel: '知识文章', + description: '帮助文章:操作指南、常见问题或参考资料。', + fields: { + title: { label: '标题' }, + body: { label: '正文' }, + category: { + label: '分类', + options: { how_to: '操作指南', faq: '常见问题', reference: '参考资料' }, + }, + status: { + label: '状态', + options: { draft: '草稿', published: '已发布' }, + }, + owner_id: { label: '负责人' }, + }, + _views: { + all: { label: '全部文章' }, + }, + _sections: { + basic: { label: '文章' }, + }, + }, + }, + apps: { + biz_app: { label: '起步应用', description: '公司、联系人与知识文章,菜单中附带平台的任务和备注。' }, + }, + datasets: { + biz_company_metrics: { + label: '公司统计', + description: '公司有多少家,按类型和行业分', + dimensions: { + type: { label: '类型', description: '公司与本组织的关系:潜在客户、客户、合作伙伴、供应商或其他。' }, + industry: { label: '行业', description: '公司所在的行业:科技、制造、零售、金融、医疗、教育或其他。未填行业的公司归入“无行业”。' }, + }, + measures: { + company_count: { label: '公司数', description: '公司有多少家,不论类型。' }, + }, + }, + biz_contact_metrics: { + label: '联系人统计', + description: '联系人有多少位,按公司和影响力分', + dimensions: { + company: { label: '公司', description: '联系人所在的公司,结果显示公司名称。没有公司的联系人归入“无公司”。' }, + influence: { label: '影响力', description: '联系人在公司决策中的分量:决策人、影响者、使用者或其他。' }, + }, + measures: { + contact_count: { label: '联系人数', description: '联系人有多少位。' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: '概览', + description: '公司和联系人一览。', + widgets: { + total_companies: { title: '公司', description: '全部公司,不论类型。' }, + customers: { title: '客户', description: '类型为“客户”的公司。' }, + total_contacts: { title: '联系人', description: '全部联系人。' }, + companies_by_type: { title: '公司类型分布', description: '每种类型各有多少家公司。' }, + companies_by_industry: { title: '公司行业分布', description: '公司在各行业的分布。' }, + contacts_by_company: { title: '各公司联系人', description: '每家公司有多少位联系人。' }, + }, + }, + }, + permissions: { + biz_staff: { label: '入门示例员工', description: '查看并导出公司、联系人与知识文章。' }, + }, +}; diff --git a/examples/app-starter/src/translations/zh-Hant.translation.ts b/examples/app-starter/src/translations/zh-Hant.translation.ts new file mode 100644 index 00000000000..7a288b74f3f --- /dev/null +++ b/examples/app-starter/src/translations/zh-Hant.translation.ts @@ -0,0 +1,151 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { TranslationData } from '@objectstack/spec/system'; + +/** + * Starter translations — Traditional Chinese (`zh-Hant`). + * + * AI-written from the English source. Derived from the `zh-Hans` bundle. The tasks and notes entries of + * the menu carry no label of their own, so they show the platform's + * translations of `sys_task` and `sys_note`. + */ +export const zhHant: TranslationData = { + packages: { + 'com.example.starter': { name: '入門範例', description: '公司、聯絡人與知識文章,選單中附帶平台的任務和備註。' }, + }, + objects: { + biz_company: { + label: '公司', + pluralLabel: '公司', + description: '與本組織往來的公司。', + fields: { + name: { label: '公司名稱' }, + type: { + label: '類型', + options: { prospect: '潛在客戶', customer: '客戶', partner: '合作夥伴', supplier: '供應商', other: '其他' }, + }, + industry: { + label: '行業', + options: { + technology: '科技', + manufacturing: '製造', + retail: '零售', + finance: '金融', + healthcare: '醫療', + education: '教育', + other: '其他', + }, + }, + website: { label: '網站' }, + phone: { label: '電話' }, + address: { label: '地址' }, + description: { label: '描述' }, + owner_id: { label: '負責人' }, + }, + _views: { + all: { label: '全部公司' }, + by_type: { label: '按類型看板' }, + }, + _sections: { + basic: { label: '基本資訊' }, + contact_info: { label: '聯絡方式' }, + more: { label: '更多' }, + }, + }, + biz_contact: { + label: '聯絡人', + pluralLabel: '聯絡人', + description: '往來公司裡的人,不是本組織的員工。', + fields: { + name: { label: '姓名' }, + company: { label: '所屬公司' }, + title: { label: '職位' }, + influence: { + label: '影響力', + options: { decision_maker: '決策人', influencer: '影響者', user: '使用者', other: '其他' }, + }, + email: { label: '電子郵件' }, + phone: { label: '電話' }, + notes: { label: '備註' }, + owner_id: { label: '負責人' }, + }, + _views: { + all: { label: '全部聯絡人' }, + by_influence: { label: '按影響力看板' }, + }, + _sections: { + basic: { label: '基本資訊' }, + contact_info: { label: '聯絡方式' }, + more: { label: '更多' }, + }, + }, + biz_article: { + label: '知識文章', + pluralLabel: '知識文章', + description: '說明文章:操作指南、常見問題或參考資料。', + fields: { + title: { label: '標題' }, + body: { label: '正文' }, + category: { + label: '分類', + options: { how_to: '操作指南', faq: '常見問題', reference: '參考資料' }, + }, + status: { + label: '狀態', + options: { draft: '草稿', published: '已發布' }, + }, + owner_id: { label: '負責人' }, + }, + _views: { + all: { label: '全部文章' }, + }, + _sections: { + basic: { label: '文章' }, + }, + }, + }, + apps: { + biz_app: { label: '起步應用', description: '公司、聯絡人與知識文章,選單中附帶平台的任務和備註。' }, + }, + datasets: { + biz_company_metrics: { + label: '公司統計', + description: '公司有多少家,按類型和行業分', + dimensions: { + type: { label: '類型', description: '公司與本組織的關係:潛在客戶、客戶、合作夥伴、供應商或其他。' }, + industry: { label: '行業', description: '公司所在的行業:科技、製造、零售、金融、醫療、教育或其他。未填行業的公司歸入「無行業」。' }, + }, + measures: { + company_count: { label: '公司數', description: '公司有多少家,不論類型。' }, + }, + }, + biz_contact_metrics: { + label: '聯絡人統計', + description: '聯絡人有多少位,按公司和影響力分', + dimensions: { + company: { label: '公司', description: '聯絡人所在的公司,結果顯示公司名稱。沒有公司的聯絡人歸入「無公司」。' }, + influence: { label: '影響力', description: '聯絡人在公司決策中的分量:決策人、影響者、使用者或其他。' }, + }, + measures: { + contact_count: { label: '聯絡人數', description: '聯絡人有多少位。' }, + }, + }, + }, + dashboards: { + biz_overview_dashboard: { + label: '概覽', + description: '公司和聯絡人一覽。', + widgets: { + total_companies: { title: '公司', description: '全部公司,不論類型。' }, + customers: { title: '客戶', description: '類型為「客戶」的公司。' }, + total_contacts: { title: '聯絡人', description: '全部聯絡人。' }, + companies_by_type: { title: '公司類型分布', description: '每種類型各有多少家公司。' }, + companies_by_industry: { title: '公司行業分布', description: '公司在各行業的分布。' }, + contacts_by_company: { title: '各公司聯絡人', description: '每家公司有多少位聯絡人。' }, + }, + }, + }, + permissions: { + biz_staff: { label: '入門範例員工', description: '查看並匯出公司、聯絡人與知識文章。' }, + }, +}; diff --git a/examples/app-starter/test/translations-locales-39322.test.ts b/examples/app-starter/test/translations-locales-39322.test.ts new file mode 100644 index 00000000000..a599b380983 --- /dev/null +++ b/examples/app-starter/test/translations-locales-39322.test.ts @@ -0,0 +1,59 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import fs from 'node:fs'; +import path from 'node:path'; +import { describe, it, expect } from 'vitest'; +import { PLATFORM_LOCALE_TAGS } from '@objectstack/spec/system'; + +import stack from '../objectstack.config.js'; +import { StarterTranslationBundle } from '../src/translations/index.js'; + +/** + * The Starter ships every platform locale, one bundle file per locale. + * + * The eleven tags are written out here on purpose: a tag added to or dropped + * from the platform table turns this red until the Starter follows. `zh-Hans` + * is the write tag for Simplified Chinese; `zh-CN` is only a read alias, so + * the Starter never writes it. Completeness of each bundle is the job of + * `os i18n check --strict`; this pin holds the locale list, the files, and + * that every non-source bundle carries the same keys as `zh-Hans`. + */ + +const LOCALES = ['en', 'zh-Hans', 'zh-Hant', 'es', 'ar', 'fr', 'pt-BR', 'ru', 'de', 'ja', 'ko']; + +const TRANSLATIONS_DIR = path.resolve(__dirname, '../src/translations'); + +/** Every leaf path of a translation entry, as `a.b.c`, sorted. */ +function leafPaths(value: unknown, prefix = ''): string[] { + if (value === null || typeof value !== 'object') return [prefix]; + return Object.entries(value as Record) + .flatMap(([key, child]) => leafPaths(child, prefix ? `${prefix}.${key}` : key)) + .sort(); +} + +describe('Starter locales', () => { + it('lists the platform locale table, in its order', () => { + expect([...PLATFORM_LOCALE_TAGS]).toEqual(LOCALES); + expect(stack.i18n?.supportedLocales).toEqual(LOCALES); + expect(stack.i18n?.defaultLocale).toBe('en'); + }); + + it('has one bundle file per locale and nothing else', () => { + const files = fs.readdirSync(TRANSLATIONS_DIR).filter((f) => f.endsWith('.translation.ts')).sort(); + expect(files).toEqual(LOCALES.map((tag) => `${tag}.translation.ts`).sort()); + expect(Object.keys(StarterTranslationBundle)).toEqual(LOCALES); + }); + + it('never writes zh-CN', () => { + expect(stack.i18n?.supportedLocales).not.toContain('zh-CN'); + expect(Object.keys(StarterTranslationBundle)).not.toContain('zh-CN'); + }); + + it('gives every translated locale the same keys as zh-Hans', () => { + const reference = leafPaths(StarterTranslationBundle['zh-Hans']); + expect(reference.length).toBeGreaterThan(0); + for (const tag of LOCALES.filter((t) => t !== 'en' && t !== 'zh-Hans')) { + expect({ tag, keys: leafPaths(StarterTranslationBundle[tag]) }).toEqual({ tag, keys: reference }); + } + }); +});