cli: make messages/ part of the configurable --pattern flag

Moves the messages/ path segment from being hardcoded into the export
and import commands to being part of the pattern itself. The default
pattern is now messages/{id}.{lang}.json, giving full control over the
directory structure under the translations output directory.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Patrik Oldsberg
2026-02-18 12:32:51 +01:00
parent a808c9ef3f
commit dd5f052017
6 changed files with 29 additions and 36 deletions
+3 -3
View File
@@ -382,7 +382,7 @@ const app = createApp({
#### Custom file patterns
By default, message files use the pattern `{id}.{lang}.json` (e.g. `catalog.en.json`). You can change this with the `--pattern` option:
By default, message files use the pattern `messages/{id}.{lang}.json` (e.g. `messages/catalog.en.json`). You can change this with the `--pattern` option:
```bash
yarn backstage-cli translations export --pattern '{lang}/{id}.json'
@@ -391,8 +391,8 @@ yarn backstage-cli translations export --pattern '{lang}/{id}.json'
This produces a directory structure grouped by language instead:
```text
translations/messages/en/catalog.json
translations/messages/zh/catalog.json
translations/en/catalog.json
translations/zh/catalog.json
```
The pattern is stored in the manifest, so the `import` command automatically uses the same layout.