Skip to content

Commit 2a2c6b5

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

9 files changed

+74
-2
lines changed

assets/l10n/app_en.arb

Lines changed: 11 additions & 0 deletions
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+
"errorOpenLinkTitle": "Unable to open link",
238+
"@errorOpenLinkTitle": {
239+
"description": "Error title when opening a link failed."
240+
},
241+
"errorOpenLinkDetails": "Link could not be opened: {url}",
242+
"@errorOpenLinkDetails": {
243+
"description": "Error details 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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,18 @@ abstract class ZulipLocalizations {
409409
/// **'Error handling a Zulip event from {serverUrl}; will retry.\n\nError: {error}\n\nEvent: {event}'**
410410
String errorHandlingEventDetails(String serverUrl, String error, String event);
411411

412+
/// Error title when opening a link failed.
413+
///
414+
/// In en, this message translates to:
415+
/// **'Unable to open link'**
416+
String get errorOpenLinkTitle;
417+
418+
/// Error details when opening a link failed.
419+
///
420+
/// In en, this message translates to:
421+
/// **'Link could not be opened: {url}'**
422+
String errorOpenLinkDetails(String url);
423+
412424
/// Error message when muting a topic failed.
413425
///
414426
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 8 additions & 0 deletions
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 errorOpenLinkTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDetails(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

Lines changed: 8 additions & 0 deletions
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 errorOpenLinkTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDetails(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_fr.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsFr 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 errorOpenLinkTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDetails(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

Lines changed: 8 additions & 0 deletions
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 errorOpenLinkTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDetails(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

Lines changed: 8 additions & 0 deletions
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 errorOpenLinkTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDetails(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_ru.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ class ZulipLocalizationsRu 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 errorOpenLinkTitle => 'Unable to open link';
196+
197+
@override
198+
String errorOpenLinkDetails(String url) {
199+
return 'Link could not be opened: $url';
200+
}
201+
194202
@override
195203
String get errorMuteTopicFailed => 'Failed to mute topic';
196204

lib/widgets/content.dart

Lines changed: 3 additions & 2 deletions
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.errorOpenLinkTitle,
13241325
message: [
1325-
'Link could not be opened: $urlString',
1326+
zulipLocalizations.errorOpenLinkDetails(urlString),
13261327
if (message != null) message,
13271328
].join("\n\n"));
13281329
}

0 commit comments

Comments
 (0)