Управление многоязычными переводами на 29 языков с приоритетом русского языка. Использовать при добавлении новых переводов, переводе на все языки, проверке консистентности или удалении устаревших ключей.
Translation management for the MikoPBX telephony system across 29 languages with Russian-first workflow.
ru/) filessrc/Common/Messages/
├── ru/ ⭐ PRIMARY - Edit ONLY this
│ ├── ApiKeys.php
│ ├── Extensions.php
│ └── ... (all modules)
├── en/ 🌐 Auto-translated
├── es/ 🌐 Auto-translated
└── [27 more langs] 🌐 Auto-translated
Developers ONLY modify Russian (ru/*.php) translations.
All other languages are translated via:
ONE FILE AT A TIME: Never attempt to translate multiple files simultaneously. Complete one file fully (all languages) before moving to the next file.
PROCESS LANGUAGES SEQUENTIALLY: Complete one language fully (analysis → translation → merge → validation → reset) before starting the next language.
ALWAYS VERIFY KEY COUNT: After processing each language, verify the key count matches Russian source EXACTLY. Stop if mismatch occurs.
NEVER OVERWRITE EXISTING TRANSLATIONS: Only translate missing keys. Preserve all existing correct translations.
RESET CONTEXT BETWEEN LANGUAGES: Clear working variables and context after each language to prevent contamination or carry-over.
ALWAYS use %variable% format:
// ✅ CORRECT
'gs_PasswordLength' => 'Пароль: %length% из %max% символов'
// ❌ WRONG
'gs_PasswordLength' => 'Пароль: {length} из {max} символов'
Keep these unchanged across ALL languages:
SIP, IAX, AMI, AJAM, PJSIP, NAT, STUN, TURN, RTP, CDR, IVR,
DID, CID, DTMF, codec, trunk, extension, IP, DNS, VPN
Example:
// Russian
'pr_SipProviderSettings' => 'Настройки SIP провайдера'
// Thai - SIP stays the same
'pr_SipProviderSettings' => 'การตั้งค่าผู้ให้บริการ SIP'
Escape quotes properly for PHP:
// ✅ CORRECT
'msg_Example' => 'He said: "Don\'t forget"'
// ❌ WRONG - breaks PHP
'msg_Example' => 'He said: "Don't forget"'
All languages MUST have:
Example: If Russian has 157 keys in ApiKeys.php, ALL 28 other languages must have exactly 157 keys in ApiKeys.php.
Files are automatically processed in batch mode when they have:
Automatic Detection:
# Check if file needs batching
php .claude/skills/translations/helpers/translation-batch-manager.php analyze src/Common/Messages/ru/Common.php en
Key Thresholds:
When translating large files, follow this sequential batch workflow:
1. Analysis Phase:
# Analyze target file to determine batching strategy
php translation-batch-manager.php analyze src/Common/Messages/ru/RestApi.php en
Output tells you:
2. Split Phase:
# Create batches (saved to .claude/temp/batches/)
php translation-batch-manager.php split src/Common/Messages/ru/RestApi.php en 100
Creates JSON files:
.claude/temp/batches/en_RestApi/batch_1.json (keys 1-100).claude/temp/batches/en_RestApi/batch_2.json (keys 101-200)3. Translation Phase (Repeat for each batch):
For each batch file:
keys object (Russian key-value pairs)%placeholder% format identical4. Merge Phase (After each batch translation):
# Merge translated batch into target file
php translation-batch-manager.php merge src/Common/Messages/en/RestApi.php batch_1_translated.json
This command:
5. Validation Phase (After each merge):
# Validate merged result
php translation-batch-manager.php validate src/Common/Messages/en/RestApi.php src/Common/Messages/ru/RestApi.php
Checks:
6. Context Reset: After completing each batch:
Input batch JSON:
{
"batch_num": 1,
"total_batches": 20,
"keys": {
"rest_ApiKeys_ApiDescription": "Comprehensive API key management...",
"rest_Extensions_CreateEndpoint": "Create a new PBX extension...",
...
}
}
Translate keys → Save as batch_1_translated.json:
{
"batch_num": 1,
"total_batches": 20,
"keys": {
"rest_ApiKeys_ApiDescription": "Comprehensive API key management...",
"rest_Extensions_CreateEndpoint": "Create a new PBX extension...",
...
}
}
Merge into target file:
php translation-batch-manager.php merge src/Common/Messages/en/RestApi.php batch_1_translated.json
When processing large files, create detailed task lists:
[1/28] English (en) - RestApi.php
[1/20] ✓ Batch 1 (keys 1-100) - Translated & merged
[2/20] ⏳ Batch 2 (keys 101-200) - In progress
[3/20] ⏸ Batch 3 (keys 201-300) - Pending
...
[20/20] ⏸ Batch 20 (keys 1901-1962) - Pending
[2/28] German (de) - RestApi.php
[1/20] ⏸ Batch 1 (keys 1-100) - Pending
...
PHP Syntax Error in Merged File:
Key Count Mismatch After Merge:
Placeholder Format Error:
Commands:
# Analyze file
php translation-batch-manager.php analyze <ru_file> <target_lang>
# Split into batches
php translation-batch-manager.php split <ru_file> <target_lang> [batch_size]
# Merge batch
php translation-batch-manager.php merge <target_file> <batch_json>
# Validate result
php translation-batch-manager.php validate <target_file> <ru_file>
# Check status
php translation-batch-manager.php status <ru_file> <target_lang>
All commands output JSON for easy parsing by agents.
Batch files are stored in .claude/temp/batches/ (gitignored):
.claude/temp/batches/
├── en_RestApi/
│ ├── batch_1.json
│ ├── batch_2.json
│ └── ...
├── de_Common/
│ ├── batch_1.json
│ └── ...
Quick workflow:
Example:
// ru/ApiKeys.php
return [
// ... existing keys
// API Key Permissions (new feature)
'ak_PermissionsTitle' => 'Разрешения API ключа',
'ak_PermissionRead' => 'Чтение',
'ak_PermissionWrite' => 'Запись',
];
After adding:
IMPORTANT: This workflow supports incremental translation - it translates ONLY missing keys and preserves existing translations.
Quick workflow:
Initial Setup:
ru/ApiKeys.php)/src/Common/Messages/ to detect all language foldersFor EACH of 28 languages (process sequentially):
a) Pre-Translation Analysis:
b) Incremental Translation:
%placeholder% format exactlyc) Merge & Update:
d) Validation:
php -le) Context Reset:
Final Report:
Translation with AI:
%placeholder% formatQuick workflow:
Example report:
✅ en/ApiKeys.php: 157 keys (matches)
✅ es/ApiKeys.php: 157 keys (matches)
⚠️ th/ApiKeys.php: 145 keys (12 missing)
⚠️ ja/ApiKeys.php: 160 keys (3 extra)
Quick workflow:
Quick workflow:
ru/[ModuleName].phpCommon prefixes (see prefixes.md for complete list):
| Prefix | Module | Example |
|---|---|---|
ak_ | API Keys | ak_AddNewApiKey |
ex_ | Extensions | ex_AddNewExtension |
pr_ | Providers | pr_SipProviderSettings |
gs_ | General Settings | gs_PasswordLength |
api_ | REST API messages | api_UnknownError |
Suffix patterns:
_Validate - Validation rules_Error - Error messages_Tooltip - UI tooltips_header / _desc - Structured contentMikoPBX supports 29 languages. See language-codes.md for complete list.
Primary language: Russian (ru) ⭐
Other languages: 28 languages from Azerbaijani to Simplified Chinese
<?php
/**
* API keys translations
*/
return [
// AK - API Keys module prefix
'ak_AddNewApiKey' => 'Добавить API ключ',
'ak_ApiKeyWarning' => 'Сохраните этот ключ сейчас!',
// With placeholders
'ak_ConfirmDelete' => 'Удалить API ключ "{0}"?',
'gs_PasswordLength' => 'Длина: %length% из %max%',
// Tooltip example
'ak_ApiKeyUsageTooltip_header' => 'Использование API ключей',
'ak_ApiKeyUsageTooltip_curl_example' => 'curl -H "Authorization: Bearer KEY" ...',
];
Translations are cached in Redis. After changes:
# Clear Redis cache
docker exec <container_id> redis-cli FLUSHDB
# Or restart container (clears all caches)
docker restart <container_id>
# Browser cache (hard refresh)
Ctrl+Shift+R (Windows/Linux)
Cmd+Shift+R (Mac)
# Count keys in Russian file
php -r "echo count(include 'src/Common/Messages/ru/ApiKeys.php');"
# Compare key counts across languages
for lang in en es fr de; do
echo "$lang: $(php -r "echo count(include 'src/Common/Messages/$lang/ApiKeys.php');")"
done
# Find all translation files for a key
grep -r "ak_ApiKey" src/Common/Messages/
# Check PHP syntax
php -l src/Common/Messages/ru/ApiKeys.php
❌ Breaking PHP syntax with quotes:
// WRONG
'msg' => 'He said: "Don't do this"' // Breaks PHP
// CORRECT
'msg' => 'He said: "Don\'t do this"' // Escaped
❌ Inconsistent placeholders:
// Russian: %username%
// WRONG translation: %user% (different name!)
// CORRECT: %username% (same name)
❌ Translating technical terms:
// WRONG: 'pr_SipSettings' => 'Параметры СИП'
// CORRECT: 'pr_SipSettings' => 'Параметры SIP'
Before finishing translation work:
%variable% format consistentlyphp -l)Always provide clear, structured output:
🎯 Translation Task: [Task Name]
📁 Files Modified:
- ru/ApiKeys.php: +5 keys
- en/ApiKeys.php: +5 keys (translated)
- [... 27 more languages]
📊 Statistics:
- Keys added: 5
- Languages updated: 29
- Files modified: 29
✅ Validation:
- All languages consistent: YES
- Placeholder format correct: YES
- Technical terms preserved: YES
- PHP syntax valid: YES
⚠️ Next Steps:
1. Clear Redis cache
2. Clear browser cache
3. Test translations in UI
4. Commit changes if working
📝 Translation Keys Added:
1. ak_Feature - Feature description
2. ak_FeatureTooltip - Help tooltip
3. ak_ValidateFeature - Validation message
When processing a file, report progress like this:
🎯 Processing: ApiKeys.php
📊 Source (ru): 47 keys found, 0 duplicates
🌐 Target languages: en, de, es, fr, it, nl, pt, th (8 languages)
[1/8] 🇬🇧 English (en)
✓ Pre-analysis: 5 missing keys, 2 obsolete keys
✓ Translation: 5 keys translated
✓ Merge: Updated with new keys, removed obsolete
✓ Validation: 47 keys (matches source)
✓ Context reset: Done
[2/8] 🇩🇪 German (de)
✓ Pre-analysis: 3 missing keys, 1 obsolete key
✓ Translation: 3 keys translated
✓ Merge: Updated with new keys, removed obsolete
✓ Validation: 47 keys (matches source)
✓ Context reset: Done
... continue for each language ...
✅ Final Summary:
- Languages processed: 8/8
- Total keys added: 28
- Total keys removed: 10
- All languages validated: YES
- Cache cleared: Reminder sent
Detailed References:
External Links:
This skill activates when you say:
Remember:
Translation management for MikoPBX international development team 🌍