Open Dhruv80576 opened 3 weeks ago
The pull request implements multi-language support by adding a localization system that currently supports English and Chinese languages. The implementation uses Flutter's localization framework with JSON-based translation files and includes a locale provider to manage language switching.
classDiagram
class AppLocalizations {
+Locale? locale
+Map<String, String> _localizedStrings
+Future loadJsonLanguage()
+String translate(String key)
+String translateWithArgs(String key, Map<String, dynamic> args)
}
class _AppLocalizationsDelegate {
+bool isSupported(Locale locale)
+Future<AppLocalizations> load(Locale locale)
+bool shouldReload(LocalizationsDelegate old)
}
class LocaleProvider {
+Locale _locale
+Locale get locale()
+void changeLocale(Locale newLocale)
}
AppLocalizations --> _AppLocalizationsDelegate : delegate
AppLocalizations --> Locale : locale
LocaleProvider --> Locale : manages
AppLocalizations --> "1" Map : _localizedStrings
Change | Details | Files |
---|---|---|
Added localization infrastructure and translation system |
|
lib/providers/app_localisation.dart lib/providers/locale_provider.dart lib/main.dart assets/lang/en.json assets/lang/zh.json |
Updated UI components to use translated strings |
|
lib/view/widgets/navigation_drawer.dart lib/view/widgets/homescreentabs.dart lib/view/homescreen.dart |
Added language selection functionality in settings |
|
lib/view/settings_screen.dart |
Issue | Objective | Addressed | Explanation |
---|---|---|---|
#1067 | Implement language switching functionality in the settings | ✅ |
I think we can hop onto a different and scalable solution. More info: https://github.com/fossasia/badgemagic-android/issues/927
Fix #1067 Setting now updated, added language switch option. Now this application supports chinese language also. Please find the video attached.
https://github.com/user-attachments/assets/a03e73af-0ae0-4908-906b-ef24d04b1dca
Summary by Sourcery
Add multiple language support to the application, including a language switch option and support for Chinese. Implement a localization system to manage translations using JSON files.
New Features:
Enhancements: