Complete Commonlib rc.6 integration and setup workflows

This commit is contained in:
vorotamoroz
2026-07-21 15:00:28 +00:00
parent e005f9eb13
commit 1ef8c88139
150 changed files with 31041 additions and 260 deletions
+29 -25
View File
@@ -1,34 +1,38 @@
# How to add translations
Self-hosted LiveSync owns its multilingual catalogue. Commonlib supplies only the typed English messages which its services request; the plug-in combines those keys with its application messages and injects the selected translator at each service composition root.
## Getting ready
1. Clone the Commonlib repository, which owns the translation catalogue.
```sh
git clone https://github.com/vrtmrz/livesync-commonlib
```
2. Make `ls-debug` folder under your vault's `.obsidian` folder (as like `.../dev/.obsidian/ls-debug`).
1. Clone this repository.
## Add translations for already defined terms
```sh
git clone https://github.com/vrtmrz/obsidian-livesync
cd obsidian-livesync
npm ci
```
1. Install dependencies, and build the plug-in as dev. build.
```sh
cd livesync-commonlib
npm ci
npm run i18n:bake
```
2. Create an `ls-debug` directory below the test Vault's `.obsidian` directory, for example `.obsidian/ls-debug`.
2. Install the resulting packed Commonlib artefact in a Self-hosted LiveSync development checkout, build the plug-in, copy `main.js` to `.obsidian/plugins/obsidian-livesync` in your test Vault, and run Self-hosted LiveSync.
3. You will get the `missing-translation-yyyy-mm-dd.jsonl`, please fill in new translations.
4. Build the plug-in again, and confirm that displayed things were expected.
5. Add the translations to the Commonlib catalogue, run `npm run i18n:bake`, and make the pull request to `https://github.com/vrtmrz/livesync-commonlib`.
## Add translations for existing messages
## Make messages to be translated
1. Edit the human-readable YAML files under `src/common/messagesYAML/`.
2. Regenerate the JSON and TypeScript resources.
1. Find the message that you want to be translated.
2. Change the literal to use `$tf`, like below.
```diff
- Logger("Could not determine passphrase to save data.json! You probably make the configuration sure again!", LOG_LEVEL_URGENT);
+ Logger($tf('someKeyForPassphraseError'), LOG_LEVEL_URGENT);
```
3. Make the PR to `https://github.com/vrtmrz/obsidian-livesync`.
4. Follow the steps of "Add translations for already defined terms" to add the translations.
```sh
npm run i18n:bake
```
3. Build the plug-in in development mode, install it in the test Vault, and run Self-hosted LiveSync.
4. Review any `missing-translation-yyyy-mm-dd.jsonl` file written below `.obsidian/ls-debug`, and add the required translations to the YAML catalogue.
5. Bake and build again, then confirm the displayed text and placeholder substitution in the relevant workflow.
Commit the edited YAML and all regenerated JSON and TypeScript resources together.
## Make a message translatable
1. Add its canonical English entry and translations to `src/common/messagesYAML/`.
2. Replace the source literal with `$msg()` or another existing translation helper, using the English catalogue key as the typed contract.
3. Run `npm run i18n:bake`, build the plug-in, and verify the affected workflow.
When a new message belongs to Commonlib rather than the application, add its canonical English definition and key type in Commonlib first. Add any available translations to LiveSync when consuming that package; untranslated languages use Commonlib's canonical English fallback.