immich/mobile/lib/utils/translation.dart
waclaw66 edae9c2d3d
fix(mobile): t function localization (#18768)
* fix(mobile): items translation

* Intl.defaultLocale null coalescence
2025-06-03 09:52:29 -05:00

16 lines
379 B
Dart

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, locale: Intl.defaultLocale ?? 'en')
.format(args);
}
return message;
} catch (e) {
return key;
}
}