This Action generates the .pot, .po, and .mo files for your WordPress plugin or theme repository.
GITHUB_TOKEN
Secrets are set in your repository settings. They cannot be viewed once stored.
| Key | Default | Description |
|---|---|---|
destination_path |
./languages |
Destination path to save generated files. |
slug |
The GitHub repository name | Plugin or theme slug. |
text_domain |
The plugin or theme slug | Text domain to look for in the source code. |
generate_pot |
1 |
Whether to generate the .pot file. |
generate_po |
0 |
Whether to generate the .po file. |
generate_mo |
0 |
Whether to generate the .mo file. |
generate_lang_packs |
0 |
Whether to generate the .po/.mo language packs. |
merge_changes |
0 |
Whether to merge changes with existing files. |
headers |
{} |
Additional headers in JSON format to use when generating files. |
To get started, you will want to copy the contents of one of these examples into .github/workflows/generate-translations.yml and push that to your repository. You are welcome to name the file something else.
This only generates the .pot file in the /languages folder.
name: Generate Translations
on:
push:
branches:
- develop
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
generate-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: WordPress POT/PO/MO Generator
uses: strangerstudios/action-wp-pot-po-mo-generator@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}name: Generate Translations
on:
push:
branches:
- develop
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
generate-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: WordPress POT/PO/MO Generator
uses: strangerstudios/action-wp-pot-po-mo-generator@main
with:
destination_path: './languages'
slug: 'SLUG_OF_PLUGIN_OR_THEME'
text_domain: 'TEXT_DOMAIN_OF_PLUGIN_OR_THEME'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}For more details of how to use this action on demand, read up on Manual Triggers.
name: Generate Translations
on: workflow_dispatch
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
generate-translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: WordPress POT/PO/MO Generator
uses: strangerstudios/action-wp-pot-po-mo-generator@main
with:
destination_path: './languages'
slug: 'SLUG_OF_PLUGIN_OR_THEME'
text_domain: 'TEXT_DOMAIN_OF_PLUGIN_OR_THEME'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}This action is based on this script by Theunis Coetzee (@ipokkel) and this action by Dharmesh Patel (@iamdharmesh)