Skip to content

Commit b9c07fe

Browse files
committed
content: Translate error dialog for _launchUrl
Signed-off-by: Zixuan James Li <[email protected]>
1 parent af00879 commit b9c07fe

10 files changed

+82
-2
lines changed

assets/l10n/app_en.arb

+11
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,17 @@
234234
"event": {"type": "String", "example": "UpdateMessageEvent(id: 123, messageIds: [2345, 3456], newTopic: 'dinner')"}
235235
}
236236
},
237+
"errorOpenLinkDialogTitle": "Unable to open link",
238+
"@errorOpenLinkDialogTitle": {
239+
"description": "Title for an error dialog when opening a link failed."
240+
},
241+
"errorOpenLinkDialogMessage": "Link could not be opened: {url}",
242+
"@errorOpenLinkDialogMessage": {
243+
"description": "Message for an error dialog when opening a link failed.",
244+
"placeholders": {
245+
"url": {"type": "String", "example": "https://chat.example.com"}
246+
}
247+
},
237248
"errorMuteTopicFailed": "Failed to mute topic",
238249
"@errorMuteTopicFailed": {
239250
"description": "Error message when muting a topic failed."

lib/generated/l10n/zulip_localizations.dart

+12
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,18 @@ abstract class ZulipLocalizations {
411411
/// **'Error handling a Zulip event from {serverUrl}; will retry.\n\nError: {error}\n\nEvent: {event}'**
412412
String errorHandlingEventDetails(String serverUrl, String error, String event);
413413

414+
/// Title for an error dialog when opening a link failed.
415+
///
416+
/// In en, this message translates to:
417+
/// **'Unable to open link'**
418+
String get errorOpenLinkDialogTitle;
419+
420+
/// Message for an error dialog when opening a link failed.
421+
///
422+
/// In en, this message translates to:
423+
/// **'Link could not be opened: {url}'**
424+
String errorOpenLinkDialogMessage(String url);
425+
414426
/// Error message when muting a topic failed.
415427
///
416428
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
191191
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Failed to mute topic';
196204

lib/generated/l10n/zulip_localizations_en.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
191191
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Failed to mute topic';
196204

lib/generated/l10n/zulip_localizations_ja.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
191191
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Failed to mute topic';
196204

lib/generated/l10n/zulip_localizations_nb.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
191191
return 'Error handling a Zulip event from $serverUrl; will retry.\n\nError: $error\n\nEvent: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Failed to mute topic';
196204

lib/generated/l10n/zulip_localizations_pl.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
191191
return 'Błąd zdarzenia Zulip z $serverUrl; ponawiam.\n\nBłąd: $error\n\nZdarzenie: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Wyciszenie bez powodzenia';
196204

lib/generated/l10n/zulip_localizations_ru.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
191191
return 'Ошибка обработки события Zulip от $serverUrl; повторим попытку.\n\nОшибка: $error\n\nСобытие: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Не удалось отключить тему';
196204

lib/generated/l10n/zulip_localizations_sk.dart

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
191191
return 'Chyba obsluhy Zulip udalosti na serveri $serverUrl; skúsim znovu.\n\nChyba: $error\n\nUdalosť: $event';
192192
}
193193

194+
@override
195+
String get errorOpenLinkDialogTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDialogMessage(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Nepodarilo sa ztíšiť tému';
196204

lib/widgets/content.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -1319,10 +1319,11 @@ class MessageTableCell extends StatelessWidget {
13191319

13201320
void _launchUrl(BuildContext context, String urlString) async {
13211321
DialogStatus showError(BuildContext context, String? message) {
1322+
final zulipLocalizations = ZulipLocalizations.of(context);
13221323
return showErrorDialog(context: context,
1323-
title: 'Unable to open link',
1324+
title: zulipLocalizations.errorOpenLinkDialogTitle,
13241325
message: [
1325-
'Link could not be opened: $urlString',
1326+
zulipLocalizations.errorOpenLinkDialogMessage(urlString),
13261327
if (message != null) message,
13271328
].join("\n\n"));
13281329
}

0 commit comments

Comments
 (0)