Browse Source
feat: implement internationalization support, add translation files, and update components for language handling
master
feat: implement internationalization support, add translation files, and update components for language handling
master
sina_sajjadi
2 weeks ago
27 changed files with 548 additions and 163 deletions
-
10next-i18next.config.js
-
41next.config.ts
-
146package-lock.json
-
3package.json
-
37public/locales/ar/common.json
-
38public/locales/en/common.json
-
2src/api/http.tsx
-
145src/components/language-switcher.tsx
-
10src/components/layout/header.tsx
-
10src/components/layout/mobile-navigation.tsx
-
18src/components/modals/audio-setting.tsx
-
20src/components/modals/languages-modal.tsx
-
8src/components/modals/reciters.tsx
-
42src/components/modals/search-modal.tsx
-
29src/components/modals/setting.tsx
-
19src/components/sidebar/list.tsx
-
19src/components/sidebar/tabs.tsx
-
11src/components/sticky-components/audio-controls.tsx
-
18src/components/sticky-components/download-app.tsx
-
17src/components/ui/search-duas.tsx
-
2src/components/utils/colorize-vowels.tsx
-
7src/pages/_app.tsx
-
11src/pages/about.tsx
-
11src/pages/duas/[slug].tsx
-
18src/pages/index.tsx
-
17tailwind.config.ts
-
2tsconfig.json
@ -0,0 +1,10 @@ |
|||||
|
module.exports = { |
||||
|
i18n: { |
||||
|
locales: [ |
||||
|
'en', 'es', 'de', 'uz', 'pt', 'bn', 'zh', 'az', 'ur', 'fr', 'tr', 'id', 'sw', 'ru', 'ar', 'tg', 'fa', 'gu', 'ks', 'ha' |
||||
|
] |
||||
|
, // List the languages you support
|
||||
|
defaultLocale: 'en', // Default language
|
||||
|
}, |
||||
|
reloadOnPrerender: true, // Ensures translations are reloaded on server-side rendering
|
||||
|
}; |
@ -0,0 +1,37 @@ |
|||||
|
{ |
||||
|
"home": "الرئيسية", |
||||
|
"about": "من نحن", |
||||
|
"donate": "تبرع", |
||||
|
"search_placeholder": "أدخل عنوان أو كلمة مفتاحية للبحث", |
||||
|
"loading": "جاري التحميل...", |
||||
|
"error_message": "فشل في جلب نتائج البحث.", |
||||
|
"close": "إغلاق", |
||||
|
"habib_app": "تطبيق حبيب", |
||||
|
"better_experience": "لتجربة أفضل", |
||||
|
"download": "تنزيل", |
||||
|
"timeline": "الجدول الزمني", |
||||
|
"settings": "الإعدادات", |
||||
|
"categories": "الفئات", |
||||
|
"famous": "الأشهر", |
||||
|
"near_by": "القريبين", |
||||
|
"today": "اليوم", |
||||
|
"todayDhikr": "ذكر اليوم", |
||||
|
"audio_settings": "إعدادات الصوت", |
||||
|
"reciters": "المقرئون", |
||||
|
"select_reciter": "اختر المقرئ", |
||||
|
"increase_speed": "زيادة السرعة", |
||||
|
"speed": "السرعة", |
||||
|
"choose_language": "اختر اللغة", |
||||
|
"loading_languages": "جاري تحميل اللغات...", |
||||
|
"failed_to_load_languages": "فشل في تحميل اللغات. الرجاء المحاولة مرة أخرى.", |
||||
|
"no_languages_available": "لا توجد لغات متاحة.", |
||||
|
"failed_to_load_reciters": "فشل في تحميل المقرئين. الرجاء المحاولة مرة أخرى.", |
||||
|
"search": "بحث", |
||||
|
"nothing_found": "لم يتم العثور على شيء!", |
||||
|
"dua_s_found": "تم العثور على دعاء(ات)", |
||||
|
"audio_available": "الصوت متاح", |
||||
|
"no_data_found": "لم يتم العثور على بيانات", |
||||
|
"arabic": "العربية", |
||||
|
"translation": "الترجمة", |
||||
|
"transliteration": "الترجمة الصوتية" |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
{ |
||||
|
"home": "Home", |
||||
|
"about": "About us", |
||||
|
"donate": "Donate", |
||||
|
"search_placeholder": "Type a title or keyword to search", |
||||
|
"loading": "Loading...", |
||||
|
"error_message": "Failed to fetch search results.", |
||||
|
"close": "Close", |
||||
|
"habib_app": "Habib App", |
||||
|
"better_experience": "For Better Experience", |
||||
|
"download": "Download", |
||||
|
"timeline": "Time Line", |
||||
|
"settings": "Settings", |
||||
|
"categories": "Categories", |
||||
|
"famous": "Famous", |
||||
|
"near_by": "Near by", |
||||
|
"today": "Today", |
||||
|
"todayDhikr": "Today’s Dhikr", |
||||
|
"audio_settings": "Audio Settings", |
||||
|
"reciters": "Reciters", |
||||
|
"select_reciter": "Select Reciter", |
||||
|
"increase_speed": "Increase speed", |
||||
|
"speed": "Speed", |
||||
|
"choose_language": "Choose Language", |
||||
|
"loading_languages": "Loading languages...", |
||||
|
"failed_to_load_languages": "Failed to load languages. Please try again.", |
||||
|
"no_languages_available": "No languages available.", |
||||
|
"failed_to_load_reciters": "Failed to load reciters. Please try again.", |
||||
|
"search": "Search", |
||||
|
"nothing_found": "Nothing Found!", |
||||
|
"dua_s_found": "Dua(s) found", |
||||
|
"audio_available": "Audio Available", |
||||
|
"no_data_found": "No Data Found", |
||||
|
"arabic": "Arabic", |
||||
|
"translation": "Translation", |
||||
|
"transliteration": "Transliteration" |
||||
|
} |
||||
|
|
@ -1,12 +1,22 @@ |
|||||
import Image from "next/image"; |
import Image from "next/image"; |
||||
import NoData from "../../public/assets/images/Untitled-1-02.svg"; |
|
||||
|
|
||||
|
import { serverSideTranslations } from "next-i18next/serverSideTranslations"; |
||||
|
import NoData from "../../public/assets/images/Untitled-1-02.svg"; // Ensure this is the correct path
|
||||
|
|
||||
export default function Home() { |
export default function Home() { |
||||
|
|
||||
|
// This is where you can use translations, if necessary
|
||||
|
// const { t } = useTranslation('common'); // Uncomment if you need to use translations in this page
|
||||
|
|
||||
return ( |
return ( |
||||
<div className={`flex-grow w-full items-center justify-center h-[calc(100vh-130px)] bg-[#F5F5F5] lg:p-6 lg:rounded-3xl hidden lg:flex`}> |
<div className={`flex-grow w-full items-center justify-center h-[calc(100vh-130px)] bg-[#F5F5F5] lg:p-6 lg:rounded-3xl hidden lg:flex`}> |
||||
<Image src={NoData} alt="no data"/> |
|
||||
|
<Image src={NoData} alt="No data" /> {/* Ensure `NoData` is a valid imported image */} |
||||
</div> |
</div> |
||||
); |
); |
||||
} |
} |
||||
|
|
||||
|
export async function getServerSideProps({ locale }: { locale: string }) { |
||||
|
return { |
||||
|
props: { |
||||
|
...(await serverSideTranslations(locale, ['common'])), // Load translations for 'common' namespace
|
||||
|
}, |
||||
|
}; |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue