Skip to content

Commit

Permalink
Improve the CLI README
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jul 6, 2024
1 parent 082ebe8 commit 74c09ab
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions cli/README.md
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

0 comments on commit 74c09ab

Please sign in to comment.