From 5d2c8369389013895264caf16e71d44bddabb22c Mon Sep 17 00:00:00 2001
From: physcik <mynameisgennadiy@vk.com>
Date: Sat, 11 Apr 2026 16:40:22 +0500
Subject: Language toggle

---
 front/src/App.tsx | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

(limited to 'front/src/App.tsx')

diff --git a/front/src/App.tsx b/front/src/App.tsx
index 0759d38..a685379 100644
--- a/front/src/App.tsx
+++ b/front/src/App.tsx
@@ -5,6 +5,8 @@ import { createBrowserRouter, RouterProvider } from 'react-router';
 import IndexElement from './Emelents/IndexElement';
 import ClassesList from './Emelents/ClassList';
 import Topbar from './Emelents/Topbar';
+import { AllowedLanguages, LanguageContext } from './Locales/Context';
+import { useState } from 'react';
 
 const router = createBrowserRouter([
     {
@@ -18,14 +20,25 @@ const router = createBrowserRouter([
 ]);
 
 function App() {
+    const [lang, setLang] = useState<AllowedLanguages>("en");
+
+    function SetLanguage(newLang: AllowedLanguages) {
+        console.log(`Setting a new language ${newLang}...`);
+        setLang(newLang);
+    }
+
     return (
-        <div className='App'>
-            <Topbar />
-            <div className='AppContents'>
-                <Sidebar />
-                <RouterProvider router={router} />
+        <LanguageContext.Provider value={lang}>
+            <div className='App'>
+                <Topbar />
+                <div className='AppContents'>
+                    <Sidebar 
+                        setLang={SetLanguage}
+                        />
+                    <RouterProvider router={router} />
+                </div>
             </div>
-        </div>
+        </LanguageContext.Provider>
     );
 }
 
-- 
cgit v1.3

