docs: document plugin localization contract

This commit is contained in:
mirivlad 2026-07-11 12:45:09 +08:00
parent 9b3f3b6afc
commit acabe340e9
2 changed files with 41 additions and 1 deletions

View File

@ -46,6 +46,13 @@ official.notes/
"apiVersion": "1",
"description": "Markdown notes inside Verstak cases.",
"source": "official",
"localization": {
"defaultLocale": "en",
"locales": {
"en": "locales/en.json",
"ru": "locales/ru.json"
}
},
"provides": [
"workspace.notes",
"entity.note"
@ -85,6 +92,35 @@ official.notes/
}
```
### 3.1. Локализация
Локализуемый плагин объявляет собственные JSON-каталоги в `localization`.
Пути должны быть относительными, использовать `/` и оставаться внутри каталога
плагина. Все значения каталога — строки. Литеральные английские значения в
manifest остаются fallback, а переводы metadata используют стабильные ключи:
```text
manifest.name
manifest.description
contributions.views.<id>.title
contributions.commands.<id>.title
contributions.statusBarItems.<id>.label
```
Внутренний UI плагина получает текущий язык только через публичный API:
```js
const locale = api.i18n.getLocale();
const title = api.i18n.t('ui.title', undefined, 'Notes');
const unsubscribe = api.i18n.onDidChangeLocale(nextLocale => {
// Обновить текст без перемонтирования компонента и потери состояния.
});
```
Desktop поддерживает `system`, `en` и `ru`. В режиме `system` локали `ru-*`
выбирают русский язык, остальные — английский. Плагин отвечает за свои
переводы; desktop core не содержит тексты официальных плагинов.
## 4. Capabilities Instead Of Plugin Names
Плагины не должны требовать конкретный плагин, если им нужна способность.
@ -306,4 +342,3 @@ official.notes-0.1.0.vpkg
- checksums/signature later.
На первом этапе допустима ручная установка папкой в plugin directory.

View File

@ -41,6 +41,9 @@ Implemented:
- browser inbox local receiver and minimal official Browser Inbox plugin;
- sync server with device/user auth and operation push/pull;
- SDK manifest/types/schema coverage for current plugin APIs;
- persisted System/English/Russian application language selection, localized
desktop shell, public `api.i18n` plugin contract, and bilingual catalogs for
all official plugins;
- automated Go, frontend, official plugin, SDK, and real-sync smoke checks.
Known remaining gaps:
@ -67,6 +70,8 @@ Known remaining gaps:
records conversions. Chunked large-file attachment capture remains future
work.
- Packaging/update/release workflow is not product-grade yet.
- Browser extension UI localization is not yet migrated to the shared
multilingual product policy.
## 4. Implementation Phases