Skip to content

Build your personal knowledge base with Trilium Notes

fix(type_widgets/doc): import i18next

Panagiotis Papadopoulosd3283746fcc5
diff --git a/src/public/app/services/i18n.ts b/src/public/app/services/i18n.ts
index 8abdba46ef..449381f067 100644
--- a/src/public/app/services/i18n.ts
+++ b/src/public/app/services/i18n.ts
@@ -16,3 +16,4 @@ export async function initLocale() {
}
export const t = i18next.t;
+export const getCurrentLanguage = () => i18next.language;
diff --git a/src/public/app/widgets/type_widgets/doc.ts b/src/public/app/widgets/type_widgets/doc.ts
index 57fc7eda89..12eff71f3e 100644
--- a/src/public/app/widgets/type_widgets/doc.ts
+++ b/src/public/app/widgets/type_widgets/doc.ts
@@ -2,6 +2,7 @@ import type { EventData } from "../../components/app_context.js";
import type FNote from "../../entities/fnote.js";
import { applySyntaxHighlight } from "../../services/syntax_highlight.js";
import TypeWidget from "./type_widget.js";
+import { getCurrentLanguage } from "../../services/i18n.js";
const TPL = `<div class="note-detail-doc note-detail-printable">
<style>
@@ -77,7 +78,7 @@ export default class DocTypeWidget extends TypeWidget {
if (docName) {
// find doc based on language
- const url = this.#getUrl(docName, i18next.language);
+ const url = this.#getUrl(docName, getCurrentLanguage());
this.$content.load(url, (response, status) => {
// fallback to english doc if no translation available
if (status === "error") {