mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 04:05:39 -04:00
chore(mobile): translate toast messages (#17964)
This commit is contained in:
parent
d89e88bb3f
commit
ac73e163df
@ -1226,6 +1226,8 @@
|
|||||||
"month": "Month",
|
"month": "Month",
|
||||||
"monthly_title_text_date_format": "MMMM y",
|
"monthly_title_text_date_format": "MMMM y",
|
||||||
"more": "More",
|
"more": "More",
|
||||||
|
"moved_to_archive": "Moved {count, plural, one {# asset} other {# assets}} to archive",
|
||||||
|
"moved_to_library": "Moved {count, plural, one {# asset} other {# assets}} to library",
|
||||||
"moved_to_trash": "Moved to trash",
|
"moved_to_trash": "Moved to trash",
|
||||||
"multiselect_grid_edit_date_time_err_read_only": "Cannot edit date of read only asset(s), skipping",
|
"multiselect_grid_edit_date_time_err_read_only": "Cannot edit date of read only asset(s), skipping",
|
||||||
"multiselect_grid_edit_gps_err_read_only": "Cannot edit location of read only asset(s), skipping",
|
"multiselect_grid_edit_gps_err_read_only": "Cannot edit location of read only asset(s), skipping",
|
||||||
|
@ -8,6 +8,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
|||||||
import 'package:immich_mobile/providers/asset.provider.dart';
|
import 'package:immich_mobile/providers/asset.provider.dart';
|
||||||
import 'package:immich_mobile/services/asset.service.dart';
|
import 'package:immich_mobile/services/asset.service.dart';
|
||||||
import 'package:immich_mobile/services/share.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/date_time_picker.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
import 'package:immich_mobile/widgets/common/location_picker.dart';
|
import 'package:immich_mobile/widgets/common/location_picker.dart';
|
||||||
@ -57,12 +58,13 @@ Future<void> handleArchiveAssets(
|
|||||||
.read(assetProvider.notifier)
|
.read(assetProvider.notifier)
|
||||||
.toggleArchive(selection, shouldArchive);
|
.toggleArchive(selection, shouldArchive);
|
||||||
|
|
||||||
final assetOrAssets = selection.length > 1 ? 'assets' : 'asset';
|
final message = shouldArchive
|
||||||
final archiveOrLibrary = shouldArchive ? 'archive' : 'library';
|
? t('moved_to_archive', {'count': selection.length})
|
||||||
|
: t('moved_to_library', {'count': selection.length});
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
ImmichToast.show(
|
ImmichToast.show(
|
||||||
context: context,
|
context: context,
|
||||||
msg: 'Moved ${selection.length} $assetOrAssets to $archiveOrLibrary',
|
msg: message,
|
||||||
gravity: toastGravity,
|
gravity: toastGravity,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
14
mobile/lib/utils/translation.dart
Normal file
14
mobile/lib/utils/translation.dart
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:intl/message_format.dart';
|
||||||
|
|
||||||
|
String t(String key, [Map<String, Object>? args]) {
|
||||||
|
try {
|
||||||
|
String message = key.tr();
|
||||||
|
if (args != null) {
|
||||||
|
return MessageFormat(message).format(args);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
} catch (e) {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user