Send the remaining interface text through the catalog and audit it
Phase 4f. - scripts/i18nAudit.mjs runs in pnpm check. It fails for a key that the catalog does not have, a catalog key that the code does not use, and a row without all four languages. - message() marks a key that a variable carries to the translation call later: table formats, formula errors, and browser status messages. - 53 new rows with French, Japanese, and Simplified Chinese text for the status and error messages of the workbench, the tree, Settings, theme import, images, the built-in browser, and code blocks. The backlinks toggle now translates too. - 13 unused rows are gone. - Errors of the plugin API stay in English. docs/development.md has the rule in "Interface text". pnpm check, pnpm test (350 of 350), and the full smoke suite pass, except two tests that failed one time under load and passed on retry and 3 of 3 times alone.
This commit is contained in:
+15
-2
@@ -170,14 +170,15 @@ Run these commands from the repository folder. They do not need an installer.
|
||||
|
||||
| Command | Checks |
|
||||
| --- | --- |
|
||||
| `pnpm check` | Svelte and TypeScript types of the app, the unit tests (`tests/tsconfig.json`), the plugin SDK, and the example plugin |
|
||||
| `pnpm check` | Svelte and TypeScript types of the app, the unit tests (`tests/tsconfig.json`), the plugin SDK, and the example plugin. Then the catalog audit. See [Interface text](#interface-text). |
|
||||
| `pnpm test` | Unit tests in `tests/unit/` |
|
||||
| `cargo test --manifest-path src-tauri/Cargo.toml --lib` | Rust unit tests |
|
||||
| `pnpm smoke` | Browser smoke tests. See [Browser smoke tests](#browser-smoke-tests). |
|
||||
| `pnpm build` | The production frontend build |
|
||||
| `pnpm check:menus` | The inventory of menu surfaces. See [Interface design](ui-design.md). |
|
||||
|
||||
To run one test file, use `node --experimental-strip-types --test tests/unit/tables/selection.spec.ts`.
|
||||
To run one test file, use `node --experimental-strip-types --import ./tests/unit/_svelte/register.mjs --test tests/unit/tables/selection.spec.ts`.
|
||||
The `--import` hook compiles `.svelte.ts` modules, so a test can import them.
|
||||
For type errors while you edit, run `pnpm check:watch`.
|
||||
|
||||
Some tests need files from outside this repository. Without those files, the tests skip and state the reason:
|
||||
@@ -185,6 +186,18 @@ Some tests need files from outside this repository. Without those files, the tes
|
||||
- `tests/unit/release/installerVersion.spec.ts` needs the NSIS compiler that the Tauri CLI downloads on Windows.
|
||||
- The Rust terminal tests start the real shells on the computer.
|
||||
|
||||
### Interface text
|
||||
|
||||
All text that a user reads goes through the catalog in `src/lib/i18n/messages.ts`. Each row has the English key and the French, Japanese, and Simplified Chinese text.
|
||||
|
||||
1. Translate the text with `$t("…")` in a Svelte component or `tr("…")` in a TypeScript module.
|
||||
2. For a value in the text, use a placeholder: `tr("Created {path}", { path })`. Do not join strings.
|
||||
3. When a variable carries a key to the call, mark the key where you write it: `message("Bold")`.
|
||||
4. Add a catalog row with all four languages.
|
||||
|
||||
Errors of the plugin API stay in English, because they are for plugin developers.
|
||||
`pnpm check` runs `scripts/i18nAudit.mjs`. It fails for a key that the catalog does not have, a catalog key that the code does not use, and a row without all translations.
|
||||
|
||||
## Plugin SDK
|
||||
|
||||
The plugin SDK in `packages/plugin-sdk/` is the only source of the public plugin types.
|
||||
|
||||
Reference in New Issue
Block a user