aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/App.js15
-rw-r--r--src/i18n.js27
2 files changed, 35 insertions, 7 deletions
diff --git a/src/App.js b/src/App.js
index 4e9ee3e..1db0b85 100644
--- a/src/App.js
+++ b/src/App.js
@@ -4,20 +4,20 @@ import logo from '../src/images/wifi.png';
4import { Card } from './components/Card'; 4import { Card } from './components/Card';
5import './style.css'; 5import './style.css';
6 6
7/* List of languages that require RTL direction (alphabetic order). */
8const RTL_LANGUAGES = ['ar', 'fa-IR'];
9
7function App() { 10function App() {
8 const html = document.querySelector('html'); 11 const html = document.querySelector('html');
9 const { t, i18n } = useTranslation(); 12 const { t, i18n } = useTranslation();
10 13
11 const changeLanguage = (language) => { 14 const changeLanguage = (language) => {
12 if (language === 'fa-IR') { 15 html.style.direction = RTL_LANGUAGES.includes(language) ? 'rtl' : 'ltr';
13 html.style.direction = 'rtl';
14 } else {
15 html.style.direction = 'ltr';
16 }
17 i18n.changeLanguage(language); 16 i18n.changeLanguage(language);
18 }; 17 };
19 18
20 if (i18n.language === 'fa-IR') { 19 /* handle the edge case of the initial render requiring RTL direction */
20 if (RTL_LANGUAGES.includes(i18n.language)) {
21 html.style.direction = 'rtl'; 21 html.style.direction = 'rtl';
22 } 22 }
23 23
@@ -52,6 +52,7 @@ function App() {
52 <option value="de-DE">German (Germany)</option> 52 <option value="de-DE">German (Germany)</option>
53 <option value="id-ID">Indonesian (Indonesia)</option> 53 <option value="id-ID">Indonesian (Indonesia)</option>
54 <option value="pl-PL">Polish - PL (Polski)</option> 54 <option value="pl-PL">Polish - PL (Polski)</option>
55 <option value="ar">Arabic - العربية</option>
55 </select> 56 </select>
56 </div> 57 </div>
57 58
@@ -62,7 +63,7 @@ function App() {
62 <a href="https://github.com/bndw/wifi-card">{t('desc.source')}</a>. 63 <a href="https://github.com/bndw/wifi-card">{t('desc.source')}</a>.
63 </p> 64 </p>
64 65
65 <Card direction={i18n.language === 'fa-IR' ? 'rtl' : 'ltr'} /> 66 <Card direction={RTL_LANGUAGES.includes(i18n.language) ? 'rtl' : 'ltr'} />
66 </div> 67 </div>
67 ); 68 );
68} 69}
diff --git a/src/i18n.js b/src/i18n.js
index 4c6c500..f816585 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -397,6 +397,33 @@ const resources = {
397 select: 'Dil Seçin', 397 select: 'Dil Seçin',
398 }, 398 },
399 }, 399 },
400 ar: {
401 translation: {
402 title: 'بطاقة واي فاي',
403 'desc.use':
404 'اطبع بطاقة بسيطة تحتوي على تفاصيل تسجيل الدخول إلى شبكة الواي فاي. إلصقه على الثلاجة، اوإحتفظ به في محفظتك.',
405 'desc.privacy':
406 'لا يتم إرسال معلومات الشبكة الخاصة بك إلى الخادم او اي اماكن اخري. لا يتم استخدام التتبع أو التحليلات أو البصمات الإلكترونية على هذا الموقع. اعرض ملف',
407 'desc.source': 'البرنامج',
408 'wifi.login': 'تسجيل الدخول',
409 'wifi.name': 'إسم الشبكة',
410 'wifi.name.placeholder': 'إسم الشبكة',
411 'wifi.password': 'كلمه السر',
412 'wifi.password.placeholder': 'كلمه السر',
413 'wifi.password.hide': 'إخفاء حقل كلمة المرور قبل الطباعة',
414 'wifi.password.encryption': 'التشفير',
415 'wifi.tip':
416 'وجّه كاميرا هاتفك إلى رمز الاستجابة السريعة للاتصال تلقائيًا',
417 'wifi.alert.name': 'لا يمكن أن يكون اسم الشبكة فارغًا',
418 'wifi.alert.password.length.5':
419 'يجب أن تكون كلمة المرور مكونة من ٥ أحرف على الأقل',
420 'wifi.alert.password.length.8':
421 'يجب أن تكون كلمة المرور مكونة من ٨ أحرف على الأقل',
422 'button.rotate': 'تدوير',
423 'button.print': 'طباعة',
424 select: 'اختر لغة',
425 },
426 },
400 'hi-IN': { 427 'hi-IN': {
401 translation: { 428 translation: {
402 title: 'वाईफाई कार्ड', 429 title: 'वाईफाई कार्ड',