39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
# Translation Tool
|
|
|
|
Runtime label translation for ASM UI (`asm_ui_app`) using Frappe **Translation** doctype records.
|
|
|
|
## Features
|
|
|
|
- Bulk API: flat `{ source_text: translated_text }` map for a language
|
|
- Client-side `label_translator.js` replaces hardcoded English labels/sections when Arabic is active
|
|
- Cache invalidation when Translation records change
|
|
|
|
## Install
|
|
|
|
```bash
|
|
cd ~/frappe-bench
|
|
bench get-app translation_tool # if not already in apps/
|
|
bench --site <site> install-app translation_tool
|
|
bench build --app translation_tool
|
|
bench --site <site> clear-cache
|
|
```
|
|
|
|
Ensure `translation_tool` is listed in `sites/<site>/apps.txt` after install.
|
|
|
|
## Translation records
|
|
|
|
Create rows in **Translation** doctype:
|
|
|
|
| language | source_text | translated_text |
|
|
|----------|-------------|-----------------|
|
|
| ar | Asset Information | معلومات الأصل |
|
|
| ar | Workflow Actions | إجراءات سير العمل |
|
|
|
|
`source_text` must match the visible English UI string exactly.
|
|
|
|
## API
|
|
|
|
- `translation_tool.api.translations.get_translations?language=ar`
|
|
- `translation_tool.api.translations.get_translation?source_text=...&language=ar`
|
|
- `translation_tool.api.translations.get_available_languages`
|