mirror of
https://github.com/zadam/trilium.git
synced 2026-01-08 07:34:25 +01:00
fix(type_widgets/doc): import i18next
since we don't export the full i18n object (not sure why?), I had to add an additional export "getCurrentLanguage" -> needs to be a function, because otherwise it will be a static value (being set to undefined), which is *not* what we want
This commit is contained in:
parent
f3148bf478
commit
d3283746fc
@ -16,3 +16,4 @@ export async function initLocale() {
|
||||
}
|
||||
|
||||
export const t = i18next.t;
|
||||
export const getCurrentLanguage = () => i18next.language;
|
||||
|
||||
@ -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") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user