|
| 1 | +# Translation Files - AI Agent Instructions |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This directory contains XLIFF translation files for the nr_textdb TYPO3 extension. All translation files must follow XLIFF 1.2 specification and maintain complete coverage across all supported languages. |
| 6 | + |
| 7 | +## Critical Rules |
| 8 | + |
| 9 | +### 1. XLIFF Version Requirement |
| 10 | + |
| 11 | +**MANDATORY**: All translation files MUST use XLIFF 1.2, not XLIFF 1.0. |
| 12 | + |
| 13 | +✅ **Correct XLIFF 1.2 format**: |
| 14 | +```xml |
| 15 | +<?xml version="1.0" encoding="UTF-8"?> |
| 16 | +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> |
| 17 | + <file source-language="en" datatype="plaintext" original="messages" date="2024-01-15T12:00:00Z" product-name="nr_textdb" target-language="de"> |
| 18 | + <header/> |
| 19 | + <body> |
| 20 | + <trans-unit id="example.key" resname="example.key"> |
| 21 | + <source>English text</source> |
| 22 | + <target state="translated">German text</target> |
| 23 | + </trans-unit> |
| 24 | + </body> |
| 25 | + </file> |
| 26 | +</xliff> |
| 27 | +``` |
| 28 | + |
| 29 | +❌ **WRONG - XLIFF 1.0 format** (never use this): |
| 30 | +```xml |
| 31 | +<xliff version="1.0"> |
| 32 | +``` |
| 33 | + |
| 34 | +### 2. Complete Language Coverage |
| 35 | + |
| 36 | +**MANDATORY**: When adding new translation strings, you MUST create translation files for ALL supported languages. |
| 37 | + |
| 38 | +**Supported languages** (31 languages total): |
| 39 | +- `af` - Afrikaans |
| 40 | +- `ar` - Arabic |
| 41 | +- `ca` - Catalan |
| 42 | +- `cs` - Czech |
| 43 | +- `da` - Danish |
| 44 | +- `de` - German |
| 45 | +- `el` - Greek |
| 46 | +- `es` - Spanish |
| 47 | +- `fi` - Finnish |
| 48 | +- `fr` - French |
| 49 | +- `he` - Hebrew |
| 50 | +- `hi` - Hindi |
| 51 | +- `hu` - Hungarian |
| 52 | +- `id` - Indonesian |
| 53 | +- `it` - Italian |
| 54 | +- `ja` - Japanese |
| 55 | +- `ko` - Korean |
| 56 | +- `nl` - Dutch |
| 57 | +- `no` - Norwegian |
| 58 | +- `pl` - Polish |
| 59 | +- `pt` - Portuguese |
| 60 | +- `ro` - Romanian |
| 61 | +- `ru` - Russian |
| 62 | +- `sr` - Serbian |
| 63 | +- `sv` - Swedish |
| 64 | +- `sw` - Swahili |
| 65 | +- `th` - Thai |
| 66 | +- `tr` - Turkish |
| 67 | +- `uk` - Ukrainian |
| 68 | +- `vi` - Vietnamese |
| 69 | +- `zh` - Chinese |
| 70 | + |
| 71 | +**English (`en`)** is the source language and goes in base files (e.g., `locallang.xlf`, `locallang_scheduler.xlf`). |
| 72 | + |
| 73 | +### 3. File Naming Convention |
| 74 | + |
| 75 | +**Source files** (English): |
| 76 | +- `locallang.xlf` - Main backend labels |
| 77 | +- `locallang_mod.xlf` - Module labels |
| 78 | +- `locallang_scheduler.xlf` - Scheduler task labels |
| 79 | +- `locallang_db.xlf` - Database field labels (if present) |
| 80 | + |
| 81 | +**Translation files** (all other languages): |
| 82 | +- `{lang}.locallang.xlf` - Main backend labels |
| 83 | +- `{lang}.locallang_mod.xlf` - Module labels |
| 84 | +- `{lang}.locallang_scheduler.xlf` - Scheduler task labels |
| 85 | +- `{lang}.locallang_db.xlf` - Database field labels (if present) |
| 86 | + |
| 87 | +Examples: |
| 88 | +- `de.locallang.xlf` (German main labels) |
| 89 | +- `fr.locallang_scheduler.xlf` (French scheduler labels) |
| 90 | +- `es.locallang_mod.xlf` (Spanish module labels) |
| 91 | + |
| 92 | +### 4. Translation Quality Standards |
| 93 | + |
| 94 | +**Professional translations required**: |
| 95 | +- Use `state="translated"` for completed, professional translations |
| 96 | +- Use `state="needs-translation"` ONLY when professional translation is pending |
| 97 | +- Never leave English text in target elements (no lazy copy-paste) |
| 98 | +- Maintain consistent terminology across all files |
| 99 | +- Respect cultural and linguistic nuances |
| 100 | + |
| 101 | +### 5. Required XLIFF Structure Elements |
| 102 | + |
| 103 | +Every translation file MUST include: |
| 104 | + |
| 105 | +1. **XML Declaration**: |
| 106 | + ```xml |
| 107 | + <?xml version="1.0" encoding="UTF-8"?> |
| 108 | + ``` |
| 109 | + |
| 110 | +2. **XLIFF Root with Namespace**: |
| 111 | + ```xml |
| 112 | + <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> |
| 113 | + ``` |
| 114 | + |
| 115 | +3. **File Element with Attributes**: |
| 116 | + ```xml |
| 117 | + <file source-language="en" datatype="plaintext" original="messages" |
| 118 | + date="2024-01-15T12:00:00Z" product-name="nr_textdb" target-language="{lang}"> |
| 119 | + ``` |
| 120 | + |
| 121 | +4. **Header** (required but can be empty): |
| 122 | + ```xml |
| 123 | + <header/> |
| 124 | + ``` |
| 125 | + |
| 126 | +5. **Body with trans-units**: |
| 127 | + ```xml |
| 128 | + <body> |
| 129 | + <trans-unit id="key.name" resname="key.name"> |
| 130 | + <source>English text</source> |
| 131 | + <target state="translated">Translated text</target> |
| 132 | + </trans-unit> |
| 133 | + </body> |
| 134 | + ``` |
| 135 | + |
| 136 | +### 6. Workflow for Adding New Strings |
| 137 | + |
| 138 | +When adding new translation keys: |
| 139 | + |
| 140 | +1. **Add to English source file first** (e.g., `locallang_scheduler.xlf`): |
| 141 | + ```xml |
| 142 | + <trans-unit id="new.key" resname="new.key"> |
| 143 | + <source>New English text</source> |
| 144 | + </trans-unit> |
| 145 | + ``` |
| 146 | + |
| 147 | +2. **Create/update ALL 30 language files** with professional translations: |
| 148 | + ```xml |
| 149 | + <trans-unit id="new.key" resname="new.key"> |
| 150 | + <source>New English text</source> |
| 151 | + <target state="translated">Neue deutsche Text</target> |
| 152 | + </trans-unit> |
| 153 | + ``` |
| 154 | + |
| 155 | +3. **Verify completeness**: Ensure every language file contains the new key with proper translation |
| 156 | + |
| 157 | +4. **Test in TYPO3**: Verify translations display correctly in backend |
| 158 | + |
| 159 | +### 7. Common Mistakes to Avoid |
| 160 | + |
| 161 | +❌ **NEVER use XLIFF 1.0**: |
| 162 | +```xml |
| 163 | +<xliff version="1.0"> <!-- WRONG --> |
| 164 | +``` |
| 165 | + |
| 166 | +❌ **NEVER skip languages**: |
| 167 | +``` |
| 168 | +Only created de.locallang_scheduler.xlf but forgot other 29 languages |
| 169 | +``` |
| 170 | + |
| 171 | +❌ **NEVER use English text in target**: |
| 172 | +```xml |
| 173 | +<target state="translated">English text</target> <!-- WRONG for non-English files --> |
| 174 | +``` |
| 175 | + |
| 176 | +❌ **NEVER use lazy state for production**: |
| 177 | +```xml |
| 178 | +<target state="needs-translation">...</target> <!-- Only acceptable temporarily --> |
| 179 | +``` |
| 180 | + |
| 181 | +❌ **NEVER forget target-language attribute**: |
| 182 | +```xml |
| 183 | +<file source-language="en" ... > <!-- Missing target-language="de" --> |
| 184 | +``` |
| 185 | + |
| 186 | +### 8. Special Considerations |
| 187 | + |
| 188 | +**Technical terms**: Some technical terms may remain untranslated if they're industry-standard: |
| 189 | +- "Messenger" (often kept as-is) |
| 190 | +- "Scheduler" (sometimes translated, sometimes not - check existing patterns) |
| 191 | +- "Transport" (check existing usage in that language) |
| 192 | + |
| 193 | +**Placeholders**: Preserve placeholder syntax: |
| 194 | +```xml |
| 195 | +<source>Welcome %s to %s</source> |
| 196 | +<target>Bienvenue %s à %s</target> |
| 197 | +``` |
| 198 | + |
| 199 | +**Line breaks**: Preserve `\n` and other escape sequences: |
| 200 | +```xml |
| 201 | +<source>Line 1\nLine 2</source> |
| 202 | +<target>Zeile 1\nZeile 2</target> |
| 203 | +``` |
| 204 | + |
| 205 | +### 9. Validation Checklist |
| 206 | + |
| 207 | +Before committing translation changes: |
| 208 | + |
| 209 | +- [ ] All files use XLIFF 1.2 (not 1.0) |
| 210 | +- [ ] All 30 language files created/updated |
| 211 | +- [ ] Each file has correct `target-language` attribute |
| 212 | +- [ ] All translations are professional quality (not English copy-paste) |
| 213 | +- [ ] All trans-units have matching IDs across all files |
| 214 | +- [ ] Files are UTF-8 encoded |
| 215 | +- [ ] XML is well-formed (validate with TYPO3 or XML tools) |
| 216 | +- [ ] Tested in TYPO3 backend (if possible) |
| 217 | + |
| 218 | +### 10. Integration with Crowdin |
| 219 | + |
| 220 | +This project uses Crowdin for translation management. The workflow is: |
| 221 | + |
| 222 | +1. **Update English source files** in Git repository |
| 223 | +2. **Crowdin sync** pulls new English strings |
| 224 | +3. **Community translates** via Crowdin platform |
| 225 | +4. **Crowdin sync** pushes completed translations back to repository |
| 226 | + |
| 227 | +**AI Agent Note**: When manually creating translation files (as done here), ensure they align with Crowdin expectations. Check `crowdin.yml` in project root for file mapping configuration. |
| 228 | + |
| 229 | +## Examples |
| 230 | + |
| 231 | +### Example 1: Adding a new scheduler task |
| 232 | + |
| 233 | +**File: `Resources/Private/Language/locallang_scheduler.xlf`** (English source): |
| 234 | +```xml |
| 235 | +<trans-unit id="task.newTask.title" resname="task.newTask.title"> |
| 236 | + <source>My New Task</source> |
| 237 | +</trans-unit> |
| 238 | +``` |
| 239 | + |
| 240 | +**File: `Resources/Private/Language/de.locallang_scheduler.xlf`** (German): |
| 241 | +```xml |
| 242 | +<trans-unit id="task.newTask.title" resname="task.newTask.title"> |
| 243 | + <source>My New Task</source> |
| 244 | + <target state="translated">Meine neue Aufgabe</target> |
| 245 | +</trans-unit> |
| 246 | +``` |
| 247 | + |
| 248 | +**File: `Resources/Private/Language/fr.locallang_scheduler.xlf`** (French): |
| 249 | +```xml |
| 250 | +<trans-unit id="task.newTask.title" resname="task.newTask.title"> |
| 251 | + <source>My New Task</source> |
| 252 | + <target state="translated">Ma nouvelle tâche</target> |
| 253 | +</trans-unit> |
| 254 | +``` |
| 255 | + |
| 256 | +...and so on for ALL 30 languages. |
| 257 | + |
| 258 | +### Example 2: Complete minimal translation file structure |
| 259 | + |
| 260 | +```xml |
| 261 | +<?xml version="1.0" encoding="UTF-8"?> |
| 262 | +<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> |
| 263 | + <file source-language="en" datatype="plaintext" original="messages" date="2024-01-15T12:00:00Z" product-name="nr_textdb" target-language="de"> |
| 264 | + <header/> |
| 265 | + <body> |
| 266 | + <trans-unit id="example.key" resname="example.key"> |
| 267 | + <source>Example English text</source> |
| 268 | + <target state="translated">Beispiel deutscher Text</target> |
| 269 | + </trans-unit> |
| 270 | + </body> |
| 271 | + </file> |
| 272 | +</xliff> |
| 273 | +``` |
| 274 | + |
| 275 | +## Summary |
| 276 | + |
| 277 | +- **XLIFF 1.2 ONLY** - never use 1.0 |
| 278 | +- **ALL 30 languages** - complete coverage required |
| 279 | +- **Professional quality** - no lazy English copy-paste |
| 280 | +- **Consistent structure** - follow the template exactly |
| 281 | +- **Verify completeness** - check all files before committing |
| 282 | + |
| 283 | +When in doubt, reference existing translation files in this directory as templates. |
0 commit comments