Files
Qlyra/lib/core/share/share_labels.dart

37 lines
1.3 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import '../utils/format.dart';
String shareTitleFor({
required int photos,
required int videos,
required int documents,
bool textOnly = false,
}) {
if (textOnly) return 'Отправить сообщение';
final total = photos + videos + documents;
if (total == 0) return 'Отправить сообщение';
if (photos == total) {
return photos == 1
? 'Отправить фотографию'
: 'Отправить $photos '
'${pluralRu(photos, 'фотографию', 'фотографии', 'фотографий')}';
}
if (videos == total) {
return videos == 1 ? 'Отправить видео' : 'Отправить $videos видео';
}
if (documents == total) {
return documents == 1
? 'Отправить файл'
: 'Отправить $documents '
'${pluralRu(documents, 'файл', 'файла', 'файлов')}';
}
return 'Отправить $total ${pluralRu(total, 'файл', 'файла', 'файлов')}';
}
String shareSubtitleFor(List<String> recipientNames) {
if (recipientNames.isEmpty) return 'Выберите чат';
if (recipientNames.length <= 2) return 'В чат ${recipientNames.join(', ')}';
final count = recipientNames.length;
return 'В $count ${pluralRu(count, 'чат', 'чата', 'чатов')}';
}