diff --git a/assets/l10n/app_en.arb b/assets/l10n/app_en.arb index 626f72e683..31980b931a 100644 --- a/assets/l10n/app_en.arb +++ b/assets/l10n/app_en.arb @@ -308,6 +308,17 @@ "@loginServerUrlInputLabel": { "description": "Input label in login page for Zulip server URL entry." }, + "errorUnableToOpenLinkTitle": "Unable to open link", + "@errorUnableToOpenLinkTitle": { + "description": "Error title when a link fails to open." + }, + "errorUnableToOpenLinkMessage": "Link could not be opened: {url}", + "@errorUnableToOpenLinkMessage": { + "description": "Error message when a link fails to open.", + "placeholders": { + "url": {"type": "String", "example": "http://example.com/"} + } + }, "loginHidePassword": "Hide password", "@loginHidePassword": { "description": "Icon label for button to hide password in input form." diff --git a/lib/widgets/launch_url.dart b/lib/widgets/launch_url.dart index 6c7ba36e91..3d3e900c7c 100644 --- a/lib/widgets/launch_url.dart +++ b/lib/widgets/launch_url.dart @@ -1,6 +1,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_gen/gen_l10n/zulip_localizations.dart'; import '../model/binding.dart'; import '../model/internal_link.dart'; @@ -10,11 +11,12 @@ import 'store.dart'; /// Handles showing an error dialog with a customizable message. Future _showError(BuildContext context, String? message, String urlString) { + final zulipLocalizations = ZulipLocalizations.of(context); return showErrorDialog( context: context, - title: 'Unable to open link', + title: zulipLocalizations.errorUnableToOpenLinkTitle, message: [ - 'Link could not be opened: $urlString', + zulipLocalizations.errorUnableToOpenLinkMessage(urlString), if (message != null) message, ].join("\n\n")); }