translating-javascript-strings.md
1.11 KB
1. Preparation
- Run
npm install. - For good measure, in the
package.json, run this check:- Look for occurrences of
GETTEXT_DOMAIN=. - Check that, after the "=" there is the current plugin's text domain (e.g.
sitepressfor wpml-core). If not, fix it.
- Look for occurrences of
- Check that the
.gitignorefile of the project contains this line:/locale/jed/**/*.po.
Note that, since WPML-Core embeds Translation Management as a Composer plugin, in package.json, you must have two occurrences of GETTEXT_DOMAIN: one for Core and another for TM.
2. Generating or updating the POT files
Run npm run strings:update-pot.
This command will generate or update the POT files for each JS app in /locale/jed/pot.
You can send these files for translation.
3. Updating the translations
- Save the completed translations in
/locale/jed/po. - Run
npm run strings:jedto generate the JED files in/locale/jed. - Test the translations.
- Commit the changes.
4. Additional notes
When committing the changes, you should only commit the POT and JED files (respectively, `/locale/jed/pot/*.pot and /locale/jed/*.json).