refactor: get localisation file

This commit is contained in:
Artemy 2023-04-27 18:50:27 +03:00
parent 4e946879a2
commit 962cec0875
3 changed files with 11 additions and 3 deletions

View file

@ -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 };

View file

@ -15,8 +15,10 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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",

View file

@ -15,8 +15,10 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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: "Чат",