Skip to content

Commit 6c52f2f

Browse files
committed
Update object.md
1 parent 23e8f89 commit 6c52f2f

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

docs/spec/object.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,61 @@ fields:
187187
index: true # Creates a vector index (IVFFlat / HNSW)
188188
```
189189

190+
## 5. Internationalization (i18n)
191+
192+
ObjectQL is built to support creating global applications. The philosophy is to **keep the core schema clean** and manage translations separately.
193+
194+
### 5.1 Metadata Translation (UI)
195+
196+
All user-facing text defined in `*.object.yml` (Object Labels, Field Labels, Help Text, Select Options) should be translated via external JSON files. This separation allows AI agents to translate the entire UI in one go without touching the schema logic.
197+
198+
**Directory Structure:**
199+
```
200+
src/
201+
objects/
202+
project.object.yml # Source of Truth (Default Language, usually English)
203+
i18n/
204+
zh-CN/
205+
project.json # Chinese Translation
206+
es-ES/
207+
project.json # Spanish Translation
208+
```
209+
210+
**Translation File Format (`project.json`):**
211+
The structure mirrors the object definition but only contains translatable strings.
212+
213+
```json
214+
{
215+
"label": "项目",
216+
"description": "项目管理核心对象",
217+
"fields": {
218+
"status": {
219+
"label": "状态",
220+
"help_text": "项目的当前进展阶段",
221+
"options": {
222+
"planned": "计划中",
223+
"in_progress": "进行中",
224+
"completed": "已完成"
225+
}
226+
}
227+
},
228+
"actions": {
229+
"approve": {
230+
"label": "审批",
231+
"confirm_text": "确认审批通过吗?"
232+
}
233+
}
234+
}
235+
```
236+
237+
### 5.2 Data Content
238+
239+
ObjectQL does **not** enforce a specific "multi-language column" format (like JSON fields) in the core spec, as this often complicates indexing and reporting.
240+
241+
Recommended strategies for content translation:
242+
1. **Separate Record Strategy**: Store different language versions as separate records with a `locale` field and a `master_id`.
243+
2. **Translation Tables**: Use a standard relational design (e.g., `Product` -> `ProductTranslation`).
244+
245+
246+
190247

0 commit comments

Comments
 (0)