/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/desktop/src/main/i18n.ts
33 строки
799 B
Ran Luo
chore: convert repo to pnpm monorepo (packages/desktop, muyajs, website) (#4302)
29 май 2026, 05:25
Не верифицирован
29 май 2026, 05:25
565bfcd
Код
Авторство
О чём код?
import { getTranslation } from 'common/i18n' import { BrowserWindow } from 'electron' // Current language setting (can be obtained from config file or user settings) let currentLanguage = 'en' /** * Gets the translated text. */ export function t(key: string, params: Record<string, string | number> = {}): string { return getTranslation(key, currentLanguage, params) } /** * Gets the current language. */ export function getCurrentLanguage(): string { return currentLanguage } /** * Sets the language. */ export function setLanguage(language: string): void { currentLanguage = language const windows = BrowserWindow.getAllWindows() windows.forEach((window) => { if (window && !window.isDestroyed()) { window.webContents.send('language-changed', language) } }) }