-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
# Traduire CLI interface | ||
|
||
First, install it: | ||
First, install the client program. The `trd` program is contained in the | ||
`traduire-cli` package. I recommend using [pipx](https://pipx.pypa.io/stable/) | ||
or something comparable: | ||
|
||
pipx install traduire-cli | ||
|
||
You need a configuration file, `~/.config/traduire.toml` which contains one or | ||
more records of the following form: | ||
|
||
[[project]] | ||
name = "..." | ||
token = "..." | ||
url = "https://traduire.example.com" | ||
name = "Project name" | ||
token = "asdf...-1" | ||
url = "https://traduire.example.com/api/pofile/project-name/" | ||
path = "..." | ||
|
||
The name, token, and URL are taken from your Traduire installation. The path is | ||
the folder where your local checkout of the project resides. | ||
the folder where your local checkout of the project resides. The `trd` client | ||
uses the configured path to automatically find the correct settings. Right now | ||
there's no support forspecifying the necessary token and URL parameters | ||
directly. (Contributions would be very welcome for this! I think the CLI should | ||
be rewritten to use [Click](https://click.palletsprojects.com/) under the | ||
hood.) | ||
|
||
Then, assuming you have your gettext `.po` files inside `project/locale` you | ||
can do this to get the pofiles from remote or send your local pofiles to the | ||
remote: | ||
you should first ensure that they are up-to-date: | ||
|
||
python manage.py makemigrations -a | ||
|
||
Next, you can upload the pofiles to the Traduire server. All `trd` invocations | ||
automatically find all `*.po` files in the provided folder and act on all of | ||
them. | ||
|
||
# Find local pofiles, and fetch updates from the server for each of them: | ||
trd get project/locale | ||
# Submit all local pofiles to the server so that new strings can be translated: | ||
trd submit project/locale | ||
# Replace pofiles on the server: | ||
|
||
After translating everything you can fetch all updates from the server: | ||
|
||
trd get project/locale | ||
|
||
You probably want to compile the catalogs now: | ||
|
||
python manage.py compilemessages | ||
|
||
Submitting pofiles only uses the `msgid` values (it does the same thing | ||
`msgmerge` does by default). Also, it doesn't delete obsolete strings. If you | ||
know what you're doing you can replace the `.po` files on the server: | ||
|
||
trd replace project/locale |