From 4360fa48841b041ecd5614a37c45b61695dcc821 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Mon, 25 Sep 2023 21:05:10 +0100 Subject: [PATCH] lightbox: Translations --- assets/l10n/app_en.arb | 8 ++++++++ lib/widgets/lightbox.dart | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/l10n/app_en.arb b/assets/l10n/app_en.arb index e8366bf1098..5ec9b94b09d 100644 --- a/assets/l10n/app_en.arb +++ b/assets/l10n/app_en.arb @@ -67,6 +67,10 @@ "@errorQuotationFailed": { "description": "Error message when quoting a message failed." }, + "successLinkCopied": "Link copied", + "@successLinkCopied": { + "description": "Success message after copy link action completed." + }, "successMessageCopied": "Message Copied", "@successMessageCopied": { "description": "Message when content of a message was copied to the users system clipboard." @@ -83,6 +87,10 @@ "@errorDialogContinue": { "description": "Button label in error dialogs to acknowledge error." }, + "lightboxCopyLinkTooltip": "Copy link", + "@lightboxCopyLinkTooltip": { + "description": "Tooltip in lightbox for the copy link action." + }, "subscribedToNStreams": "Subscribed to {num, plural, =0{no streams} =1{1 stream} other{{num} streams}}", "@subscribedToNStreams": { "description": "Test page label showing number of streams user is subscribed to.", diff --git a/lib/widgets/lightbox.dart b/lib/widgets/lightbox.dart index 829b7ab5270..4f47e9e9195 100644 --- a/lib/widgets/lightbox.dart +++ b/lib/widgets/lightbox.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_gen/gen_l10n/zulip_localizations.dart'; import 'package:intl/intl.dart'; import '../api/model/model.dart'; @@ -70,12 +71,13 @@ class _CopyLinkButton extends StatelessWidget { @override Widget build(BuildContext context) { + final zulipLocalizations = ZulipLocalizations.of(context); return IconButton( - tooltip: 'Copy link', + tooltip: zulipLocalizations.lightboxCopyLinkTooltip, icon: const Icon(Icons.copy), onPressed: () async { - // TODO(i18n) - copyWithPopup(context: context, successContent: const Text('Link copied'), + copyWithPopup(context: context, + successContent: Text(zulipLocalizations.successLinkCopied), data: ClipboardData(text: url.toString())); }); } @@ -136,7 +138,7 @@ class _LightboxPageState extends State<_LightboxPage> { if (_headerFooterVisible) { // TODO(#45): Format with e.g. "Yesterday at 4:47 PM" final timestampText = DateFormat - .yMMMd(/* TODO(i18n): Pass selected language here, I think? */) + .yMMMd(/* TODO(#278): Pass selected language here, I think? */) .add_Hms() .format(DateTime.fromMillisecondsSinceEpoch(widget.message.timestamp * 1000));