From ebbadf94dd4b23b9ceabd402ed0886c4cd8c6062 Mon Sep 17 00:00:00 2001 From: physcik Date: Sat, 11 Apr 2026 17:12:18 +0500 Subject: Localization persistance --- front/src/Emelents/IndexElement.tsx | 10 ++++++---- front/src/Emelents/Sidebar.tsx | 8 ++++---- front/src/Emelents/Topbar.tsx | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'front/src/Emelents') diff --git a/front/src/Emelents/IndexElement.tsx b/front/src/Emelents/IndexElement.tsx index 9914e89..2209fe1 100644 --- a/front/src/Emelents/IndexElement.tsx +++ b/front/src/Emelents/IndexElement.tsx @@ -1,11 +1,13 @@ -import { useState } from "react"; -import { GetString } from "../Locales/Locales"; +import { useContext, useState } from "react"; +import { LanguageContext } from "../Locales/Context"; +import { GetLocalizedString } from "../Locales/Locales"; function IndexElement() { - const [lang, setLang] = useState('en'); + var lang = useContext(LanguageContext); + return (
-

{GetString("index", lang)}

+

{GetLocalizedString("index", lang)}

); } diff --git a/front/src/Emelents/Sidebar.tsx b/front/src/Emelents/Sidebar.tsx index 4802e76..d94cef8 100644 --- a/front/src/Emelents/Sidebar.tsx +++ b/front/src/Emelents/Sidebar.tsx @@ -1,6 +1,6 @@ import { useContext } from 'react'; import { AllowedLanguages, LanguageContext } from '../Locales/Context'; -import { GetString } from '../Locales/Locales'; +import { GetLocalizedString } from '../Locales/Locales'; import './Elements.css'; type SidebarProps = { @@ -13,11 +13,11 @@ function Sidebar({setLang}: SidebarProps) { return ( ); diff --git a/front/src/Emelents/Topbar.tsx b/front/src/Emelents/Topbar.tsx index 667b42f..73e0e38 100644 --- a/front/src/Emelents/Topbar.tsx +++ b/front/src/Emelents/Topbar.tsx @@ -1,6 +1,6 @@ import { useContext } from "react"; import { LanguageContext } from "../Locales/Context"; -import { GetString } from "../Locales/Locales"; +import { GetLocalizedString } from "../Locales/Locales"; const defaultPathName = 'index'; @@ -12,7 +12,7 @@ function Topbar() {

View from the edge

-

{GetString(path, language)}

+

{GetLocalizedString(path, language)}

); -- cgit v1.3