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 e.g. https://github.com/squigglybob/disciple-tools-prayer-campaigns/settings
    2. click on webhooks
    3. add new webhook with the url https://translate.disciple.tools/hooks/github ( You can use the default options other than the url )
  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
flowchart TD
Developers:::green --1. "release \(push e.g. 1.2.3 tag\)"--> R([Repository])
R -. 2. Update translations .-> R
R --3. Pull--> W([Weblate])
W --4. Notifies-->T[Translators]:::green
T --5. Translate--> W
W --6. Push--> R
classDef green fill:#144C3E, color:#FFF
Loading

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 )

When the .pot file changes in the master branch, the webhook will notify weblate to pull the new translation changes from this release

Once they are translated in weblate, they will go into a PR that you can merge back into master when you are ready.

You can then either merge them in and create a point release with the translations merged in or just merge them in for the next release that you have planned.

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