Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: i18n of the main process #237

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/suite-base/src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ export async function initI18n(options?: { context?: "browser" | "electron-main"
},
});
}

// ts-unused-exports:disable-next-line
export const sharedI18nObject = i18n;
1 change: 0 additions & 1 deletion packages/suite-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"eventemitter3": "5.0.1",
"fork-ts-checker-webpack-plugin": "9.0.2",
"html-webpack-plugin": "5.5.3",
"i18next": "23.5.1",
"jszip": "3.10.1",
"path-browserify": "1.0.1",
"plist": "3.1.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/suite-desktop/src/main/StudioWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import {
shell,
systemPreferences,
} from "electron";
import i18n, { t } from "i18next";
import path from "path";

import Logger from "@lichtblick/log";
import { APP_BAR_HEIGHT } from "@lichtblick/suite-base/src/components/AppBar/constants";
import { NativeAppMenuEvent } from "@lichtblick/suite-base/src/context/NativeAppMenuContext";
import { sharedI18nObject as i18n } from "@lichtblick/suite-base/src/i18n";
import { palette } from "@lichtblick/theme";

import StudioAppUpdater from "./StudioAppUpdater";
Expand All @@ -45,6 +45,8 @@ const rendererPath = MAIN_WINDOW_WEBPACK_ENTRY;
const closeMenuItem: MenuItemConstructorOptions = isMac ? { role: "close" } : { role: "quit" };
const log = Logger.getLogger(__filename);

const { t } = i18n;

function getWindowBackgroundColor(): string | undefined {
const theme = palette[nativeTheme.shouldUseDarkColors ? "dark" : "light"];
return theme.background?.default;
Expand Down
6 changes: 3 additions & 3 deletions packages/suite-desktop/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import { app, BrowserWindow, ipcMain, Menu, nativeTheme, session } from "electron";
import fs from "fs";
import i18n from "i18next";
import path from "path";

import Logger from "@lichtblick/log";
import { AppSetting } from "@lichtblick/suite-base/src/AppSetting";
import { initI18n, sharedI18nObject as i18n } from "@lichtblick/suite-base/src/i18n";

import StudioAppUpdater from "./StudioAppUpdater";
import StudioWindow from "./StudioWindow";
Expand Down Expand Up @@ -60,8 +60,8 @@ async function updateLanguage() {
}

export async function main(): Promise<void> {
// await initI18n({ context: "electron-main" });
// await updateLanguage();
await initI18n({ context: "electron-main" });
await updateLanguage();

// Allow integration tests to override the userData directory
const userDataOverride = process.argv.find((arg) => arg.startsWith("--user-data-dir="));
Expand Down
10 changes: 0 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3405,7 +3405,6 @@ __metadata:
eventemitter3: 5.0.1
fork-ts-checker-webpack-plugin: 9.0.2
html-webpack-plugin: 5.5.3
i18next: 23.5.1
jszip: 3.10.1
path-browserify: 1.0.1
plist: 3.1.0
Expand Down Expand Up @@ -12563,15 +12562,6 @@ __metadata:
languageName: node
linkType: hard

"i18next@npm:23.5.1":
version: 23.5.1
resolution: "i18next@npm:23.5.1"
dependencies:
"@babel/runtime": ^7.22.5
checksum: 4be043bd72287bfae9777a3252b9458d2e3f5e9a97ea62cf434e6e3767b45df4365d8780d0dd14efd4e9da5eb0f90534510b138f1372d1cb9012000a69bbedaf
languageName: node
linkType: hard

"i18next@npm:23.7.18":
version: 23.7.18
resolution: "i18next@npm:23.7.18"
Expand Down
Loading