NextCloud is using transifex for localization and it looks like most apps do the same. Although there is no direct support for Weblate, the transifex scripts can also be used for Weblate.
A i18n directory is added and contains:
- A Makefile where make -C i18n run
- extracts the strings to be translated and updates the ranslationfiles/templates/enough.pot file
- converts the translationfiles/*/enough.po translations into NextCloud .js/.json files in the l10n directory.
- A Dockerfile used by the Makefile to install the dependencies. It is run as the local user and with the current directory mounted as a volume.
A SSH key is created for weblate
The GitLab host is added to the list of hosts known by weblate
A new GitLab user named weblate is created and the SSH public key added to the settings:
The GitLab weblate user is granted maintainer rights to the repository so that it can own the translationfiles and push updated .po files in the master branch whenever a new translation is available.
A new Weblate component is created for the app, with the following configuration:
- Component name: NextCloud
- Project: Enough
- Version control system: git
- Source code repository: https://lab.enough.community/main/app.git (the .git at the end is important for the webhook to work)
- Repository push URL: email@example.com:main/app.git
- Repository browser: https://lab.enough.community/main/app/blob/%(branch)s/%(file)s#L%(line)s
- Repository branch: master
- File mask: translationfiles/*/enough.po
- Base file for new translations: translationfiles/templates/enough.pot
- File format: Gettext PO files
- Committer name: Enough Community
- Committer email: firstname.lastname@example.org
Add a new translation
Verify a directory by the language name is pushed by weblate into the master branch of the repository.
Create a push webhook in the GitLab project and set it to https://weblate.enough.community/hooks/gitlab/ so weblate is notified when new commits are pushed in the repository.
Activate the Update PO files to match POT addon to Weblate.