mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
server: Fix missing translations in keyboard actions
This commit is contained in:
parent
73cd54e75c
commit
9e85d2cdbd
@ -13,11 +13,13 @@ import cls from "../services/cls.js";
|
||||
import entityConstructor from "../becca/entity_constructor.js";
|
||||
import { AttributeRow, BranchRow, EtapiTokenRow, NoteRow, OptionRow } from './entities/rows.js';
|
||||
import AbstractBeccaEntity from "./entities/abstract_becca_entity.js";
|
||||
import options_init from "../services/options_init.js";
|
||||
import ws from "../services/ws.js";
|
||||
|
||||
const beccaLoaded = new Promise<void>(async (res, rej) => {
|
||||
const sqlInit = (await import("../services/sql_init.js")).default;
|
||||
// We have to import async since options init requires keyboard actions which require translations.
|
||||
const options_init = (await import("../services/options_init.js")).default;
|
||||
|
||||
sqlInit.dbReady.then(() => {
|
||||
cls.init(() => {
|
||||
load();
|
||||
|
@ -18,6 +18,10 @@ const isElectron = utils.isElectron();
|
||||
* e.g. CTRL-C in note tree does something a bit different from CTRL-C in the text editor.
|
||||
*/
|
||||
|
||||
if (!t("keyboard_actions.note-navigation")) {
|
||||
throw new Error("Keyboard actions loaded before translations.");
|
||||
}
|
||||
|
||||
const DEFAULT_KEYBOARD_ACTIONS: KeyboardShortcut[] = [
|
||||
{
|
||||
separator: t("keyboard_actions.note-navigation")
|
||||
|
@ -11,7 +11,6 @@ import migrationService from "./migration.js";
|
||||
import cls from "./cls.js";
|
||||
import config from "./config.js";
|
||||
import { OptionRow } from '../becca/entities/rows.js';
|
||||
import optionsInitService from "./options_init.js";
|
||||
import BNote from "../becca/entities/bnote.js";
|
||||
import BBranch from "../becca/entities/bbranch.js";
|
||||
import zipImportService from "./import/zip.js";
|
||||
@ -62,6 +61,9 @@ async function createInitialDatabase() {
|
||||
|
||||
let rootNote!: BNote;
|
||||
|
||||
// We have to import async since options init requires keyboard actions which require translations.
|
||||
const optionsInitService = (await import("./options_init.js")).default;
|
||||
|
||||
sql.transactional(() => {
|
||||
log.info("Creating database schema ...");
|
||||
|
||||
@ -86,7 +88,7 @@ async function createInitialDatabase() {
|
||||
isExpanded: true,
|
||||
notePosition: 10
|
||||
}).save();
|
||||
|
||||
|
||||
optionsInitService.initDocumentOptions();
|
||||
optionsInitService.initNotSyncedOptions(true, defaultTheme, {});
|
||||
optionsInitService.initStartupOptions();
|
||||
@ -129,6 +131,9 @@ async function createDatabaseForSync(options: OptionRow[], syncServerHost = '',
|
||||
const defaultTheme = await getDefaultTheme();
|
||||
const schema = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/schema.sql`, "utf8");
|
||||
|
||||
// We have to import async since options init requires keyboard actions which require translations.
|
||||
const optionsInitService = (await import("./options_init.js")).default;
|
||||
|
||||
sql.transactional(() => {
|
||||
sql.executeScript(schema);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user