Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://github.com/TriliumNext/Notes into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
eliandoran committed Oct 13, 2024
2 parents 52a6d0b + cddc9a7 commit 4faf273
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
11 changes: 8 additions & 3 deletions forge.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ module.exports = {
overwrite: true,
asar: true,
icon: "./images/app-icons/icon",
extraResource: getExtraResourcesForPlatform(),
extraResource: [
// Moved to root
...getExtraResourcesForPlatform(),

// Moved to resources (TriliumNext Notes.app/Contents/Resources on macOS)
"translations/"
],
afterComplete: [(buildPath, _electronVersion, platform, _arch, callback) => {
const extraResources = getExtraResourcesForPlatform();
for (const resource of extraResources) {
Expand Down Expand Up @@ -77,8 +83,7 @@ module.exports = {
function getExtraResourcesForPlatform() {
let resources = [
'dump-db/',
'./bin/tpl/anonymize-database.sql',
'translations/'
'./bin/tpl/anonymize-database.sql'
];
const scripts = ['trilium-portable', 'trilium-safe-mode', 'trilium-no-cert-check']
switch (process.platform) {
Expand Down
2 changes: 1 addition & 1 deletion src/public/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@
"mermaid-diagram": "Mermaid Diagram",
"canvas": "Canvas",
"web-view": "Web View",
"mind-map": "Mind Map",
"mind-map": "Mind Map (Beta)",
"file": "File",
"image": "Image",
"launcher": "Launcher",
Expand Down
2 changes: 1 addition & 1 deletion src/public/translations/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@
"mermaid-diagram": "Diagrama Mermaid",
"canvas": "Lienzo",
"web-view": "Vista Web",
"mind-map": "Mapa Mental",
"mind-map": "Mapa Mental (beta)",
"file": "Archivo",
"image": "Imagen",
"launcher": "Lanzador",
Expand Down
8 changes: 4 additions & 4 deletions src/public/translations/ro/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@
"canvas": "Schiță",
"code": "Cod sursă",
"mermaid-diagram": "Diagramă Mermaid",
"mind-map": "Hartă mentală",
"mind-map": "Hartă mentală (beta)",
"note-map": "Hartă notițe",
"relation-map": "Hartă relații",
"render-note": "Randare notiță",
Expand Down Expand Up @@ -1374,7 +1374,7 @@
"window-on-top": "Menține fereastra mereu vizibilă"
},
"note_detail": {
"could_not_find_typewidget": "Nu s-a putut găsi typeWidget-ul pentru tipul „{{type}}”"
"could_not_find_typewidget": "Nu s-a putut găsi widget-ul corespunzător tipului „{{type}}”"
},
"note_title": {
"placeholder": "introduceți titlul notiței aici..."
Expand All @@ -1387,8 +1387,8 @@
"snapshot_number_limit_label": "Numărul maxim de revizii pentru notițe:"
},
"search_result": {
"no_notes_found": "Nu s-a găsit nicio notiță pentru parametrii de căutare dați.",
"search_not_executed": "Căutarea n-a fost încă executată. Clic pe butonul „Căutare” de deasupra pentru a vedea rezultatele."
"no_notes_found": "Nu au fost găsite notițe pentru parametrii de căutare dați.",
"search_not_executed": "Căutarea n-a fost rulată încă. Clic pe butonul „Căutare” de deasupra pentru a vedea rezultatele."
},
"show_floating_buttons_button": {
"button_title": "Afișează butoanele"
Expand Down
16 changes: 15 additions & 1 deletion src/services/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@ import i18next from "i18next";
import Backend from "i18next-fs-backend";
import options from "./options.js";
import sql_init from "./sql_init.js";
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import utils from "./utils.js";
import env from "./env.js";

export async function initializeTranslations() {
const resourceDir = getResourceDir();

// Initialize translations
await i18next.use(Backend).init({
lng: getCurrentLanguage(),
fallbackLng: "en",
ns: "server",
backend: {
loadPath: "translations/{{lng}}/{{ns}}.json"
loadPath: join(resourceDir, "translations/{{lng}}/{{ns}}.json")
}
});
}

function getResourceDir() {
if (utils.isElectron() && !env.isDev()) {
return process.resourcesPath;
} else {
return join(dirname(fileURLToPath(import.meta.url)), "..", "..");
}
}

function getCurrentLanguage() {
let language;
if (sql_init.isDbInitialized()) {
Expand Down

0 comments on commit 4faf273

Please sign in to comment.