diff --git a/src/components/utils.js b/src/components/utils.js index 43c75e6..2f89b78 100644 --- a/src/components/utils.js +++ b/src/components/utils.js @@ -44,4 +44,8 @@ function localesProcess(reRender) { if (reRender) reRenderPage(); } -export { printDate, reRenderPage, localesProcess }; +async function getNetLocale(lang, fileName) { + return (await (await fetch(`localisation/${lang}/${fileName}`)).text()) || ""; +} + +export { printDate, reRenderPage, localesProcess, getNetLocale }; diff --git a/src/localisation/en.js b/src/localisation/en.js index c078446..93193be 100644 --- a/src/localisation/en.js +++ b/src/localisation/en.js @@ -15,8 +15,10 @@ along with this program. If not, see . */ +import { getNetLocale } from "../components/utils"; + let en = { - about_md: (await (await fetch("localisation/en/about.md")).text()) || "", + about_md: await getNetLocale("en", "about.md"), Notes: "Notes", Write: "Write", Chat: "Chat", diff --git a/src/localisation/ru.js b/src/localisation/ru.js index f1effd2..cf4a5c1 100644 --- a/src/localisation/ru.js +++ b/src/localisation/ru.js @@ -15,8 +15,10 @@ along with this program. If not, see . */ +import { getNetLocale } from "../components/utils"; + let ru = { - about_md: (await (await fetch("localisation/ru/about.md")).text()) || "", + about_md: await getNetLocale("ru", "about.md"), Notes: "Заметки", Write: "Написать", Chat: "Чат",