feat: localisation with en, de, fr and it

This commit is contained in:
cogwheel0
2025-08-23 20:09:43 +05:30
parent b898adbe40
commit a852ce7848
36 changed files with 3912 additions and 203 deletions

View File

@@ -79,6 +79,36 @@ class ThemeModeNotifier extends StateNotifier<ThemeMode> {
}
}
// Locale provider
final localeProvider = StateNotifierProvider<LocaleNotifier, Locale?>(
(ref) {
final storage = ref.watch(optimizedStorageServiceProvider);
return LocaleNotifier(storage);
},
);
class LocaleNotifier extends StateNotifier<Locale?> {
final OptimizedStorageService _storage;
LocaleNotifier(this._storage) : super(null) {
_loadLocale();
}
void _loadLocale() {
final code = _storage.getLocaleCode();
if (code != null && code.isNotEmpty) {
state = Locale(code);
} else {
state = null; // system
}
}
Future<void> setLocale(Locale? locale) async {
state = locale;
await _storage.setLocaleCode(locale?.languageCode);
}
}
// Server connection providers - optimized with caching
final serverConfigsProvider = FutureProvider<List<ServerConfig>>((ref) async {
final storage = ref.watch(optimizedStorageServiceProvider);