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
11 changed files with 133 additions and 60 deletions

View File

@@ -8,13 +8,13 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/theme_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/models/albums/album_search.model.dart';
import 'package:immich_mobile/pages/common/large_leading_tile.dart';
import 'package:immich_mobile/providers/album/album.provider.dart';
import 'package:immich_mobile/providers/album/album_sort_by_options.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/utils/translation.dart';
import 'package:immich_mobile/widgets/album/album_thumbnail_card.dart';
import 'package:immich_mobile/widgets/common/immich_app_bar.dart';
import 'package:immich_mobile/widgets/common/immich_thumbnail.dart';
@@ -230,11 +230,17 @@ class AlbumsPage extends HookConsumerWidget {
),
subtitle: sorted[index].ownerId != null
? Text(
'${t('items_count', {
'count': sorted[index].assetCount,
})} • ${sorted[index].ownerId != userId ? t('shared_by_user', {
'user': sorted[index].ownerName!,
}) : 'owned'.tr()}',
'${'items_count'.t(
context: context,
args: {
'count': sorted[index].assetCount,
},
)} ${sorted[index].ownerId != userId ? 'shared_by_user'.t(
context: context,
args: {
'user': sorted[index].ownerName!,
},
) : 'owned'.t(context: context)}',
overflow: TextOverflow.ellipsis,
style:
context.textTheme.bodyMedium?.copyWith(