WordPress Plugin Translations
Manage internationalization (i18n) for WordPress plugins by extracting, translating, and compiling translation files.
Workflow
- Build scripts: Build the scripts using
npm run build - Validate setup: Read
languages/to check existing translation files - Extract strings: Run
composer run i18n:extractto generate.potand update.pofiles - Translate: Based on arguments:
- No arguments: Update existing
.pofiles with missing translations. Check the files for untranslated strings and provide translations. - With languages (e.g.,
de_DE fr_FR): Create.pofiles for specified languages if missing, then translate
- No arguments: Update existing
- Compile: Run
composer run i18n:compileto generate.mo,.json, and.phpfiles
Translation Guidelines
- Use one subtask/subagent per
.pofile for parallel processing - Ensure textdomain matches the one defined in main plugin file
- Requires
wp-cliand a working WordPress installation
Reference
For detailed i18n documentation, see i18n.