Skip to content

Add dprint step to TRANSLATIONS.md #1363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions TRANSLATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ directory. The `.po` files are small text-based translation databases.

> **Important:** If you are planning to use [Poedit](https://poedit.net/) as
> suggested above, make sure to follow the
> [additional configuration steps](#Additional-Configuration-for-Poedit) below
> [additional configuration steps](#additional-configuration-for-poedit) below
> to ensure the `.po` file is correctly formatted.

There is a `.po` file for each language. They are named after the [ISO 639]
Expand All @@ -32,15 +32,35 @@ GNU Gettext utilities below.

## Preparation

You will need the [Gettext] utilities (`msginit`, `msgmerge`). Under Debian and
Ubuntu, you can install with:
### Installing Gettext

You will need the [Gettext] utilities (`msginit`, `msgmerge`).

Under Debian and Ubuntu, you can install with:

```shell
sudo apt install gettext
```

On MacOS with [Homebrew](https://brew.sh/), you can install with:

```shell
brew install gettext
```
Comment on lines +45 to +49
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think it would be good to add instructions for MacOS like you do here.


### Installing dprint

We use [dprint](https://dprint.dev/) to format the `.po` files. You can install
with:

```shell
cargo install dprint
```

### Installing mdbook tools

Ensure you can build the book, and that `mdbook serve` works. For this, follow
the instructions in the [README](README.md).
the instructions in the [README](README.md#building).

## Creating and Updating Translations

Expand Down Expand Up @@ -149,6 +169,15 @@ will need to change a few things from their default configuration:

![Poedit Screenshot](poedit-screenshot.png)

### Formatting a Translation

You should run `dprint` on your `.po` file to ensure it is formatted correctly.
You can do this with:

```shell
dprint fmt po/xx.po
```
Comment on lines +172 to +179
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a nice thing to add!


## Using Translations

This will show you how to use the translations to generate localized HTML
Expand Down