Skip to content

Setting up translation for plugin

squigglybob edited this page Oct 7, 2022 · 20 revisions

Plugin/Theme maintainer

  1. copy the translations.yml workflow from the starter plugin into your plugin/theme under .github/workfrows/translations.yml if it's not already there
  2. edit the translations.yml workflow where indicated in the file
  3. create a webhook on the repository, to fire when a push is made, with the url https://translate.disciple.tools/hooks/github
    1. Go to repository settings
    2. click on webhooks
    3. add new webhook with the url above
  4. Send the following details to the weblate admin so that they can add your repository to the translation software
    • name of the plugin/theme
    • https url of your repository
    • the name of your master branch ( if not master, e.g. main )
    • location of your .pot file

The .pot file in your languages directory will be updated by the translations workflow when a release of your plugin is made (unless you modified the workflow to run on a different trigger)

( A new release is triggered when a new . tag is pushed to the repo )

This will trigger weblate to recieve any new strings that you might have made in this release. Once they are translated you can either wait until the next release to merge them into the next release or create a point release with the translations merged in.

Weblate admin

Add new component to weblate with the details given for the repository.

Version Control System: Github Pull Request

Source Code repository: repo https url

Repository branch: master (or the branch given by the plugin maintainer)

Leave the push url and branch empty, so that weblate will create a PR from a fork that it will make.

Once weblate has successfully connected to the repo: Make sure that the mask is correct for where the translation files need to go. Double check that the "Template for new translations" points to the correct location of the .pot Make any other changes necessary.

After weblate has added the component: Add any Add-ons needed for this component

e.g.

  1. Machine Translation
    1. Add Weblate translation memory
    2. Add google translate
  2. Generate .mo files
  3. Update .po files to match .pot files

Things already done to make the fork and PRs work

Clone this wiki locally