https & translations
This commit is contained in:
parent
2e31798fc1
commit
451e31829e
|
|
@ -16,9 +16,11 @@
|
||||||
"@types/uuid": "^9.0.0",
|
"@types/uuid": "^9.0.0",
|
||||||
"axios": "^1.2.3",
|
"axios": "^1.2.3",
|
||||||
"framer-motion": "^8.5.0",
|
"framer-motion": "^8.5.0",
|
||||||
|
"i18next": "^22.4.10",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-calendar": "^4.0.0",
|
"react-calendar": "^4.0.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-i18next": "^12.1.5",
|
||||||
"react-lazy-load-image-component": "^1.5.6",
|
"react-lazy-load-image-component": "^1.5.6",
|
||||||
"react-player": "^2.11.0",
|
"react-player": "^2.11.0",
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
|
|
@ -1685,6 +1687,36 @@
|
||||||
"react-is": "^16.7.0"
|
"react-is": "^16.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/html-parse-stringify": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",
|
||||||
|
"dependencies": {
|
||||||
|
"void-elements": "3.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/i18next": {
|
||||||
|
"version": "22.4.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.10.tgz",
|
||||||
|
"integrity": "sha512-3EqgGK6fAJRjnGgfkNSStl4mYLCjUoJID338yVyLMj5APT67HUtWoqSayZewiiC5elzMUB1VEUwcmSCoeQcNEA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://locize.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://locize.com/i18next.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.20.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/immer": {
|
"node_modules/immer": {
|
||||||
"version": "9.0.19",
|
"version": "9.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz",
|
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz",
|
||||||
|
|
@ -2058,6 +2090,27 @@
|
||||||
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz",
|
||||||
"integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA=="
|
"integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/react-i18next": {
|
||||||
|
"version": "12.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-12.1.5.tgz",
|
||||||
|
"integrity": "sha512-7PQAv6DA0TcStG96fle+8RfTwxVbHVlZZJPoEszwUNvDuWpGldJmNWa3ZPesEsZQZGF6GkzwvEh6p57qpFD2gQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.20.6",
|
||||||
|
"html-parse-stringify": "^3.0.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"i18next": ">= 19.0.0",
|
||||||
|
"react": ">= 16.8.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-native": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "16.13.1",
|
"version": "16.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||||
|
|
@ -2504,6 +2557,14 @@
|
||||||
"vite": "^2.6.0 || 3 || 4"
|
"vite": "^2.6.0 || 3 || 4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/void-elements": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/yallist": {
|
"node_modules/yallist": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,11 @@
|
||||||
"@types/uuid": "^9.0.0",
|
"@types/uuid": "^9.0.0",
|
||||||
"axios": "^1.2.3",
|
"axios": "^1.2.3",
|
||||||
"framer-motion": "^8.5.0",
|
"framer-motion": "^8.5.0",
|
||||||
|
"i18next": "^22.4.10",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-calendar": "^4.0.0",
|
"react-calendar": "^4.0.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-i18next": "^12.1.5",
|
||||||
"react-lazy-load-image-component": "^1.5.6",
|
"react-lazy-load-image-component": "^1.5.6",
|
||||||
"react-player": "^2.11.0",
|
"react-player": "^2.11.0",
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import { Routes, Route, useLocation } from "react-router-dom";
|
import { Routes, Route, useLocation } from "react-router-dom";
|
||||||
import { AnimatePresence } from "framer-motion";
|
import { AnimatePresence } from "framer-motion";
|
||||||
import ScrollToTop from "./hooks/ScrollToTop";
|
import ScrollToTop from "./hooks/ScrollToTop";
|
||||||
|
import { changeLanguage } from "i18next";
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
import "swiper/swiper.css";
|
import "swiper/swiper.css";
|
||||||
|
|
@ -20,9 +21,17 @@ import SearchResult from "./pages/SearchResult";
|
||||||
// Components
|
// Components
|
||||||
import Header from "./components/header/Header";
|
import Header from "./components/header/Header";
|
||||||
import Footer from "./components/footer/Footer";
|
import Footer from "./components/footer/Footer";
|
||||||
|
import { Api } from "./api/Api";
|
||||||
|
// import { useEffect } from "react";
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const language = new Api("").language;
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// changeLanguage(language);
|
||||||
|
// }, [language]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollToTop>
|
<ScrollToTop>
|
||||||
<div className="App">
|
<div className="App">
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
import { Api } from "../../api/Api";
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
import { ReactComponent as Logo } from "../../assets/icons/logo.svg";
|
import { ReactComponent as Logo } from "../../assets/icons/logo.svg";
|
||||||
|
|
@ -22,6 +23,7 @@ import { searchMobileMotion } from "../../animations/search.animation";
|
||||||
const Nav = () => {
|
const Nav = () => {
|
||||||
const isSmall = useMediaQuery("(max-width: 850px)");
|
const isSmall = useMediaQuery("(max-width: 850px)");
|
||||||
const [isInputFocused, setIsInputFocused] = useState<boolean>(false);
|
const [isInputFocused, setIsInputFocused] = useState<boolean>(false);
|
||||||
|
const language = new Api("").language;
|
||||||
return (
|
return (
|
||||||
<nav className="nav">
|
<nav className="nav">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
|
|
@ -42,7 +44,13 @@ const Nav = () => {
|
||||||
<div className="nav-mid">
|
<div className="nav-mid">
|
||||||
<Link to="/">
|
<Link to="/">
|
||||||
<h1>
|
<h1>
|
||||||
Türkmenistan <br /> Habarlar Portaly
|
{language === "TM"
|
||||||
|
? "Türkmenistan Habarlar Portaly"
|
||||||
|
: language === "RU"
|
||||||
|
? "Туркменистан новостной портал"
|
||||||
|
: language === "EN"
|
||||||
|
? "Turkmenistan news portal"
|
||||||
|
: ""}
|
||||||
</h1>
|
</h1>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -81,7 +89,13 @@ const Nav = () => {
|
||||||
>
|
>
|
||||||
<Link to="/">
|
<Link to="/">
|
||||||
<h1>
|
<h1>
|
||||||
Türkmenistan <br /> Habarlar Portaly
|
{language === "TM"
|
||||||
|
? "Türkmenistan Habarlar Portaly"
|
||||||
|
: language === "RU"
|
||||||
|
? "Туркменистан новостной портал"
|
||||||
|
: language === "EN"
|
||||||
|
? "Turkmenistan news portal"
|
||||||
|
: ""}
|
||||||
</h1>
|
</h1>
|
||||||
</Link>
|
</Link>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import i18n from "i18next";
|
||||||
|
import { initReactI18next } from "react-i18next";
|
||||||
|
|
||||||
|
import en from "./localization/en/translation.json";
|
||||||
|
import ru from "./localization/ru/translation.json";
|
||||||
|
import tm from "./localization/en/translation.json";
|
||||||
|
import { Api } from "./api/Api";
|
||||||
|
|
||||||
|
const language = new Api("").language;
|
||||||
|
const resources = {
|
||||||
|
EN: en,
|
||||||
|
RU: ru,
|
||||||
|
TM: tm,
|
||||||
|
};
|
||||||
|
i18n.use(initReactI18next).init({
|
||||||
|
resources,
|
||||||
|
lng: language,
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export default i18n;
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"name": "Turkmenistan news portal"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"name": "Туркменистан новостной портал"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"name": "Turkmenistan habarlar portaly"
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const https: boolean = false;
|
const https: boolean = true;
|
||||||
export const url: string = https
|
export const url: string = https
|
||||||
? "https://turkmenistaninfo.gov.tm/app/api/v1"
|
? "https://turkmenistaninfo.gov.tm/app/api/v1"
|
||||||
: "http://turkmenistaninfo.gov.tm/app/api/v1";
|
: "http://turkmenistaninfo.gov.tm/app/api/v1";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue