Add i18n foundation and translations (#1027)
* feat: add i18n foundation * feat: localize sessions sidebar * Localize multirun/scheduled tasks and fix dialog dropdown interactions * localize git sidebar surface and add zh-CN keys * feat(ui): localize context panel, diff/plan views, and context sidebar content * fix(config): resolve user config home via fs/home before embedded home * localize header/chat UI and complete model/worktree panel strings * localize worktree + github issue/pr dialog flows * localize settings sections and split settings i18n dictionaries * localize additional settings sections and sidebars * localize more settings pages and dialogs * fix settings select trigger localization * localize tunnel settings ui surface * localize additional settings sections * localize keyboard shortcuts labels in settings * localize terminal and utility dialogs surfaces * feat(i18n): localize remaining UI strings * Add Ukrainian locale * Add Spanish locale * Add Brazilian Portuguese locale * Polish locale translations
This commit is contained in:
committed by
GitHub
parent
87db2ea210
commit
7d7285655d
@@ -197,26 +197,32 @@ const writeTextFile = async (path: string, content: string): Promise<boolean> =>
|
||||
};
|
||||
|
||||
const resolveHomeDirectory = async (): Promise<string | null> => {
|
||||
// VSCode webview sets __OPENCHAMBER_HOME__ to workspace folder (not OS home).
|
||||
// For user config (~/.config/openchamber), always use /api/fs/home in VSCode.
|
||||
// Use server-reported home as the source of truth for user config paths.
|
||||
// In some runtimes, window.__OPENCHAMBER_HOME__ can be workspace/project-root
|
||||
// scoped, which would incorrectly route writes into the project directory.
|
||||
try {
|
||||
const response = await fetch(`${getBaseUrl()}/fs/home`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to resolve home directory from API');
|
||||
}
|
||||
const payload = await response.json().catch(() => null) as { home?: unknown } | null;
|
||||
const home = typeof payload?.home === 'string' ? payload.home.trim() : '';
|
||||
if (home) {
|
||||
return normalize(home);
|
||||
}
|
||||
} catch {
|
||||
// fall through
|
||||
}
|
||||
|
||||
// Fallback for environments where /api/fs/home is unavailable.
|
||||
// VSCode intentionally avoids this because embedded home equals workspace path.
|
||||
if (!isVSCodeRuntime()) {
|
||||
const desktopHome = await getDesktopHomeDirectory().catch(() => null);
|
||||
if (desktopHome && desktopHome.trim().length > 0) {
|
||||
return normalize(desktopHome);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${getBaseUrl()}/fs/home`);
|
||||
if (!response.ok) {
|
||||
return null;
|
||||
}
|
||||
const payload = await response.json().catch(() => null) as { home?: unknown } | null;
|
||||
const home = typeof payload?.home === 'string' ? payload.home.trim() : '';
|
||||
return home ? normalize(home) : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const getUserProjectsDirectory = async (): Promise<string | null> => {
|
||||
|
||||
Reference in New Issue
Block a user