Skip to content

Commit cc68215

Browse files
committed
Add internationalization
1 parent 1ebd9af commit cc68215

28 files changed

Lines changed: 7224 additions & 7 deletions

frontend/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ The main feature of this application is the comprehensive Profile Management Das
162162
- Global ranking and percentile
163163
- Performance scoring system
164164

165+
## 🌍 Internationalization (i18n)
166+
167+
To add support for a new language, follow these steps:
168+
1. **Update Configuration**: Add the ISO language code (e.g., `it` for Italian) to the `locales` array in `next-i18next.config.js`.
169+
2. **Add Translation Files**: Create a new directory for the language in `public/locales/` (e.g., `public/locales/it/`). Copy the JSON files from `public/locales/en/` and translate the values.
170+
3. **Update Language Switcher**: Add the language details to the `languages` array in `src/components/LanguageSwitcher.tsx`.
171+
4. **RTL Support**: If the language is Right-To-Left, ensure `rtl: true` is set in the `LanguageSwitcher` array and the language code is added to `RTL_LANGUAGES` in `src/lib/rtl.ts`.
172+
165173
## 🔧 Configuration
166174

167175
### Environment Variables

frontend/next-i18next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module.exports = {
33
i18n: {
44
defaultLocale: 'en',
5-
locales: ['en', 'es', 'fr', 'de', 'zh', 'ja', 'ko', 'ar'],
5+
locales: ['en', 'es', 'fr', 'de', 'zh', 'ja', 'ko', 'ar', 'he'],
66
localeDetection: true,
77
},
88
localePath: './public/locales',

frontend/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const nextConfig = {
1717
},
1818
i18n: {
1919
...i18n,
20-
localeDetection: false,
20+
localeDetection: true,
2121
},
2222
async rewrites() {
2323
return [

frontend/public/locales/ar/common.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,5 +339,11 @@
339339
"github": "جيت هب",
340340
"youtube": "يوتيوب",
341341
"medium": "ميديوم"
342+
},
343+
"languageSwitcher": {
344+
"title": "اختر لغتك",
345+
"subtitle": "اختر لغتك المفضلة للحصول على أفضل تجربة",
346+
"searchPlaceholder": "البحث عن لغات...",
347+
"ariaSelect": "اختر اللغة"
342348
}
343349
}

0 commit comments

Comments
 (0)