Skip to content

Commit 50bbf93

Browse files
sm-sayedignprice
authored andcommitted
compose: Use max_topic_length instead of hardcoded limit of 60
Fixes: #307
1 parent 030e441 commit 50bbf93

22 files changed

+147
-57
lines changed

assets/l10n/app_en.arb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,15 @@
806806
"@loginErrorMissingUsername": {
807807
"description": "Error message when an empty username was provided."
808808
},
809-
"topicValidationErrorTooLong": "Topic length shouldn't be greater than 60 characters.",
809+
"topicValidationErrorTooLong": "Topic length shouldn't be greater than {maxLength, plural, =1{1 character} other{{maxLength} characters}}.",
810810
"@topicValidationErrorTooLong": {
811-
"description": "Topic validation error when topic is too long."
811+
"description": "Topic validation error when topic is too long.",
812+
"placeholders": {
813+
"maxLength": {
814+
"type": "int",
815+
"example": "60"
816+
}
817+
}
812818
},
813819
"topicValidationErrorMandatoryButEmpty": "Topics are required in this organization.",
814820
"@topicValidationErrorMandatoryButEmpty": {

lib/api/route/messages.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ class GetMessagesResult {
121121
Map<String, dynamic> toJson() => _$GetMessagesResultToJson(this);
122122
}
123123

124-
// https://zulip.com/api/send-message#parameter-topic
125-
const int kMaxTopicLengthCodePoints = 60;
126-
127124
// https://zulip.com/api/send-message#parameter-content
128125
const int kMaxMessageLengthCodePoints = 10000;
129126

lib/generated/l10n/zulip_localizations.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,8 @@ abstract class ZulipLocalizations {
12421242
/// Topic validation error when topic is too long.
12431243
///
12441244
/// In en, this message translates to:
1245-
/// **'Topic length shouldn\'t be greater than 60 characters.'**
1246-
String get topicValidationErrorTooLong;
1245+
/// **'Topic length shouldn\'t be greater than {maxLength, plural, =1{1 character} other{{maxLength} characters}}.'**
1246+
String topicValidationErrorTooLong(int maxLength);
12471247

12481248
/// Topic validation error when topic is required but was empty.
12491249
///

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,15 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
661661
String get loginErrorMissingUsername => 'Please enter your username.';
662662

663663
@override
664-
String get topicValidationErrorTooLong =>
665-
'Topic length shouldn\'t be greater than 60 characters.';
664+
String topicValidationErrorTooLong(int maxLength) {
665+
String _temp0 = intl.Intl.pluralLogic(
666+
maxLength,
667+
locale: localeName,
668+
other: '$maxLength characters',
669+
one: '1 character',
670+
);
671+
return 'Topic length shouldn\'t be greater than $_temp0.';
672+
}
666673

667674
@override
668675
String get topicValidationErrorMandatoryButEmpty =>

lib/generated/l10n/zulip_localizations_de.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,9 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
680680
String get loginErrorMissingUsername => 'Bitte gib deinen Benutzernamen ein.';
681681

682682
@override
683-
String get topicValidationErrorTooLong =>
684-
'Länge des Themas sollte 60 Zeichen nicht überschreiten.';
683+
String topicValidationErrorTooLong(int maxLength) {
684+
return 'Länge des Themas sollte 60 Zeichen nicht überschreiten.';
685+
}
685686

686687
@override
687688
String get topicValidationErrorMandatoryButEmpty =>

lib/generated/l10n/zulip_localizations_el.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,15 @@ class ZulipLocalizationsEl extends ZulipLocalizations {
661661
String get loginErrorMissingUsername => 'Please enter your username.';
662662

663663
@override
664-
String get topicValidationErrorTooLong =>
665-
'Topic length shouldn\'t be greater than 60 characters.';
664+
String topicValidationErrorTooLong(int maxLength) {
665+
String _temp0 = intl.Intl.pluralLogic(
666+
maxLength,
667+
locale: localeName,
668+
other: '$maxLength characters',
669+
one: '1 character',
670+
);
671+
return 'Topic length shouldn\'t be greater than $_temp0.';
672+
}
666673

667674
@override
668675
String get topicValidationErrorMandatoryButEmpty =>

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,15 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
661661
String get loginErrorMissingUsername => 'Please enter your username.';
662662

663663
@override
664-
String get topicValidationErrorTooLong =>
665-
'Topic length shouldn\'t be greater than 60 characters.';
664+
String topicValidationErrorTooLong(int maxLength) {
665+
String _temp0 = intl.Intl.pluralLogic(
666+
maxLength,
667+
locale: localeName,
668+
other: '$maxLength characters',
669+
one: '1 character',
670+
);
671+
return 'Topic length shouldn\'t be greater than $_temp0.';
672+
}
666673

667674
@override
668675
String get topicValidationErrorMandatoryButEmpty =>

lib/generated/l10n/zulip_localizations_es.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,15 @@ class ZulipLocalizationsEs extends ZulipLocalizations {
661661
String get loginErrorMissingUsername => 'Please enter your username.';
662662

663663
@override
664-
String get topicValidationErrorTooLong =>
665-
'Topic length shouldn\'t be greater than 60 characters.';
664+
String topicValidationErrorTooLong(int maxLength) {
665+
String _temp0 = intl.Intl.pluralLogic(
666+
maxLength,
667+
locale: localeName,
668+
other: '$maxLength characters',
669+
one: '1 character',
670+
);
671+
return 'Topic length shouldn\'t be greater than $_temp0.';
672+
}
666673

667674
@override
668675
String get topicValidationErrorMandatoryButEmpty =>

lib/generated/l10n/zulip_localizations_fr.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,15 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
677677
String get loginErrorMissingUsername => 'Please enter your username.';
678678

679679
@override
680-
String get topicValidationErrorTooLong =>
681-
'Topic length shouldn\'t be greater than 60 characters.';
680+
String topicValidationErrorTooLong(int maxLength) {
681+
String _temp0 = intl.Intl.pluralLogic(
682+
maxLength,
683+
locale: localeName,
684+
other: '$maxLength characters',
685+
one: '1 character',
686+
);
687+
return 'Topic length shouldn\'t be greater than $_temp0.';
688+
}
682689

683690
@override
684691
String get topicValidationErrorMandatoryButEmpty =>

lib/generated/l10n/zulip_localizations_he.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,15 @@ class ZulipLocalizationsHe extends ZulipLocalizations {
661661
String get loginErrorMissingUsername => 'Please enter your username.';
662662

663663
@override
664-
String get topicValidationErrorTooLong =>
665-
'Topic length shouldn\'t be greater than 60 characters.';
664+
String topicValidationErrorTooLong(int maxLength) {
665+
String _temp0 = intl.Intl.pluralLogic(
666+
maxLength,
667+
locale: localeName,
668+
other: '$maxLength characters',
669+
one: '1 character',
670+
);
671+
return 'Topic length shouldn\'t be greater than $_temp0.';
672+
}
666673

667674
@override
668675
String get topicValidationErrorMandatoryButEmpty =>

0 commit comments

Comments
 (0)