From 94b5dfb1b545d615f61705d794c0d92742e763b0 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 6 Dec 2017 18:01:44 -0500 Subject: [PATCH] Localize the debug log UI. --- Signal/src/util/Pastelog.m | 82 ++++++++++++------- .../translations/en.lproj/Localizable.strings | 30 +++++++ 2 files changed, 81 insertions(+), 31 deletions(-) diff --git a/Signal/src/util/Pastelog.m b/Signal/src/util/Pastelog.m index deb1b540f..358ca2f0e 100644 --- a/Signal/src/util/Pastelog.m +++ b/Signal/src/util/Pastelog.m @@ -30,37 +30,54 @@ [self submitLogsWithCompletion:^(NSError *error, NSString *urlString) { if (!error) { UIAlertController *alert = [UIAlertController - alertControllerWithTitle:@"One More Step" - message:@"What would you like to do with the link to your debug log?" + alertControllerWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_TITLE", @"Title of the debug log alert.") + message:NSLocalizedString( + @"DEBUG_LOG_ALERT_MESSAGE", @"Message of the debug log alert.") preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:@"Email Support" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *_Nonnull action) { - [Pastelog.sharedManager submitEmail:urlString]; - }]]; - [alert addAction:[UIAlertAction actionWithTitle:@"Copy Link" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *_Nonnull action) { - UIPasteboard *pb = [UIPasteboard generalPasteboard]; - [pb setString:urlString]; - }]]; + [alert + addAction:[UIAlertAction + actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_EMAIL", + @"Label for the 'email debug log' option of the the debug log alert.") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *_Nonnull action) { + [Pastelog.sharedManager submitEmail:urlString]; + }]]; + [alert addAction:[UIAlertAction + actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_COPY_LINK", + @"Label for the 'copy link' option of the the debug log alert.") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *_Nonnull action) { + UIPasteboard *pb = [UIPasteboard generalPasteboard]; + [pb setString:urlString]; + }]]; #ifdef DEBUG - [alert addAction:[UIAlertAction actionWithTitle:@"Send to Self" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *_Nonnull action) { - [Pastelog.sharedManager sendToSelf:urlString]; - }]]; + [alert addAction:[UIAlertAction + actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF", + @"Label for the 'send to self' option of the the debug log alert.") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *_Nonnull action) { + [Pastelog.sharedManager sendToSelf:urlString]; + }]]; #endif - [alert addAction:[UIAlertAction actionWithTitle:@"Open a Bug Report" - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *_Nonnull action) { - [Pastelog.sharedManager prepareRedirection:urlString]; - }]]; + [alert addAction: + [UIAlertAction + actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_BUG_REPORT", + @"Label for the 'Open a Bug Report' option of the the debug log alert.") + style:UIAlertActionStyleCancel + handler:^(UIAlertAction *_Nonnull action) { + [Pastelog.sharedManager prepareRedirection:urlString]; + }]]; UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts; [presentingViewController presentViewController:alert animated:NO completion:nil]; } else{ - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Failed to submit debug log" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; + UIAlertView *alertView = + [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DEBUG_LOG_FAILURE_ALERT_TITLE", + @"Title of the alert indicating the debug log upload failed.") + message:error.localizedDescription + delegate:nil + cancelButtonTitle:@"OK" + otherButtonTitles:nil, nil]; [alertView show]; } }]; @@ -74,9 +91,11 @@ [self sharedManager].block = block; - [self sharedManager].loadingAlert = [UIAlertController alertControllerWithTitle:@"Sending debug log..." - message:nil - preferredStyle:UIAlertControllerStyleAlert]; + [self sharedManager].loadingAlert = + [UIAlertController alertControllerWithTitle:NSLocalizedString(@"DEBUG_LOG_ACTIVITY_INDICATOR", + @"Message indicating that the debug log is being uploaded.") + message:nil + preferredStyle:UIAlertControllerStyleAlert]; UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts; [presentingViewController presentViewController:[self sharedManager].loadingAlert animated:NO completion:nil]; @@ -209,12 +228,13 @@ [pb setString:url]; UIAlertController *alert = - [UIAlertController alertControllerWithTitle:@"GitHub redirection" - message:@"The gist link was copied in your clipboard. You are about to be " - @"redirected to the GitHub issue list." + [UIAlertController alertControllerWithTitle:NSLocalizedString(@"DEBUG_LOG_GITHUB_ISSUE_ALERT_TITLE", + @"Title of the alert before redirecting to Github Issues.") + message:NSLocalizedString(@"DEBUG_LOG_GITHUB_ISSUE_ALERT_MESSAGE", + @"Message of the alert before redirecting to Github Issues.") preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction - actionWithTitle:@"OK" + actionWithTitle:NSLocalizedString(@"OK", @"") style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) { [UIApplication.sharedApplication diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 5c8334918..964b61b90 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -421,6 +421,36 @@ /* Title shown while the app is updating its database. */ "DATABASE_VIEW_OVERLAY_TITLE" = "Updating Database"; +/* Message indicating that the debug log is being uploaded. */ +"DEBUG_LOG_ACTIVITY_INDICATOR" = "Sending debug log..."; + +/* Message of the debug log alert. */ +"DEBUG_LOG_ALERT_MESSAGE" = "What would you like to do with the link to your debug log?"; + +/* Label for the 'Open a Bug Report' option of the the debug log alert. */ +"DEBUG_LOG_ALERT_OPTION_BUG_REPORT" = "Open a Bug Report"; + +/* Label for the 'copy link' option of the the debug log alert. */ +"DEBUG_LOG_ALERT_OPTION_COPY_LINK" = "Copy Link"; + +/* Label for the 'email debug log' option of the the debug log alert. */ +"DEBUG_LOG_ALERT_OPTION_EMAIL" = "Email Support"; + +/* Label for the 'send to self' option of the the debug log alert. */ +"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF" = "Send to Self"; + +/* Title of the debug log alert. */ +"DEBUG_LOG_ALERT_TITLE" = "One More Step"; + +/* Title of the alert indicating the debug log upload failed. */ +"DEBUG_LOG_FAILURE_ALERT_TITLE" = "Failed to submit debug log"; + +/* Message of the alert before redirecting to Github Issues. */ +"DEBUG_LOG_GITHUB_ISSUE_ALERT_MESSAGE" = "The gist link was copied in your clipboard. You are about to be redirected to the GitHub issue list."; + +/* Title of the alert before redirecting to Github Issues. */ +"DEBUG_LOG_GITHUB_ISSUE_ALERT_TITLE" = "GitHub redirection"; + /* {{Short Date}} when device last communicated with Signal Server. */ "DEVICE_LAST_ACTIVE_AT_LABEL" = "Last active: %@";