Skip to content

Commit

Permalink
Closes #16903: Update release process to use Transifex CLI client (#1…
Browse files Browse the repository at this point in the history
…7916)

* Closes #16903: Update release process to use Transifex CLI client

* Add token environment variable to tx command
  • Loading branch information
jeremystretch authored Nov 7, 2024
1 parent 27d1561 commit 6035ad1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
12 changes: 12 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[main]
host = https://app.transifex.com

[o:netbox-community:p:netbox:r:9cbf4fcf95b3d92e4ebbf1a5e5d1caee]
file_filter = netbox/translations/<lang>/LC_MESSAGES/django.po
source_file = netbox/translations/en/LC_MESSAGES/django.po
type = PO
minimum_perc = 0
resource_name = django.po
replace_edited_strings = false
keep_translations = false

15 changes: 14 additions & 1 deletion docs/development/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,20 @@ This will automatically update the schema file at `contrib/generated_schema.json

### Update & Compile Translations

Updated language translations should be pulled from [Transifex](https://app.transifex.com/netbox-community/netbox/dashboard/) and re-compiled for each new release. Follow the documented process for [updating translated strings](./translations.md#updating-translated-strings) to do this.
Updated language translations should be pulled from [Transifex](https://app.transifex.com/netbox-community/netbox/dashboard/) and re-compiled for each new release. First, retrieve any updated translation files using the Transifex CLI client:

```no-highlight
tx pull
```

Then, compile these portable (`.po`) files for use in the application:

```no-highlight
./manage.py compilemessages
```

!!! tip
Consult the translation documentation for more detail on [updating translated strings](./translations.md#updating-translated-strings) if you've not set up the Transifex client already.

### Update Version and Changelog

Expand Down
21 changes: 13 additions & 8 deletions docs/development/translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,31 @@ To update the English `.po` file from which all translations are derived, use th

Then, commit the change and push to the `develop` branch on GitHub. Any new strings will appear for translation on Transifex automatically.

!!! note
It is typically not necessary to update source strings manually, as this is done nightly by a [GitHub action](https://github.com/netbox-community/netbox/blob/develop/.github/workflows/update-translation-strings.yml).

## Updating Translated Strings

Typically, translated strings need to be updated only as part of the NetBox [release process](./release-checklist.md).

Check the Transifex dashboard for languages that are not marked _ready for use_, being sure to click _Show all languages_ if it appears at the bottom of the list. Use machine translation to round out any not-ready languages. It's not necessary to review the machine translation immediately as the translation teams will handle that aspect; the goal at this stage is to get translations included in the Transifex pull request.

To update translated strings, start by initiating a sync from Transifex. From the Transifex dashboard, navigate to Settings > Integrations > GitHub > Manage, and click the **Manual Sync** button at top right.
To download translated strings automatically, you'll need to:

![Transifex manual sync](../media/development/transifex_sync.png)
1. Install the [Transifex CLI client](https://github.com/transifex/cli)
2. Generate a [Transifex API token](https://app.transifex.com/user/settings/api/)

Enter a threshold percentage of 1 (to ensure all translations are captured) and select the `develop` branch, then click **Sync**. This will initiate a pull request to GitHub to update any newly modified translation (`.po`) files.
Once you have the client set up, run the following command:

!!! tip
The new PR should appear within a few minutes. If it does not, check that there are in fact new translations to be added.
```no-highlight
TX_TOKEN=$TOKEN tx pull
```

![Transifex pull request](../media/development/transifex_pull_request.png)
This will download all portable (`.po`) translation files from Transifex, updating them locally as needed.

Once the PR has been merged, the updated strings need to be compiled into new `.mo` files so they can be used by the application. Update the `develop` branch locally to pull in the changes from the Transifex PR, then run Django's [`compilemessages`](https://docs.djangoproject.com/en/stable/ref/django-admin/#django-admin-compilemessages) management command:
Once retrieved, the updated strings need to be compiled into new `.mo` files so they can be used by the application. Run Django's [`compilemessages`](https://docs.djangoproject.com/en/stable/ref/django-admin/#django-admin-compilemessages) management command to compile them:

```nohighlight
```no-highlight
./manage.py compilemessages
```

Expand Down
Binary file removed docs/media/development/transifex_pull_request.png
Binary file not shown.
Binary file removed docs/media/development/transifex_sync.png
Binary file not shown.

0 comments on commit 6035ad1

Please sign in to comment.