mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(mobile): translate toast messages (#17964)
This commit is contained in:
parent
d89e88bb3f
commit
ac73e163df
3 changed files with 21 additions and 3 deletions
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…
Add table
Add a link
Reference in a new issue