feat(spec): formalize i18n file organization conventions#660
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ale example - Add ObjectTranslationDataSchema for per-object translation file validation - Add FieldTranslationSchema for reusable field translation structure - Add TranslationFileOrganizationSchema enum (bundled, per_locale, per_namespace) - Add TranslationConfigSchema for i18n stack configuration - Add TranslationData type export - Add i18n optional property to ObjectStackDefinitionSchema - Refactor app-todo to per-locale file splitting convention - Add 18 new tests for all new schemas Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot app-crm 也要修改 |
Split monolithic crm.translation.ts into per-locale files: - en.ts, zh-CN.ts, ja-JP.ts, es-ES.ts - Add i18n config to objectstack.config.ts Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Done in |
There was a problem hiding this comment.
Pull request overview
This PR formalizes i18n (internationalization) file organization conventions for the ObjectStack platform by introducing comprehensive schema definitions and refactoring example apps to follow the new per_locale pattern. The changes establish three distinct file organization strategies (bundled, per_locale, per_namespace) that align with enterprise platform best practices from Salesforce DX and ServiceNow.
Changes:
- Added reusable
FieldTranslationSchemaandObjectTranslationDataSchemafor granular translation validation - Introduced
TranslationFileOrganizationSchemaenum andTranslationConfigSchemafor i18n stack configuration - Added
i18noptional property toObjectStackDefinitionSchemafor centralized i18n settings - Added 18 comprehensive tests (bringing translation tests from 21 to 39 total)
- Refactored both example apps (app-todo and app-crm) to use per-locale file splitting with separate files for each language
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/system/translation.zod.ts | Core schema additions: FieldTranslationSchema, ObjectTranslationDataSchema, TranslationFileOrganizationSchema, TranslationConfigSchema with comprehensive JSDoc documentation |
| packages/spec/src/system/translation.test.ts | 18 new tests covering all new schemas with positive/negative test cases |
| packages/spec/src/stack.zod.ts | Added optional i18n configuration property to stack definition |
| examples/app-todo/src/translations/*.ts | Refactored to per-locale organization: en.ts, zh-CN.ts, ja-JP.ts with bundle aggregation |
| examples/app-crm/src/translations/*.ts | Refactored to per-locale organization: en.ts, zh-CN.ts, ja-JP.ts, es-ES.ts with bundle aggregation |
| examples/app-todo/objectstack.config.ts | Added i18n configuration object following TranslationConfigSchema |
| examples/app-crm/objectstack.config.ts | Added i18n configuration object following TranslationConfigSchema |
FieldTranslationSchemafor reusable field translation structureObjectTranslationDataSchemafor per-object translation file validationTranslationFileOrganizationSchemaenum (bundled, per_locale, per_namespace)TranslationConfigSchemafor i18n stack configurationTranslationDatatype exporti18noptional property toObjectStackDefinitionSchemain stack.zod.tsexamples/app-todo/src/translations/to per-locale file splittingexamples/app-crm/src/translations/to per-locale file splitting (en, zh-CN, ja-JP, es-ES)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.