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:
@@ -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.
|
||||
|
||||
@@ -447,8 +447,9 @@ Usage: backstage-cli translations export [options]
|
||||
|
||||
Options:
|
||||
--output <dir> Output directory for exported messages and manifest (default: "translations")
|
||||
--pattern <pattern> File path pattern for message files, with {id} and {lang}
|
||||
placeholders (default: "{id}.{lang}.json")
|
||||
--pattern <pattern> File path pattern for message files relative to the output
|
||||
directory, with {id} and {lang} placeholders
|
||||
(default: "messages/{id}.{lang}.json")
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user