mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): add Antigravity host UI localization and language packs
- Add standalone host-i18n language pack manager with GitHub/jsDelivr download, SHA-256 integrity checks, offline light/deep tier switching, and lossless DOM translation over the CDP window bridge - Add Settings -> General host interface language controls, untranslated UI string collector, and loopback-only /api/host-i18n endpoints - Include zh-CN layered language pack assets and source/audit/build scripts under host-i18n/ while keeping the Release ZIP runtime whitelist isolated
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @fileoverview Decoupled HTTP/CDP client for `/api/host-i18n`.
|
||||
* Completely independent from `telemetryStore.js`.
|
||||
*/
|
||||
|
||||
import {
|
||||
HOST_I18N_API_PATH,
|
||||
normalizeHostI18nDepth,
|
||||
normalizeHostI18nLocale,
|
||||
} from '../../shared/host-i18n-protocol.mjs';
|
||||
import { callSidecarApi } from './httpClient.js';
|
||||
|
||||
export async function fetchHostI18nStatus() {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'GET',
|
||||
abortKey: 'host-i18n-get',
|
||||
cdpTimeoutMs: 12000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function refreshHostI18nManifest() {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'POST',
|
||||
body: { action: 'refresh_manifest' },
|
||||
cdpTimeoutMs: 18000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function selectHostI18nLanguage(locale, depth) {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'select',
|
||||
locale: normalizeHostI18nLocale(locale),
|
||||
...(depth !== undefined ? { depth: normalizeHostI18nDepth(depth) } : {}),
|
||||
},
|
||||
cdpTimeoutMs: 22000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateHostI18nDepth(depth) {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'set_depth',
|
||||
depth: normalizeHostI18nDepth(depth),
|
||||
},
|
||||
cdpTimeoutMs: 10000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function installOrUpdateHostI18nPack(locale) {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'update',
|
||||
locale: normalizeHostI18nLocale(locale),
|
||||
},
|
||||
cdpTimeoutMs: 22000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function removeHostI18nPack(locale) {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'remove',
|
||||
locale: normalizeHostI18nLocale(locale),
|
||||
},
|
||||
cdpTimeoutMs: 10000,
|
||||
});
|
||||
}
|
||||
|
||||
export async function collectHostI18nUntranslated() {
|
||||
return callSidecarApi(HOST_I18N_API_PATH, {
|
||||
method: 'POST',
|
||||
body: { action: 'collect_untranslated' },
|
||||
cdpTimeoutMs: 15000,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user