Skip to content

Commit 61ed86a

Browse files
committed
Document supported language formats (#4)
This closes DEV-7.
1 parent a2a3ddd commit 61ed86a

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ For improved results, consider refining your prompt, using a higher-tier model,
3232
* [WordPress plugin](#wordpress-plugin)
3333
* [JSON output](#json-output)
3434
* [📖 CLI Options Reference](#-cli-options-reference)
35+
* [🌍 Supported Languages](#-supported-languages)
3536
* [⚙️ Configuration Files](#-configuration-files)
3637
* [📜 Available Scripts](#-available-scripts)
3738
* [🧪 A/B Testing for Prompt Optimization](#-ab-testing-for-prompt-optimization)
@@ -241,7 +242,7 @@ Using this example, "Block Editor" and other terms will not be translated to tar
241242

242243
| Option | Short | Description | Default |
243244
| -------------------------------- | ----- | --------------------------------------------------------------- | ------- |
244-
| `--target-languages <languages>` | `-l` | Target locale codes, comma-separated (e.g., fr_FR, es_ES, de_DE) | - |
245+
| `--target-languages <languages>` | `-l` | Target language codes, comma-separated. **Accepts multiple formats**: WordPress locale (`fr_FR`, `es_ES`), ISO 639-1 (`fr`, `es`), ISO 639-2 (`fra`, `spa`), or language names (`French`, `Spanish`). See [supported languages](#supported-languages) below. | - |
245246
| `--pot-file-path <path>` | `-p` | Path to the input `.pot` file containing source strings | - |
246247
| `--api-key <key>` | `-k` | Provider API key (5-tier precedence: CLI > `POTOMATIC_<PROVIDER>_API_KEY` > `<PROVIDER>_API_KEY` > `POTOMATIC_API_KEY` > `API_KEY`) | - |
247248

@@ -270,7 +271,7 @@ Using this example, "Block Editor" and other terms will not be translated to tar
270271
| `--output-format <format>` | - | Output format: `console` or `json` (default: console) | `console` |
271272
| `--output-file <path>` | - | Path to save JSON output (use stdout if not provided) | - |
272273
| `--po-file-prefix <prefix>` | - | Prefix for each output `.po` file (e.g., "app-" → "app-fr_FR.po") | - |
273-
| `--locale-format <format>` | - | Format to use for locale codes in file names: `wp_locale` (ru_RU), `iso_639_1` (ru), `iso_639_2` (rus), or `target_lang` (default) | `target_lang` |
274+
| `--locale-format <format>` | - | **Controls output filename format only** (not input). Options: `wp_locale` (ru_RU), `iso_639_1` (ru), `iso_639_2` (rus), or `target_lang` (uses input format as-is) | `target_lang` |
274275

275276
### Translation Behavior
276277

@@ -332,6 +333,43 @@ Using this example, "Block Editor" and other terms will not be translated to tar
332333

333334
---
334335

336+
## 🌍 Supported Languages
337+
338+
**Potomatic** supports a wide range of languages (including regional variants) and accepts multiple input formats. You can specify target languages using any of the following formats:
339+
340+
### Input Formats (for `--target-languages`)
341+
342+
- **WordPress locale format**: `fr_FR`, `es_ES`, `de_DE`, `pt_BR`, `zh_CN`
343+
- **ISO 639-1 codes** (2-letter): `fr`, `es`, `de`, `pt`, `zh`
344+
- **ISO 639-2 codes** (3-letter): `fra`, `spa`, `deu`, `por`, `zho`
345+
- **BCP-47 format** (with dash): `fr-FR`, `es-ES`, `de-DE`
346+
- **Language names**: `French`, `Spanish`, `German`, `Portuguese`, `Chinese`
347+
348+
**Example**: All of the following specify French:
349+
```bash
350+
./potomatic -l fr_FR -p translations.pot
351+
./potomatic -l fr -p translations.pot
352+
./potomatic -l fra -p translations.pot
353+
./potomatic -l "French" -p translations.pot
354+
```
355+
356+
### Output Formats (for `--locale-format`)
357+
358+
Control how language codes appear in output filenames:
359+
360+
- `target_lang` (default): Uses the format you provided (e.g., `fr``fr.po`, `fr_FR``fr_FR.po`)
361+
- `wp_locale`: WordPress format with region (e.g., `fr_FR.po`, `es_ES.po`)
362+
- `iso_639_1`: 2-letter ISO codes (e.g., `fr.po`, `es.po`)
363+
- `iso_639_2`: 3-letter ISO codes (e.g., `fra.po`, `spa.po`)
364+
365+
### Complete Language List
366+
367+
For a full list of supported languages and their corresponding codes, see the [language mapping reference](src/utils/languageMapping.js). The mappings are based on [GlotPress locale data](https://github.com/GlotPress/GlotPress/blob/develop/locales/locales.php) from WordPress.org's translation platform.
368+
369+
**Major supported languages include**: Afrikaans, Arabic (multiple variants), Bengali, Chinese (Simplified/Traditional), Czech, Danish, Dutch, English (multiple variants), French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Persian, Polish, Portuguese (Brazil/Portugal), Romanian, Russian, Spanish (multiple variants), Swedish, Thai, Turkish, Ukrainian, Vietnamese, and more.
370+
371+
---
372+
335373
## ⚙️ Configuration Files
336374

337375
**Potomatic** uses several configuration files in the `config/` directory to customize its behavior:

0 commit comments

Comments
 (0)