diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index e9ca8ceb6a423..7729972aa21e8 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -192,6 +192,12 @@ class ImmichAppState extends ConsumerState await ref.read(localNotificationService).setup(); } + @override + void didChangeDependencies() { + super.didChangeDependencies(); + Intl.defaultLocale = context.locale.toLanguageTag(); + } + @override initState() { super.initState(); diff --git a/mobile/lib/pages/common/settings.page.dart b/mobile/lib/pages/common/settings.page.dart index 117b0aedc0cbc..a6ca239962df3 100644 --- a/mobile/lib/pages/common/settings.page.dart +++ b/mobile/lib/pages/common/settings.page.dart @@ -46,6 +46,7 @@ class SettingsPage extends StatelessWidget { @override Widget build(BuildContext context) { + context.locale; return Scaffold( appBar: AppBar( centerTitle: false, @@ -129,6 +130,7 @@ class SettingsSubPage extends StatelessWidget { @override Widget build(BuildContext context) { + context.locale; return Scaffold( appBar: AppBar( centerTitle: false, diff --git a/mobile/lib/pages/library/library.page.dart b/mobile/lib/pages/library/library.page.dart index 48d2c685ba1e7..1161f068cf64d 100644 --- a/mobile/lib/pages/library/library.page.dart +++ b/mobile/lib/pages/library/library.page.dart @@ -23,6 +23,7 @@ class LibraryPage extends ConsumerWidget { const LibraryPage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { + context.locale; final trashEnabled = ref.watch(serverInfoProvider.select((v) => v.serverFeatures.trash)); diff --git a/mobile/lib/providers/asset.provider.dart b/mobile/lib/providers/asset.provider.dart index 3855a00b76a61..9252de01bfa72 100644 --- a/mobile/lib/providers/asset.provider.dart +++ b/mobile/lib/providers/asset.provider.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/providers/locale_provider.dart'; import 'package:immich_mobile/providers/memory.provider.dart'; import 'package:immich_mobile/repositories/asset_media.repository.dart'; import 'package:immich_mobile/services/album.service.dart'; @@ -328,24 +329,31 @@ final assetWatcher = return db.assets.watchObject(asset.id, fireImmediately: true); }); -final assetsProvider = StreamProvider.family((ref, userId) { - if (userId == null) return const Stream.empty(); - final query = _commonFilterAndSort( - _assets(ref).where().ownerIdEqualToAnyChecksum(userId), - ); - return renderListGenerator(query, ref); -}); - -final multiUserAssetsProvider = - StreamProvider.family>((ref, userIds) { - if (userIds.isEmpty) return const Stream.empty(); - final query = _commonFilterAndSort( - _assets(ref) - .where() - .anyOf(userIds, (q, u) => q.ownerIdEqualToAnyChecksum(u)), - ); - return renderListGenerator(query, ref); -}); +final assetsProvider = StreamProvider.family( + (ref, userId) { + if (userId == null) return const Stream.empty(); + ref.watch(localeProvider); + final query = _commonFilterAndSort( + _assets(ref).where().ownerIdEqualToAnyChecksum(userId), + ); + return renderListGenerator(query, ref); + }, + dependencies: [localeProvider], +); + +final multiUserAssetsProvider = StreamProvider.family>( + (ref, userIds) { + if (userIds.isEmpty) return const Stream.empty(); + ref.watch(localeProvider); + final query = _commonFilterAndSort( + _assets(ref) + .where() + .anyOf(userIds, (q, u) => q.ownerIdEqualToAnyChecksum(u)), + ); + return renderListGenerator(query, ref); + }, + dependencies: [localeProvider], +); QueryBuilder? getRemoteAssetQuery(WidgetRef ref) { final userId = ref.watch(currentUserProvider)?.isarId;