fix(mobile): add translate extension (#18942)

* re-write localization service and add translation extension

* Revert "re-write localization service and add translation extension"

This reverts commit fdd7386020.

* fix can't use context for easy_localization

* fix lint

* update new translate context

* handle context null

* revert main file

* Revert "revert main file"

This reverts commit 16faca46d0.

* remove fix nested MaterialApp

* change use t extenstion and remove translation utils

* update function call similar for consistently

---------

Co-authored-by: dvbthien <dvbthien@gmail.com>
This commit is contained in:
Thien Dang 2025-06-16 22:01:16 +07:00 committed by GitHub
parent 16fcb657b7
commit 3d0c851636
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 133 additions and 60 deletions

View file

@ -6,10 +6,10 @@ import 'package:immich_mobile/constants/enums.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
import 'package:immich_mobile/extensions/asset_extensions.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/providers/asset.provider.dart';
import 'package:immich_mobile/services/asset.service.dart';
import 'package:immich_mobile/services/share.service.dart';
import 'package:immich_mobile/utils/translation.dart';
import 'package:immich_mobile/widgets/common/date_time_picker.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:immich_mobile/widgets/common/location_picker.dart';
@ -59,10 +59,11 @@ Future<void> handleArchiveAssets(
await ref
.read(assetProvider.notifier)
.toggleArchive(selection, shouldArchive);
final message = shouldArchive
? t('moved_to_archive', {'count': selection.length})
: t('moved_to_library', {'count': selection.length});
? 'moved_to_archive'
.t(context: context, args: {'count': selection.length})
: 'moved_to_library'
.t(context: context, args: {'count': selection.length});
if (context.mounted) {
ImmichToast.show(
context: context,