Add section on cmd/translate

This commit is contained in:
Elara 2023-01-13 22:25:58 -08:00
parent f91face206
commit 37f1de4ed9
1 changed files with 25 additions and 1 deletions

View File

@ -33,4 +33,28 @@ tr := translate.New(cat)
out := tr.TranslateTo("First test", language.Russian) // out == "Первая проверка"
```
The checksum is calculated from `"First test"`.
The checksum is calculated from `"First test"`.
### `cmd/translate`
The `cmd/translate` package contains a command that helps with creating translation files.
To generate IDs corresponding to the value fields in a file, run the following:
```shell
translate gen-id <file>
```
To test your translations, run:
```shell
translate translate <dir> <lang> <string>
```
For example,
```shell
translate translate ./testdata ru "First test"
```
This should output `Первая проверка`.