Agent Skills
› Dolibarr/dolibarr
› skill-doli-translation
skill-doli-translation
GitHub管理DoliMed项目翻译,规定仅en_US可手动编辑,其他语言通过Transifex同步。提供txpush.sh和txpull.sh脚本说明,用于推送源文件或拉取翻译至本地仓库。
Trigger Scenarios
询问翻译相关流程
需要同步多语言文件
执行txpush或txpull脚本
Install
npx skills add Dolibarr/dolibarr --skill skill-doli-translation -g -y
SKILL.md
Frontmatter
{
"name": "skill-doli-translation",
"license": "MIT",
"description": "Use when asking question on translation or synchronizing translations with Transifex (running the scripts dev\/translation\/txpull.sh and dev\/translation\/txpush.sh). Explains the Transifex workflow: en_US is the only editable source, all other locales are pulled from Transifex.",
"allowed-tools": [
"read_file",
"write_file",
"bash",
"grep"
],
"user-invocable": true
}
Translations management with Transifex (DoliMed)
Golden rule
- Only the
en_USlanguage files are edited by hand:htdocs/projectname/langs/en_US/*.lang. - All other locales (
fr_FR,de_DE, ...) are never edited manually in this repository. They are produced and synchronized by Transifex (external tool). This is the rule stated in the project AGENTS.md ("Internationalisation" section) and it overrides any request to "also add the French translation". - When a new key is needed:
- Add it only to
htdocs/projectname/langs/en_US/<file>.lang(PascalCase key names,Key=English value). - Push the source to Transifex with
txpush.sh(translators translate it there). - Pull the translated key back into the locale files with
txpull.sh.
- Add it only to
- If a French/other-locale string is needed immediately before a pull, it is acceptable to add it manually, but be aware that the next Transifex pull may overwrite it — the authoritative flow remains push/pull.
Transifex project layout
- Organization / project / resources are defined in
.tx/configat the repository root.- Organization:
dolicloud, project:dolimed. - One resource per
.langfile:r:admin,r:cabinetmed, etc. - For each resource:
source_file = htdocs/projectname/langs/en_US/<file>.lang(the reference language)file_filter = htdocs/projectname/langs/<lang>/<file>.lang(where translated files are written)type = MOZILLAPROPERTIES(the .lang formatkey=value)
- Organization:
- The scripts refuse to run if
.tx/does not exist at the repository root (they assume the root as working directory). - Transifex client installation / update (see
dev/translation/README):sudo pip install --upgrade transifex-client - The direct transifex URL to make translations is: https://app.transifex.com/
organizationname/projectname/translate/
dev/translation/txpush.sh — push local files to Transifex
Usage (from the repository root):
./dev/translation/txpush.sh (source|xx_XX) [-r dolimed.<file>] [-f] [--no-interactive]
txpush.sh source→ runstx push -s: pushes the en_US source files to Transifex. This is the command to run after editing en_US files.txpush.sh fr_FR(or anyxx_XX) → loops overhtdocs/projectname/langs/xx_XX/*.langand runstx push --skip -r dolimed.<file> -t -l xx_XXfor each: pushes a local translation file into Transifex as a translation. Only used to feed Transifex with a locally-corrected translation.- A local translation file is skipped if the Transifex side is newer.
-fforces the overwrite of the translation on Transifex (but not the translation memory). -r dolimed.<file>limits the push to one resource, e.g.-r dolimed.cabinetmed.
dev/translation/txpull.sh — pull translated files from Transifex
Usage (from the repository root):
./dev/translation/txpull.sh (all|xx_XX) [-r dolimed.<file>] [-f] [-s]
txpull.sh all→ loops over every directory inhtdocs/projectname/langs/*excepten_USand runstx pull -l <lang>for each: downloads all translated files from Transifex into the local tree.txpull.sh fr_FR(or anyxx_XX) →tx pull -l xx_XX: downloads only that language.- A local file is skipped if the local copy is newer than the Transifex one.
-fforces the local file to be overwritten (does not work withall). -r dolimed.<file>limits the pull to one resource.- The script ends by reminding to also run:
dev/fixaltlanguages.sh fix all(see below).
Complete workflow for a new translation key
Example: add the key DossierMedical=Dossier médical feature string.
- Add the English key to
htdocs/projectname/langs/en_US/projectname.lang. - Commit/push the en_US change following the project git workflow.
- Run
./dev/translation/txpush.sh source -r projectname.modulename(or without-rfor all files). - Wait for translators (or the translation memory) to translate it on Transifex.
- Run
./dev/translation/txpull.sh fr_FR(orall) to get the translated files. - Run
dev/fixaltlanguages.sh fix allto deduplicate entries that already exist in the parent language file.
Related tools in dev/translation/
README— installation of the Transifex client (transifex-clientpip package).strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all]— strips from a secondary language file the entries redundant with its primary file (run fromhtdocs/langs).sanity_check_en_langfiles.php— HTML report checking the en_US language files.autotranslator.php— automatic translation helper.../fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]— deduplicates alternate language files; recommended by txpull.sh after each pull.../fixduplicatelangkey.sh— removes duplicate keys inside language files.
Dolibarr i18n reminders (apply when writing keys)
- Keys use PascalCase (
MyModuleLabel), values are English text. $langs->trans('Key')for direct HTML output,$langs->transnoentities('Key')when the result feeds an escaping/encoding function (PDF, emails).- Language file loaded with
$langs->loadLangs(array("main", "cabinetmed@cabinetmed")). - No hardcoded user-facing strings in PHP — always a trans key.
- Locale files other than en_US must keep
CHARSET=UTF-8on their first line.
Version History
- f924282 Current 2026-10-19 03:57


