@contentrain/rules 0.1.0 → 0.2.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/README.md +3 -0
- package/ide/claude-code/rules/contentrain-accessibility-rules.md +155 -0
- package/ide/claude-code/rules/contentrain-content-conventions.md +314 -0
- package/ide/claude-code/rules/contentrain-content-quality.md +294 -0
- package/ide/claude-code/rules/contentrain-i18n-quality.md +293 -0
- package/ide/claude-code/rules/contentrain-mcp-usage.md +405 -0
- package/ide/claude-code/rules/contentrain-media-rules.md +165 -0
- package/ide/claude-code/rules/contentrain-normalize-rules.md +312 -0
- package/ide/claude-code/rules/contentrain-schema-rules.md +380 -0
- package/ide/claude-code/rules/contentrain-security-rules.md +141 -0
- package/ide/claude-code/rules/contentrain-seo-rules.md +224 -0
- package/ide/claude-code/rules/contentrain-workflow-rules.md +262 -0
- package/ide/cursor/rules/contentrain-accessibility-rules.mdc +160 -0
- package/ide/cursor/rules/contentrain-content-conventions.mdc +319 -0
- package/ide/cursor/rules/contentrain-content-quality.mdc +299 -0
- package/ide/cursor/rules/contentrain-i18n-quality.mdc +298 -0
- package/ide/cursor/rules/contentrain-mcp-usage.mdc +410 -0
- package/ide/cursor/rules/contentrain-media-rules.mdc +170 -0
- package/ide/cursor/rules/contentrain-normalize-rules.mdc +317 -0
- package/ide/cursor/rules/contentrain-schema-rules.mdc +385 -0
- package/ide/cursor/rules/contentrain-security-rules.mdc +146 -0
- package/ide/cursor/rules/contentrain-seo-rules.mdc +229 -0
- package/ide/cursor/rules/contentrain-workflow-rules.mdc +267 -0
- package/ide/windsurf/rules/contentrain-accessibility-rules.md +160 -0
- package/ide/windsurf/rules/contentrain-content-conventions.md +319 -0
- package/ide/windsurf/rules/contentrain-content-quality.md +299 -0
- package/ide/windsurf/rules/contentrain-i18n-quality.md +298 -0
- package/ide/windsurf/rules/contentrain-mcp-usage.md +410 -0
- package/ide/windsurf/rules/contentrain-media-rules.md +170 -0
- package/ide/windsurf/rules/contentrain-normalize-rules.md +317 -0
- package/ide/windsurf/rules/contentrain-schema-rules.md +385 -0
- package/ide/windsurf/rules/contentrain-security-rules.md +146 -0
- package/ide/windsurf/rules/contentrain-seo-rules.md +229 -0
- package/ide/windsurf/rules/contentrain-workflow-rules.md +267 -0
- package/package.json +4 -4
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Content Quality — Contentrain content governance
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Content Quality Rules
|
|
7
|
+
|
|
8
|
+
These rules govern how AI agents create and edit content in Contentrain projects.
|
|
9
|
+
Every rule is mandatory. Violations must be fixed before committing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Writing Structure
|
|
14
|
+
|
|
15
|
+
### 1.1 Heading Hierarchy
|
|
16
|
+
|
|
17
|
+
- Use exactly ONE H1 per page. The H1 is the page/entry title.
|
|
18
|
+
- Follow sequential order: H1 → H2 → H3 → H4 → H5 → H6.
|
|
19
|
+
- NEVER skip levels. An H4 must be preceded by an H3 in the same section.
|
|
20
|
+
- Do not use headings for visual styling. A heading implies a content section.
|
|
21
|
+
|
|
22
|
+
### 1.2 Titles
|
|
23
|
+
|
|
24
|
+
- Length: 50-60 characters. Measure before committing.
|
|
25
|
+
- Place the primary keyword within the first 30 characters.
|
|
26
|
+
- Use action-oriented phrasing: "Build a REST API" not "REST API Overview".
|
|
27
|
+
- No clickbait: "You Won't Believe..." is forbidden.
|
|
28
|
+
- No ALL CAPS titles. Use sentence case or title case per project convention.
|
|
29
|
+
- Every title must be unique within its collection.
|
|
30
|
+
|
|
31
|
+
### 1.3 Excerpts and Descriptions
|
|
32
|
+
|
|
33
|
+
- Length: 120-160 characters. Must be a complete sentence.
|
|
34
|
+
- Summarize the VALUE the reader gets, not the process of writing.
|
|
35
|
+
- GOOD: "Learn how to deploy a Node.js app to production in under 5 minutes."
|
|
36
|
+
- BAD: "This article discusses deployment."
|
|
37
|
+
- End with a period. No trailing ellipsis.
|
|
38
|
+
- Must differ from the title — do not repeat the title verbatim.
|
|
39
|
+
|
|
40
|
+
### 1.4 Body Content
|
|
41
|
+
|
|
42
|
+
- Prefer active voice. Passive voice is acceptable only when the actor is unknown or irrelevant.
|
|
43
|
+
- Target reading grade 8-10 (Flesch-Kincaid). Avoid unnecessarily complex sentences.
|
|
44
|
+
- Paragraphs: 3-5 sentences each. Break longer paragraphs.
|
|
45
|
+
- Use transition sentences between sections to maintain flow.
|
|
46
|
+
- Front-load key information — most important point first in each paragraph.
|
|
47
|
+
- One idea per paragraph. Do not combine unrelated points.
|
|
48
|
+
|
|
49
|
+
### 1.5 Lists
|
|
50
|
+
|
|
51
|
+
- Use parallel grammatical structure across all items.
|
|
52
|
+
- GOOD: "Install dependencies", "Configure the server", "Run the tests"
|
|
53
|
+
- BAD: "Install dependencies", "Server configuration", "You should run tests"
|
|
54
|
+
- Punctuation: if items are complete sentences, end each with a period. If fragments, no terminal punctuation. Be consistent within a single list.
|
|
55
|
+
- Ordered lists for sequential steps. Unordered lists for non-sequential items.
|
|
56
|
+
- Minimum 2 items in any list. A single-item list is not a list.
|
|
57
|
+
|
|
58
|
+
### 1.6 No Placeholder Text
|
|
59
|
+
|
|
60
|
+
Reject and replace any of the following immediately:
|
|
61
|
+
|
|
62
|
+
- "Lorem ipsum" or any Latin filler text
|
|
63
|
+
- "TODO", "TBD", "FIXME", "XXX" in content fields
|
|
64
|
+
- "[insert here]", "[your text]", "[placeholder]"
|
|
65
|
+
- "Sample text", "Example content", "Test entry"
|
|
66
|
+
- Empty strings in required fields
|
|
67
|
+
|
|
68
|
+
If the agent cannot produce real content, it must leave the entry in `draft` status and flag the field explicitly. Never commit placeholder text.
|
|
69
|
+
|
|
70
|
+
### 1.7 No Duplicate Content
|
|
71
|
+
|
|
72
|
+
- The same text block must not appear in multiple entries within a collection.
|
|
73
|
+
- Titles must be unique across all entries in the same collection.
|
|
74
|
+
- Descriptions/excerpts must be unique across all entries in the same collection.
|
|
75
|
+
- If content is shared across entries, extract it to a referenced entry and use a `relation` field.
|
|
76
|
+
- Before writing, query existing entries to confirm no duplication.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 2. Tone and Voice
|
|
81
|
+
|
|
82
|
+
### 2.1 Project Tone Configuration
|
|
83
|
+
|
|
84
|
+
- Read `.contentrain/context.json` → `conventions.tone` before writing any content.
|
|
85
|
+
- If the field exists, match the specified tone exactly.
|
|
86
|
+
- If `context.json` does not exist or `conventions.tone` is absent, default to **neutral professional** tone.
|
|
87
|
+
- Never override or ignore the configured tone.
|
|
88
|
+
|
|
89
|
+
### 2.2 Vocabulary Compliance
|
|
90
|
+
|
|
91
|
+
- Read `.contentrain/vocabulary.json` before writing content.
|
|
92
|
+
- Use canonical terms exactly as defined. Never invent synonyms for canonical terms.
|
|
93
|
+
- If vocabulary defines "Sign up", do not write "Register", "Create account", or "Join".
|
|
94
|
+
- Respect `brand_terms`: use exact casing and spacing as defined.
|
|
95
|
+
- If brand defines "GitHub", never write "Github", "github", or "GH".
|
|
96
|
+
- Respect `forbidden_terms`: never use any term on this list.
|
|
97
|
+
- If `vocabulary.json` does not exist, proceed without term constraints but maintain internal consistency — pick one term and use it everywhere.
|
|
98
|
+
|
|
99
|
+
### 2.3 Content Type Voice Mapping
|
|
100
|
+
|
|
101
|
+
Match voice to content type:
|
|
102
|
+
|
|
103
|
+
| Content Type | Voice | Characteristics |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| Marketing / Landing pages | Persuasive | Benefit-focused, confident, action-oriented, second person ("you") |
|
|
106
|
+
| Documentation / Guides | Instructional | Step-by-step, precise, imperative mood ("Run the command"), third person for concepts |
|
|
107
|
+
| Error messages | Empathetic | Solution-oriented, no blame, explain what happened and what to do next |
|
|
108
|
+
| UI labels | Concise | Consistent terminology, sentence case, no articles unless needed for clarity |
|
|
109
|
+
| Blog posts | Conversational-professional | Engaging, informative, first person plural ("we") acceptable |
|
|
110
|
+
| Changelogs | Factual | Past tense, specific, version-referenced, no marketing language |
|
|
111
|
+
|
|
112
|
+
### 2.4 Consistency Within an Entry
|
|
113
|
+
|
|
114
|
+
- Do not shift tone mid-entry. If the opening is formal, maintain formality throughout.
|
|
115
|
+
- Do not mix second person ("you") and third person ("the user") within the same entry.
|
|
116
|
+
- Maintain consistent use of contractions: either use them throughout or not at all per project tone.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 3. Content Type Patterns
|
|
121
|
+
|
|
122
|
+
### 3.1 Blog Post (document kind)
|
|
123
|
+
|
|
124
|
+
Required structure:
|
|
125
|
+
|
|
126
|
+
1. **Hook opening** (1-2 sentences): State the problem, ask a question, or present a surprising fact.
|
|
127
|
+
2. **Context** (1 paragraph): Why this topic matters now.
|
|
128
|
+
3. **Scannable body**: Use H2/H3 subheadings every 2-4 paragraphs. Each section is self-contained.
|
|
129
|
+
4. **Conclusion** (1 paragraph): Summarize key takeaways.
|
|
130
|
+
5. **Call-to-action**: Direct the reader to a next step (related post, product, signup).
|
|
131
|
+
|
|
132
|
+
Do not start with "In this article, we will discuss..." — start with value.
|
|
133
|
+
|
|
134
|
+
### 3.2 Landing Page (singleton kind)
|
|
135
|
+
|
|
136
|
+
Required sections in order:
|
|
137
|
+
|
|
138
|
+
1. **Hero statement**: One sentence, max 10 words. State the core value proposition.
|
|
139
|
+
2. **Problem**: 2-3 sentences describing the pain point.
|
|
140
|
+
3. **Solution**: How the product/service solves it. Benefit-focused, not feature-focused.
|
|
141
|
+
4. **Features**: 3-6 features, each with a heading and 1-2 sentence description.
|
|
142
|
+
5. **Social proof**: Testimonials, logos, statistics. Must reference real data.
|
|
143
|
+
6. **CTA**: Clear, single action. Use action verbs: "Start free trial", "Get started", "Book a demo".
|
|
144
|
+
|
|
145
|
+
### 3.3 Documentation (document kind)
|
|
146
|
+
|
|
147
|
+
Required structure:
|
|
148
|
+
|
|
149
|
+
1. **Prerequisites callout**: List what the reader needs before starting (tools, accounts, knowledge).
|
|
150
|
+
2. **Overview** (1-2 sentences): What the reader will accomplish.
|
|
151
|
+
3. **Step-by-step instructions**: Numbered steps, one action per step, code blocks where applicable.
|
|
152
|
+
4. **Expected result**: What the reader should see/have after completing the steps.
|
|
153
|
+
5. **Troubleshooting**: Common errors and their solutions. Minimum 2 items.
|
|
154
|
+
|
|
155
|
+
Use imperative mood: "Run the command" not "You should run the command".
|
|
156
|
+
|
|
157
|
+
### 3.4 Error Messages (dictionary kind)
|
|
158
|
+
|
|
159
|
+
Structure each error message with three parts:
|
|
160
|
+
|
|
161
|
+
1. **What happened**: State the error clearly. "Your session has expired."
|
|
162
|
+
2. **Why**: Brief explanation. "Sessions expire after 30 minutes of inactivity."
|
|
163
|
+
3. **How to fix**: Actionable next step. "Sign in again to continue."
|
|
164
|
+
|
|
165
|
+
Rules:
|
|
166
|
+
- No blame language: "Invalid input" not "You entered invalid input".
|
|
167
|
+
- No technical jargon in user-facing errors.
|
|
168
|
+
- No naked error codes: always pair codes with human-readable text.
|
|
169
|
+
|
|
170
|
+
### 3.5 Form Labels (dictionary kind)
|
|
171
|
+
|
|
172
|
+
- Use noun or noun phrase: "Email address", "Password", "Company name".
|
|
173
|
+
- Sentence case consistently: "Email address" not "Email Address".
|
|
174
|
+
- No colons at the end of labels.
|
|
175
|
+
- Helper text: one sentence explaining what to enter or format requirements.
|
|
176
|
+
- Consistent phrasing across all forms in the project.
|
|
177
|
+
|
|
178
|
+
### 3.6 Navigation Items (dictionary kind)
|
|
179
|
+
|
|
180
|
+
- 1-2 words maximum.
|
|
181
|
+
- Use verbs for actions: "Sign in", "Download", "Contact".
|
|
182
|
+
- Use nouns for destinations: "Dashboard", "Settings", "Pricing".
|
|
183
|
+
- No abbreviations unless universally understood.
|
|
184
|
+
- Consistent capitalization: match the project convention.
|
|
185
|
+
|
|
186
|
+
### 3.7 Notifications (dictionary kind)
|
|
187
|
+
|
|
188
|
+
- Start with what happened: "Your file has been uploaded."
|
|
189
|
+
- Include timestamp context when relevant: "2 minutes ago".
|
|
190
|
+
- End with next action if applicable: "View file" or "Dismiss".
|
|
191
|
+
- Keep under 100 characters for mobile readability.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 4. Content Lifecycle
|
|
196
|
+
|
|
197
|
+
### 4.1 Draft Status
|
|
198
|
+
|
|
199
|
+
- Focus on completeness over polish.
|
|
200
|
+
- ALL required fields must have real values — no placeholders.
|
|
201
|
+
- Optional fields may be empty but should be populated when possible.
|
|
202
|
+
- Drafts do not need final copy-editing but must be factually correct.
|
|
203
|
+
- Flag any fields the agent could not confidently populate.
|
|
204
|
+
|
|
205
|
+
### 4.2 Review Status
|
|
206
|
+
|
|
207
|
+
- Vocabulary compliance: every term matches `vocabulary.json`.
|
|
208
|
+
- Tone consistency: matches `context.json` → `conventions.tone` throughout.
|
|
209
|
+
- Factual accuracy: all claims, statistics, and references are verifiable.
|
|
210
|
+
- Cross-locale coverage: if entry exists in source locale, all target locales must have corresponding entries.
|
|
211
|
+
- Field constraint compliance: all values within min/max length, pattern, and type constraints.
|
|
212
|
+
|
|
213
|
+
### 4.3 Published Status
|
|
214
|
+
|
|
215
|
+
ALL of the following must be true:
|
|
216
|
+
|
|
217
|
+
- Every required field is populated with final content.
|
|
218
|
+
- Every supported locale has a complete translation.
|
|
219
|
+
- Zero placeholder text anywhere in the entry.
|
|
220
|
+
- All relation fields reference existing, published entries.
|
|
221
|
+
- SEO fields (title, description, slug) are populated and valid.
|
|
222
|
+
- Content passes tone and vocabulary checks.
|
|
223
|
+
|
|
224
|
+
### 4.4 Archive Criteria
|
|
225
|
+
|
|
226
|
+
Move content to archived status when:
|
|
227
|
+
|
|
228
|
+
- It references deprecated features, APIs, or products.
|
|
229
|
+
- Dates or events referenced are more than 12 months past.
|
|
230
|
+
- The content has been superseded by a newer entry.
|
|
231
|
+
- Statistics or data points are outdated and cannot be updated.
|
|
232
|
+
|
|
233
|
+
Never delete content. Archive it. Deletion is a manual human decision.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 5. Contentrain-Specific Rules
|
|
238
|
+
|
|
239
|
+
### 5.1 System-Managed Fields
|
|
240
|
+
|
|
241
|
+
NEVER write to these fields — they are managed by the system:
|
|
242
|
+
|
|
243
|
+
- `id` — auto-generated unique identifier
|
|
244
|
+
- `createdAt` — set on creation
|
|
245
|
+
- `updatedAt` — set on every save
|
|
246
|
+
- `status` — managed through workflow transitions
|
|
247
|
+
- `order` — managed through UI reordering
|
|
248
|
+
|
|
249
|
+
If a write payload includes any system field, remove it before saving.
|
|
250
|
+
|
|
251
|
+
### 5.2 Metadata Directory
|
|
252
|
+
|
|
253
|
+
- NEVER write to `.contentrain/meta/` — all metadata files are system-managed.
|
|
254
|
+
- NEVER modify `.contentrain/models/` directly — use MCP tools.
|
|
255
|
+
- Read these directories for context, but treat them as read-only.
|
|
256
|
+
|
|
257
|
+
### 5.3 Vocabulary Usage
|
|
258
|
+
|
|
259
|
+
- Load `vocabulary.json` at the start of every content operation.
|
|
260
|
+
- Cross-reference every noun, verb, and technical term against the vocabulary.
|
|
261
|
+
- If a term is not in the vocabulary but should be, flag it for human review — do not add it.
|
|
262
|
+
- Vocabulary applies across ALL entries, ALL collections, ALL locales.
|
|
263
|
+
|
|
264
|
+
### 5.4 Model Field Constraints
|
|
265
|
+
|
|
266
|
+
Before writing any field value:
|
|
267
|
+
|
|
268
|
+
1. Read the model definition from `.contentrain/models/`.
|
|
269
|
+
2. Check `required` — required fields must have non-empty values.
|
|
270
|
+
3. Check `min` / `max` — string length must be within bounds.
|
|
271
|
+
4. Check `pattern` — value must match regex if defined.
|
|
272
|
+
5. Check `unique` — value must not duplicate any existing entry in the collection.
|
|
273
|
+
6. Check `options` — if the field is an enum/select, value must be from the defined list.
|
|
274
|
+
|
|
275
|
+
Constraint violations must be fixed before saving. Never save invalid data.
|
|
276
|
+
|
|
277
|
+
### 5.5 Collection Entry Consistency
|
|
278
|
+
|
|
279
|
+
- All entries within a collection must follow the same structural pattern.
|
|
280
|
+
- If existing entries use a specific content structure (e.g., all blog posts start with a hook), new entries must follow the same pattern.
|
|
281
|
+
- Before creating a new entry, read 2-3 existing entries to understand the established pattern.
|
|
282
|
+
- If no existing entries exist, follow the content type pattern defined in Section 3.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Validation Checklist
|
|
287
|
+
|
|
288
|
+
Before committing any content, verify:
|
|
289
|
+
|
|
290
|
+
- [ ] Heading hierarchy is sequential (H1 → H2 → H3, no skips)
|
|
291
|
+
- [ ] Title is 50-60 characters, keyword-rich, unique
|
|
292
|
+
- [ ] Description is 120-160 characters, complete sentence, unique
|
|
293
|
+
- [ ] No placeholder text anywhere
|
|
294
|
+
- [ ] No duplicate content across entries
|
|
295
|
+
- [ ] Tone matches `context.json` configuration
|
|
296
|
+
- [ ] All terms match `vocabulary.json`
|
|
297
|
+
- [ ] All field constraints (length, pattern, required) are satisfied
|
|
298
|
+
- [ ] Content follows the correct content type pattern
|
|
299
|
+
- [ ] System fields are not included in write payload
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: I18n Quality — Contentrain content governance
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Internationalization (i18n) Quality Rules
|
|
7
|
+
|
|
8
|
+
These rules govern translation and localization quality for all content managed through Contentrain.
|
|
9
|
+
Every rule applies whenever the project has more than one locale configured.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Translation Completeness
|
|
14
|
+
|
|
15
|
+
### 1.1 Coverage Requirement
|
|
16
|
+
|
|
17
|
+
- Read `.contentrain/config.json` → `locales.supported` to determine the full list of supported locales.
|
|
18
|
+
- EVERY entry that exists in the source locale MUST have a corresponding entry in ALL supported target locales.
|
|
19
|
+
- Missing translations are deployment blockers. Treat a missing locale file as an error, not a warning.
|
|
20
|
+
|
|
21
|
+
### 1.2 Dictionary Entries
|
|
22
|
+
|
|
23
|
+
- Every key present in the source locale file MUST exist in every target locale file.
|
|
24
|
+
- No partial dictionaries. If a new key is added, add it for ALL locales in the same operation.
|
|
25
|
+
- If the agent cannot produce a quality translation, insert the source-locale text and set status to `draft` — never leave the key absent.
|
|
26
|
+
|
|
27
|
+
### 1.3 Document and Singleton Entries
|
|
28
|
+
|
|
29
|
+
- When creating a new document or singleton entry, create locale files for ALL supported locales.
|
|
30
|
+
- The source locale file is the reference. Target locale files must contain translations of every field.
|
|
31
|
+
- Required fields in the model must be populated in every locale — empty required fields are invalid.
|
|
32
|
+
|
|
33
|
+
### 1.4 Completeness Verification
|
|
34
|
+
|
|
35
|
+
Before committing, run this check:
|
|
36
|
+
|
|
37
|
+
1. List all entry IDs in the source locale directory.
|
|
38
|
+
2. For each target locale, confirm the same set of IDs exists.
|
|
39
|
+
3. For each entry, confirm all required fields have non-empty values.
|
|
40
|
+
4. Report any gaps as errors.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 2. Translation Quality
|
|
45
|
+
|
|
46
|
+
### 2.1 Idiomatic Translation
|
|
47
|
+
|
|
48
|
+
- Translate MEANING, not words. Literal word-for-word translation produces unnatural text.
|
|
49
|
+
- EN: "It's raining cats and dogs" → TR: "Bardaktan bosanircasina yagmur yagiyor" (NOT "Kediler ve kopekler yagiyor")
|
|
50
|
+
- Sentence structure must follow target language grammar, not source language grammar.
|
|
51
|
+
- Read translated text aloud mentally — if it sounds unnatural, rewrite it.
|
|
52
|
+
|
|
53
|
+
### 2.2 Machine Translation Artifacts
|
|
54
|
+
|
|
55
|
+
Detect and fix these common machine-translation problems:
|
|
56
|
+
|
|
57
|
+
- Overly literal translations that ignore idiom.
|
|
58
|
+
- Incorrect gender agreement (common in Romance, Slavic, Turkic languages).
|
|
59
|
+
- Wrong register/formality (e.g., using informal "du" in German business content).
|
|
60
|
+
- Untranslated fragments left in source language mid-sentence.
|
|
61
|
+
- Garbled word order that follows source language syntax.
|
|
62
|
+
|
|
63
|
+
### 2.3 Tone Preservation
|
|
64
|
+
|
|
65
|
+
- If the source content is casual, the translation must be casual in the target language.
|
|
66
|
+
- If the source content is formal, the translation must use formal register.
|
|
67
|
+
- Check `context.json` → `conventions.tone` — it applies to ALL locales.
|
|
68
|
+
- Formality mapping varies by language:
|
|
69
|
+
- German: use "Sie" (formal) for professional content, "du" for casual.
|
|
70
|
+
- French: use "vous" (formal) by default, "tu" only if explicitly configured.
|
|
71
|
+
- Turkish: use "siz" (formal) for professional, "sen" for casual.
|
|
72
|
+
- Japanese: use desu/masu form for professional content.
|
|
73
|
+
|
|
74
|
+
### 2.4 Technical Terms
|
|
75
|
+
|
|
76
|
+
- Keep technical terms in their original form if no widely accepted translation exists.
|
|
77
|
+
- Keep as-is: "API", "webhook", "SSL", "DNS", "SDK", "CLI", "URL".
|
|
78
|
+
- Translate if established: "database" → "Datenbank" (de), "browser" → "navegador" (es).
|
|
79
|
+
- Check `vocabulary.json` for approved translations of technical terms per locale.
|
|
80
|
+
- If `vocabulary.json` specifies a translation, use it. Do not override with a different translation.
|
|
81
|
+
|
|
82
|
+
### 2.5 Brand Terms
|
|
83
|
+
|
|
84
|
+
- Brand terms from `vocabulary.json` → `brand_terms` must be used exactly as specified per locale.
|
|
85
|
+
- Some brand terms are never translated (product names, company names).
|
|
86
|
+
- Some brand terms have locale-specific variants — use the variant defined in vocabulary.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 3. Cultural Adaptation
|
|
91
|
+
|
|
92
|
+
### 3.1 Date Formats
|
|
93
|
+
|
|
94
|
+
Reference the target locale convention when writing date examples or references in content:
|
|
95
|
+
|
|
96
|
+
| Locale | Format | Example |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| en-US | MM/DD/YYYY | 03/15/2025 |
|
|
99
|
+
| en-GB | DD/MM/YYYY | 15/03/2025 |
|
|
100
|
+
| de, fr, tr, most EU | DD.MM.YYYY or DD/MM/YYYY | 15.03.2025 |
|
|
101
|
+
| ja, zh, ko | YYYY/MM/DD or YYYY年MM月DD日 | 2025/03/15 |
|
|
102
|
+
| ISO 8601 | YYYY-MM-DD | 2025-03-15 |
|
|
103
|
+
|
|
104
|
+
- Do not hardcode date strings. If content references a date, use locale-appropriate formatting.
|
|
105
|
+
- When in doubt, use ISO 8601 format.
|
|
106
|
+
|
|
107
|
+
### 3.2 Number Formats
|
|
108
|
+
|
|
109
|
+
| Convention | Thousands | Decimal | Locales |
|
|
110
|
+
|---|---|---|---|
|
|
111
|
+
| Period-decimal | 1,000.00 | `.` | en, ja, zh, ko |
|
|
112
|
+
| Comma-decimal | 1.000,00 | `,` | de, fr, tr, es, pt, it, nl |
|
|
113
|
+
| Space-thousands | 1 000,00 | `,` | fr (formal), sv, fi, pl |
|
|
114
|
+
|
|
115
|
+
- Match the target locale convention when writing numbers in content.
|
|
116
|
+
- Currency values: always specify the currency code (USD, EUR, TRY). Never assume currency from locale alone.
|
|
117
|
+
|
|
118
|
+
### 3.3 Units of Measurement
|
|
119
|
+
|
|
120
|
+
- en-US: imperial (miles, pounds, Fahrenheit) unless the context is scientific.
|
|
121
|
+
- Most other locales: metric (kilometers, kilograms, Celsius).
|
|
122
|
+
- Match the target locale convention. If content says "5 miles" in en-US, the de translation should say "8 km".
|
|
123
|
+
|
|
124
|
+
### 3.4 Cultural Sensitivity
|
|
125
|
+
|
|
126
|
+
- Food, gestures, symbols, and colors carry different meanings across cultures.
|
|
127
|
+
- Do not reference culturally specific holidays as universal (e.g., "Thanksgiving" is US/Canada-specific).
|
|
128
|
+
- When referencing imagery in content, ensure descriptions are culturally appropriate for the target locale.
|
|
129
|
+
- Avoid idioms that do not translate — replace with locale-appropriate equivalents.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 4. String Length Awareness
|
|
134
|
+
|
|
135
|
+
### 4.1 Expansion Ratios
|
|
136
|
+
|
|
137
|
+
Expect these approximate expansion ratios from English source text:
|
|
138
|
+
|
|
139
|
+
| Target Language | Expansion | Notes |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| German | +30-40% | Compound words, longer sentences |
|
|
142
|
+
| Finnish | +30-40% | Agglutinative morphology |
|
|
143
|
+
| Dutch | +25-35% | Longer compound words |
|
|
144
|
+
| French | +15-25% | Articles, prepositions |
|
|
145
|
+
| Spanish | +15-25% | Longer verb forms |
|
|
146
|
+
| Portuguese | +15-25% | Similar to Spanish |
|
|
147
|
+
| Italian | +10-20% | Moderate expansion |
|
|
148
|
+
| Turkish | +10-20% | Suffixation expands words |
|
|
149
|
+
| Russian | +10-15% | Moderate expansion |
|
|
150
|
+
| Chinese (zh) | -30-50% | Fewer characters, wider glyphs |
|
|
151
|
+
| Japanese (ja) | -20-40% | Mixed scripts, compact |
|
|
152
|
+
| Korean (ko) | -10-20% | Syllable blocks |
|
|
153
|
+
| Arabic (ar) | -10-20% | Compact script, RTL |
|
|
154
|
+
|
|
155
|
+
### 4.2 Field Constraints
|
|
156
|
+
|
|
157
|
+
- Check the model's `max` field constraint for every text field.
|
|
158
|
+
- The translated text MUST fit within the `max` character limit.
|
|
159
|
+
- If a translation exceeds the limit, rewrite it shorter. Do NOT truncate mid-word or mid-sentence.
|
|
160
|
+
- Test the longest expected language (usually German or Finnish) against all max constraints.
|
|
161
|
+
|
|
162
|
+
### 4.3 UI String Considerations
|
|
163
|
+
|
|
164
|
+
- Button labels, menu items, and form labels have tight space constraints.
|
|
165
|
+
- German button text may need abbreviation or restructuring to fit.
|
|
166
|
+
- Verify that translated UI strings do not break layout assumptions.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 5. Dictionary Key Naming
|
|
171
|
+
|
|
172
|
+
### 5.1 Naming Convention
|
|
173
|
+
|
|
174
|
+
- Use semantic, hierarchical, dot-separated keys.
|
|
175
|
+
- GOOD: `auth.login.button`, `errors.404.title`, `nav.main.dashboard`
|
|
176
|
+
- BAD: `button1`, `text_3`, `label_top`, `str_47`
|
|
177
|
+
- Key names are always in English regardless of locale.
|
|
178
|
+
- Use lowercase with dots as separators. No spaces, no camelCase, no PascalCase in keys.
|
|
179
|
+
|
|
180
|
+
### 5.2 Grouping
|
|
181
|
+
|
|
182
|
+
- Group keys by feature or domain, not by page or visual position.
|
|
183
|
+
- GOOD: `auth.login.button`, `auth.login.email_label`, `auth.login.error`
|
|
184
|
+
- BAD: `login_page.top_button`, `login_page.first_input`, `login_page.red_text`
|
|
185
|
+
- Top-level groups: `auth`, `nav`, `errors`, `forms`, `common`, `notifications`, `settings`.
|
|
186
|
+
- Add new groups only when existing groups do not fit.
|
|
187
|
+
|
|
188
|
+
### 5.3 Consistency
|
|
189
|
+
|
|
190
|
+
- Similar concepts use similar key structures across features.
|
|
191
|
+
- `auth.login.button` and `auth.signup.button` — parallel structure.
|
|
192
|
+
- Do not use different naming patterns for the same concept.
|
|
193
|
+
- Before adding a new key, check existing keys for established patterns.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 6. RTL Language Support
|
|
198
|
+
|
|
199
|
+
### 6.1 RTL Locales
|
|
200
|
+
|
|
201
|
+
Flag these locales as right-to-left:
|
|
202
|
+
|
|
203
|
+
- Arabic (`ar`)
|
|
204
|
+
- Hebrew (`he`)
|
|
205
|
+
- Persian / Farsi (`fa`)
|
|
206
|
+
- Urdu (`ur`)
|
|
207
|
+
- Pashto (`ps`)
|
|
208
|
+
- Sindhi (`sd`)
|
|
209
|
+
|
|
210
|
+
### 6.2 Content Rules for RTL
|
|
211
|
+
|
|
212
|
+
- Body text flows right-to-left. Do not force LTR markers in body content.
|
|
213
|
+
- Embedded elements that remain LTR: numbers, URLs, email addresses, code snippets, brand names in Latin script.
|
|
214
|
+
- Punctuation placement follows RTL rules: period at the left end of a sentence.
|
|
215
|
+
- Lists and bullet points align to the right margin.
|
|
216
|
+
|
|
217
|
+
### 6.3 Bidirectional Text
|
|
218
|
+
|
|
219
|
+
- When RTL text contains LTR segments (e.g., a product name in English), ensure proper Unicode bidi handling.
|
|
220
|
+
- Do not manually insert Unicode directional markers (LRM, RLM) in content — leave that to the rendering layer.
|
|
221
|
+
- Test that mixed-direction content reads correctly in sequence.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 7. Pluralization
|
|
226
|
+
|
|
227
|
+
### 7.1 Plural Categories
|
|
228
|
+
|
|
229
|
+
Languages have different plural rule counts:
|
|
230
|
+
|
|
231
|
+
| Category | Languages | Plural Forms |
|
|
232
|
+
|---|---|---|
|
|
233
|
+
| No plurals | Chinese, Japanese, Korean, Vietnamese | 1 (`other`) |
|
|
234
|
+
| Two forms | English, German, Dutch, Spanish, Italian, Portuguese, Turkish | 2 (`one`, `other`) |
|
|
235
|
+
| Three forms | French, Brazilian Portuguese | 2-3 (`one`, `other`, sometimes `many`) |
|
|
236
|
+
| Multiple forms | Russian, Polish, Czech, Ukrainian | 3-4 (`one`, `few`, `many`, `other`) |
|
|
237
|
+
| Complex | Arabic | 6 (`zero`, `one`, `two`, `few`, `many`, `other`) |
|
|
238
|
+
|
|
239
|
+
### 7.2 Dictionary Key Structure for Plurals
|
|
240
|
+
|
|
241
|
+
- Use CLDR plural categories as key suffixes:
|
|
242
|
+
- `items.zero` — zero items (where applicable)
|
|
243
|
+
- `items.one` — exactly one item
|
|
244
|
+
- `items.two` — exactly two items (Arabic)
|
|
245
|
+
- `items.few` — small numbers (language-specific rules)
|
|
246
|
+
- `items.many` — large numbers (language-specific rules)
|
|
247
|
+
- `items.other` — default/fallback (REQUIRED for every plural set)
|
|
248
|
+
- The `other` key is mandatory. It is the fallback for any count not covered by other categories.
|
|
249
|
+
- Only include the plural categories relevant to the target language.
|
|
250
|
+
- English: `items.one`, `items.other`
|
|
251
|
+
- Arabic: all six categories
|
|
252
|
+
|
|
253
|
+
### 7.3 ICU Message Format
|
|
254
|
+
|
|
255
|
+
- When the project uses ICU message format, reference it correctly:
|
|
256
|
+
- `{count, plural, one {# item} other {# items}}`
|
|
257
|
+
- Do not invent custom pluralization logic. Use the established format.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 8. Vocabulary Alignment
|
|
262
|
+
|
|
263
|
+
### 8.1 Cross-Locale Vocabulary
|
|
264
|
+
|
|
265
|
+
- `vocabulary.json` must have entries for ALL supported locales.
|
|
266
|
+
- When adding a new canonical term, provide the translation for every supported locale.
|
|
267
|
+
- If a term has no natural translation, mark it as "keep original" in the vocabulary entry.
|
|
268
|
+
|
|
269
|
+
### 8.2 Consistency Enforcement
|
|
270
|
+
|
|
271
|
+
- Every occurrence of a canonical term in every locale must match `vocabulary.json`.
|
|
272
|
+
- Run vocabulary checks across all locales, not just the source locale.
|
|
273
|
+
- If a translated term appears inconsistent (e.g., "Einstellungen" in one entry and "Konfiguration" in another for "Settings"), flag it and use the vocabulary-defined term.
|
|
274
|
+
|
|
275
|
+
### 8.3 Adding New Terms
|
|
276
|
+
|
|
277
|
+
- Do not add new terms to `vocabulary.json` without human approval.
|
|
278
|
+
- When the agent encounters a term that should be canonical but is not in the vocabulary, flag it in the commit message or review notes.
|
|
279
|
+
- New terms must include: source term, translation for each locale, context/usage note.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Validation Checklist
|
|
284
|
+
|
|
285
|
+
Before committing any multilingual content, verify:
|
|
286
|
+
|
|
287
|
+
- [ ] All supported locales have entries for every content item
|
|
288
|
+
- [ ] All required fields are populated in every locale
|
|
289
|
+
- [ ] No machine-translation artifacts (literal translations, wrong grammar)
|
|
290
|
+
- [ ] Tone matches source content in all target locales
|
|
291
|
+
- [ ] Technical terms follow `vocabulary.json` or are kept in original form
|
|
292
|
+
- [ ] Brand terms exactly match `vocabulary.json` per locale
|
|
293
|
+
- [ ] Translated text fits within field `max` constraints
|
|
294
|
+
- [ ] Date, number, and currency formats match target locale
|
|
295
|
+
- [ ] Dictionary keys are semantic, hierarchical, and in English
|
|
296
|
+
- [ ] Plural forms use correct CLDR categories for each language
|
|
297
|
+
- [ ] RTL locales are flagged and content follows RTL rules
|
|
298
|
+
- [ ] Vocabulary entries exist for all terms in all supported locales
|