From 3a3f950daaaf23a45b34cb57120fc4dc1ba6860b Mon Sep 17 00:00:00 2001 From: Ramin <39030920+raminr77@users.noreply.github.com> Date: Mon, 26 Jul 2021 19:25:01 +0430 Subject: Add RTL Direction & Persian Translation (#79) * feat: add RTL direction and persian lang * feat: init RTL direction * fix: style issues Co-authored-by: Ramin --- src/App.js | 19 +++++++++++++++++-- src/components/Card.js | 12 +++++++++--- src/i18n.js | 25 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index d05f151..5fdb388 100644 --- a/src/App.js +++ b/src/App.js @@ -5,8 +5,22 @@ import './style.css'; import logo from '../src/images/wifi.png'; function App() { + const html = document.querySelector('html'); const { t, i18n } = useTranslation(); + const changeLanguage = (language) => { + if (language === 'fa-IR') { + html.style.direction = 'rtl'; + } else { + html.style.direction = 'ltr'; + } + i18n.changeLanguage(language); + }; + + if (i18n.language === 'fa-IR') { + html.style.direction = 'rtl'; + } + return (

@@ -18,7 +32,7 @@ function App() {