diff options
Diffstat (limited to 'front/src/Emelents')
| -rw-r--r-- | front/src/Emelents/IndexElement.tsx | 10 | ||||
| -rw-r--r-- | front/src/Emelents/Sidebar.tsx | 8 | ||||
| -rw-r--r-- | front/src/Emelents/Topbar.tsx | 4 |
3 files changed, 12 insertions, 10 deletions
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 ( <div> - <h1> {GetString("index", lang)} </h1> + <h1> {GetLocalizedString("index", lang)} </h1> </div> ); } 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 ( <nav className='Sidebar'> <div className='SidebarContents'> - <button onClick={() => setLang("ru")}> ru </button> - <button onClick={() => setLang("en")}> en </button> - <h1> {GetString("contents", language)} </h1> + <h1> {GetLocalizedString("contents", language)} </h1> <ul> </ul> + <button onClick={() => setLang("ru")}> ru </button> + <button onClick={() => setLang("en")}> en </button> </div> </nav> ); 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() { <div className="Topbar"> <h1> View from the edge </h1> <div className="TopbarContents"> - <h2> {GetString(path, language)} </h2> + <h2> {GetLocalizedString(path, language)} </h2> </div> </div> ); |
