mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +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 entityConstructor from "../becca/entity_constructor.js";
|
||||||
import { AttributeRow, BranchRow, EtapiTokenRow, NoteRow, OptionRow } from './entities/rows.js';
|
import { AttributeRow, BranchRow, EtapiTokenRow, NoteRow, OptionRow } from './entities/rows.js';
|
||||||
import AbstractBeccaEntity from "./entities/abstract_becca_entity.js";
|
import AbstractBeccaEntity from "./entities/abstract_becca_entity.js";
|
||||||
import options_init from "../services/options_init.js";
|
|
||||||
import ws from "../services/ws.js";
|
import ws from "../services/ws.js";
|
||||||
|
|
||||||
const beccaLoaded = new Promise<void>(async (res, rej) => {
|
const beccaLoaded = new Promise<void>(async (res, rej) => {
|
||||||
const sqlInit = (await import("../services/sql_init.js")).default;
|
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(() => {
|
sqlInit.dbReady.then(() => {
|
||||||
cls.init(() => {
|
cls.init(() => {
|
||||||
load();
|
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.
|
* 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[] = [
|
const DEFAULT_KEYBOARD_ACTIONS: KeyboardShortcut[] = [
|
||||||
{
|
{
|
||||||
separator: t("keyboard_actions.note-navigation")
|
separator: t("keyboard_actions.note-navigation")
|
||||||
|
@ -11,7 +11,6 @@ import migrationService from "./migration.js";
|
|||||||
import cls from "./cls.js";
|
import cls from "./cls.js";
|
||||||
import config from "./config.js";
|
import config from "./config.js";
|
||||||
import { OptionRow } from '../becca/entities/rows.js';
|
import { OptionRow } from '../becca/entities/rows.js';
|
||||||
import optionsInitService from "./options_init.js";
|
|
||||||
import BNote from "../becca/entities/bnote.js";
|
import BNote from "../becca/entities/bnote.js";
|
||||||
import BBranch from "../becca/entities/bbranch.js";
|
import BBranch from "../becca/entities/bbranch.js";
|
||||||
import zipImportService from "./import/zip.js";
|
import zipImportService from "./import/zip.js";
|
||||||
@ -62,6 +61,9 @@ async function createInitialDatabase() {
|
|||||||
|
|
||||||
let rootNote!: BNote;
|
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(() => {
|
sql.transactional(() => {
|
||||||
log.info("Creating database schema ...");
|
log.info("Creating database schema ...");
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ async function createInitialDatabase() {
|
|||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
notePosition: 10
|
notePosition: 10
|
||||||
}).save();
|
}).save();
|
||||||
|
|
||||||
optionsInitService.initDocumentOptions();
|
optionsInitService.initDocumentOptions();
|
||||||
optionsInitService.initNotSyncedOptions(true, defaultTheme, {});
|
optionsInitService.initNotSyncedOptions(true, defaultTheme, {});
|
||||||
optionsInitService.initStartupOptions();
|
optionsInitService.initStartupOptions();
|
||||||
@ -129,6 +131,9 @@ async function createDatabaseForSync(options: OptionRow[], syncServerHost = '',
|
|||||||
const defaultTheme = await getDefaultTheme();
|
const defaultTheme = await getDefaultTheme();
|
||||||
const schema = fs.readFileSync(`${resourceDir.DB_INIT_DIR}/schema.sql`, "utf8");
|
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.transactional(() => {
|
||||||
sql.executeScript(schema);
|
sql.executeScript(schema);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user