Pin the UI locale to the language setting and add theme + language selectors with a dark palette
This commit is contained in:
1 parent
b30b9a3bc1
commit
d404e1e72a
18 files changed
+176
-11
No files matched your search
+12
-2
@@ -18,9 +18,14 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
if (!app.requestSingleInstanceLock()) {
|
||||
app.quit();
|
||||
} else {
|
||||
const profileDir = process.env.AGENTCOMPANY_NEW_PROFILE_DIR ?? join(app.getPath("userData"), "profile");
|
||||
// The database opens before ready: Chromium's UI locale (form-control
|
||||
// strings, date formatting) is only settable pre-ready, and it follows the
|
||||
// stored language preference instead of the OS locale.
|
||||
const connection = new DatabaseConnection(join(profileDir, "agentcompany.db"));
|
||||
app.commandLine.appendSwitch("lang", storedLanguage(connection.db) === "zh" ? "zh-CN" : "en-US");
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const profileDir = process.env.AGENTCOMPANY_NEW_PROFILE_DIR ?? join(app.getPath("userData"), "profile");
|
||||
const connection = new DatabaseConnection(join(profileDir, "agentcompany.db"));
|
||||
connection.transaction(() => recoverInterruptedWork(connection.db));
|
||||
const win = createMainWindow({
|
||||
preloadPath: join(__dirname, "../preload/index.js"),
|
||||
@@ -60,6 +65,11 @@ if (!app.requestSingleInstanceLock()) {
|
||||
});
|
||||
}
|
||||
|
||||
function storedLanguage(db: DatabaseSync): string {
|
||||
const row = db.prepare("select language from app_state where id = 1").get() as { language: string } | undefined;
|
||||
return row?.language ?? "en";
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the on-disk skill library for every organization at startup. One
|
||||
* organization's failure (a broken workspace path, say) must not block the
|
||||
|
||||
Reference in new issue
Block a user