refactor(mobile): services and providers (#9232)

* refactor(mobile): services and provider

* providers
This commit is contained in:
Alex 2024-05-02 15:59:14 -05:00 committed by GitHub
parent ec4eb7cd19
commit c1253663b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
242 changed files with 497 additions and 503 deletions

View file

@ -0,0 +1,31 @@
// ignore_for_file: implementation_imports
import 'package:flutter/foundation.dart';
import 'package:easy_localization/src/asset_loader.dart';
import 'package:easy_localization/src/easy_localization_controller.dart';
import 'package:easy_localization/src/localization.dart';
import 'package:immich_mobile/constants/locales.dart';
/// Workaround to manually load translations in another Isolate
Future<bool> loadTranslations() async {
await EasyLocalizationController.initEasyLocation();
final controller = EasyLocalizationController(
supportedLocales: locales.values.toList(),
useFallbackTranslations: true,
saveLocale: true,
assetLoader: const RootBundleAssetLoader(),
path: translationsPath,
useOnlyLangCode: false,
onLoadError: (e) => debugPrint(e.toString()),
fallbackLocale: locales.values.first,
);
await controller.loadTranslations();
return Localization.load(
controller.locale,
translations: controller.translations,
fallbackTranslations: controller.fallbackTranslations,
);
}