Commit 18600f3a authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] I18N for the host setup view

Add i18n support for the host setup view. Also add missing strings in the
settings menu.

Bug: 747091
Change-Id: Ideea85dc2d0d9933e39bfe9c6e9a1b00a190291c
Reviewed-on: https://chromium-review.googlesource.com/580729Reviewed-by: default avatarScott Nichols <nicholss@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488711}
parent 70bac5d9
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
#import "remoting/ios/app/app_delegate.h" #import "remoting/ios/app/app_delegate.h"
#import "remoting/ios/app/remoting_theme.h" #import "remoting/ios/app/remoting_theme.h"
#include "remoting/base/string_resources.h"
#include "ui/base/l10n/l10n_util.h"
static const CGFloat kTopPadding = 6.f; static const CGFloat kTopPadding = 6.f;
@implementation HostSetupFooterView @implementation HostSetupFooterView
...@@ -29,8 +32,9 @@ static const CGFloat kTopPadding = 6.f; ...@@ -29,8 +32,9 @@ static const CGFloat kTopPadding = 6.f;
MDCRaisedButton* raisedButton = [[MDCRaisedButton alloc] init]; MDCRaisedButton* raisedButton = [[MDCRaisedButton alloc] init];
[raisedButton setTitle:@"Email link and instructions" [raisedButton
forState:UIControlStateNormal]; setTitle:l10n_util::GetNSString(IDS_EMAIL_LINKS_AND_INSTRUCTIONS)
forState:UIControlStateNormal];
raisedButton.customTitleColor = RemotingTheme.buttonTextColor; raisedButton.customTitleColor = RemotingTheme.buttonTextColor;
[raisedButton setBackgroundColor:RemotingTheme.buttonBackgroundColor [raisedButton setBackgroundColor:RemotingTheme.buttonBackgroundColor
forState:UIControlStateNormal]; forState:UIControlStateNormal];
......
...@@ -11,14 +11,12 @@ ...@@ -11,14 +11,12 @@
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
#import "remoting/ios/app/remoting_theme.h" #import "remoting/ios/app/remoting_theme.h"
#include "remoting/base/string_resources.h"
#include "ui/base/l10n/l10n_util.h"
static const CGFloat kSetupTitleInset = 22.f; static const CGFloat kSetupTitleInset = 22.f;
static const CGFloat kBottomPadding = 6.f; static const CGFloat kBottomPadding = 6.f;
// TODO(yuweih): i18n
static NSString* const kSetupTitle =
@"Welcome to Chrome Remote Desktop.\n"
@"Let's get you setup.";
@implementation HostSetupHeaderView @implementation HostSetupHeaderView
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
...@@ -32,7 +30,7 @@ static NSString* const kSetupTitle = ...@@ -32,7 +30,7 @@ static NSString* const kSetupTitle =
self.backgroundColor = RemotingTheme.setupListBackgroundColor; self.backgroundColor = RemotingTheme.setupListBackgroundColor;
UILabel* titleLabel = [[UILabel alloc] init]; UILabel* titleLabel = [[UILabel alloc] init];
titleLabel.text = kSetupTitle; titleLabel.text = l10n_util::GetNSString(IDS_HOST_SETUP_TITLE);
titleLabel.font = MDCTypography.titleFont; titleLabel.font = MDCTypography.titleFont;
titleLabel.numberOfLines = 2; titleLabel.numberOfLines = 2;
titleLabel.adjustsFontSizeToFitWidth = YES; titleLabel.adjustsFontSizeToFitWidth = YES;
......
...@@ -15,27 +15,21 @@ ...@@ -15,27 +15,21 @@
#import "remoting/ios/app/host_setup_view_cell.h" #import "remoting/ios/app/host_setup_view_cell.h"
#import "remoting/ios/app/remoting_theme.h" #import "remoting/ios/app/remoting_theme.h"
static NSString* const kReusableIdentifierItem = @"remotingSetupStepVCItem"; #include "base/strings/string_split.h"
#include "base/strings/sys_string_conversions.h"
#include "remoting/base/string_resources.h"
#include "ui/base/l10n/l10n_util.h"
// TODO(yuweih): i18n static NSString* const kReusableIdentifierItem = @"remotingSetupStepVCItem";
// Clang doesn't allow string literal concatenation in string array but
// `git cl format` will break down long lines into multiple string literals.
// This is to disable the warning until we move these to a better place.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-string-concatenation"
static NSArray<NSString*>* const kSetupSteps = @[
@"Go to the computer that you want to remotely access",
@"Visit google.com/remotedesktop from your Chrome browser",
@"Install the Chrome Remote Desktop software and follow the instructions to "
"complete the setup",
@"After your remote device is setup, you can access it directly from this "
"page",
];
#pragma clang diagnostic pop
static const CGFloat kHeaderHeight = 80.f; static const CGFloat kHeaderHeight = 80.f;
static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView
@interface HostSetupViewController () {
std::vector<std::string> setupSteps;
}
@end
@implementation HostSetupViewController @implementation HostSetupViewController
@synthesize scrollViewDelegate = _scrollViewDelegate; @synthesize scrollViewDelegate = _scrollViewDelegate;
...@@ -56,6 +50,10 @@ static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView ...@@ -56,6 +50,10 @@ static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView
[self.collectionView registerClass:[UICollectionReusableView class] [self.collectionView registerClass:[UICollectionReusableView class]
forSupplementaryViewOfKind:UICollectionElementKindSectionFooter forSupplementaryViewOfKind:UICollectionElementKindSectionFooter
withReuseIdentifier:UICollectionElementKindSectionFooter]; withReuseIdentifier:UICollectionElementKindSectionFooter];
setupSteps = base::SplitString(
l10n_util::GetStringUTF8(IDS_HOST_SETUP_INSTRUCTIONS), "\n",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
} }
return self; return self;
} }
...@@ -73,7 +71,7 @@ static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView ...@@ -73,7 +71,7 @@ static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView
- (NSInteger)collectionView:(UICollectionView*)collectionView - (NSInteger)collectionView:(UICollectionView*)collectionView
numberOfItemsInSection:(NSInteger)section { numberOfItemsInSection:(NSInteger)section {
return kSetupSteps.count; return setupSteps.size();
} }
- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
...@@ -81,7 +79,8 @@ static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView ...@@ -81,7 +79,8 @@ static const CGFloat kFooterHeight = 15.f; // 80.0f for HostSetupFooterView
HostSetupViewCell* cell = [collectionView HostSetupViewCell* cell = [collectionView
dequeueReusableCellWithReuseIdentifier:kReusableIdentifierItem dequeueReusableCellWithReuseIdentifier:kReusableIdentifierItem
forIndexPath:indexPath]; forIndexPath:indexPath];
[cell setContentText:kSetupSteps[indexPath.item] number:indexPath.item + 1]; NSString* contentText = base::SysUTF8ToNSString(setupSteps[indexPath.item]);
[cell setContentText:contentText number:indexPath.item + 1];
return cell; return cell;
} }
......
...@@ -264,7 +264,7 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext"; ...@@ -264,7 +264,7 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext";
SettingOption* directMode = [[SettingOption alloc] init]; SettingOption* directMode = [[SettingOption alloc] init];
directMode.title = l10n_util::GetNSString(IDS_SELECT_TOUCH_MODE); directMode.title = l10n_util::GetNSString(IDS_SELECT_TOUCH_MODE);
// TODO(nicholss): I think this text changes based on value. Confirm. // TODO(nicholss): I think this text changes based on value. Confirm.
directMode.subtext = @"Screen acts like a touch screen"; directMode.subtext = l10n_util::GetNSString(IDS_TOUCH_MODE_DESCRIPTION);
directMode.style = OptionSelector; directMode.style = OptionSelector;
directMode.checked = directMode.checked =
self.inputMode == remoting::GestureInterpreter::DIRECT_INPUT_MODE; self.inputMode == remoting::GestureInterpreter::DIRECT_INPUT_MODE;
...@@ -277,7 +277,7 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext"; ...@@ -277,7 +277,7 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext";
SettingOption* trackpadMode = [[SettingOption alloc] init]; SettingOption* trackpadMode = [[SettingOption alloc] init];
trackpadMode.title = l10n_util::GetNSString(IDS_SELECT_TRACKPAD_MODE); trackpadMode.title = l10n_util::GetNSString(IDS_SELECT_TRACKPAD_MODE);
// TODO(nicholss): I think this text changes based on value. Confirm. // TODO(nicholss): I think this text changes based on value. Confirm.
trackpadMode.subtext = @"Screen acts like a trackpad"; trackpadMode.subtext = l10n_util::GetNSString(IDS_TRACKPAD_MODE_DESCRIPTION);
trackpadMode.style = OptionSelector; trackpadMode.style = OptionSelector;
trackpadMode.checked = trackpadMode.checked =
self.inputMode == remoting::GestureInterpreter::TRACKPAD_INPUT_MODE; self.inputMode == remoting::GestureInterpreter::TRACKPAD_INPUT_MODE;
......
...@@ -743,12 +743,32 @@ For information about privacy, please see the Google Privacy Policy (http://goo. ...@@ -743,12 +743,32 @@ For information about privacy, please see the Google Privacy Policy (http://goo.
<message desc="Subtitle (description) of the option controlling whether or not the remote desktop is resized to match the window size as closely as possible." name="IDS_RESIZE_TO_CLIENT_SUBTITLE"> <message desc="Subtitle (description) of the option controlling whether or not the remote desktop is resized to match the window size as closely as possible." name="IDS_RESIZE_TO_CLIENT_SUBTITLE">
Update remote resolution to match window Update remote resolution to match window
</message> </message>
<message desc="Subtitle (description) for the touch mode. In this mode, there is no visible mouse pointer and the user must tap on the screen to simulate a left-click." name="IDS_TOUCH_MODE_DESCRIPTION">
Screen acts like a touch screen
</message>
<message desc="Subtitle (description) for the trackpad mode. In this mode, In this mode, the mouse cursor is visible and the screen acts as a laptop's trackpad." name="IDS_TRACKPAD_MODE_DESCRIPTION">
Screen acts like a trackpad
</message>
<!-- This is a verbatim transcription for the description. See also IDS_REMEMBER_PIN. --> <!-- This is a verbatim transcription for the description. See also IDS_REMEMBER_PIN. -->
<message desc="Check-box displayed when the user enters their PIN to connect to a host, avoiding the need to enter the PIN each time." name="IDS_REMEMBER_PIN_ON_THIS_DEVICE"> <message desc="Check-box displayed when the user enters their PIN to connect to a host, avoiding the need to enter the PIN each time." name="IDS_REMEMBER_PIN_ON_THIS_DEVICE">
Remember my PIN on this device. Remember my PIN on this device.
</message> </message>
<message desc="Title for the instructions for setting up a remote host. Shown when the user has no host available. One sentence per line." name="IDS_HOST_SETUP_TITLE">
Welcome to Chrome Remote Desktop.
Let's get you setup.
</message>
<message desc="Instructions for setting up a computer to be remotely accessible. Please make sure the translated string has exactly the same number of lines." name="IDS_HOST_SETUP_INSTRUCTIONS">
Go to the computer that you want to remotely access
Visit google.com/remotedesktop from your Chrome browser
Install the Chrome Remote Desktop software and follow the instructions to complete the setup
After your remote device is setup, you can access it directly from this page
</message>
<message desc="Label for a button for sending the user an email with link and instructions for setting up a computer for remote access." name="IDS_EMAIL_LINKS_AND_INSTRUCTIONS">
Email link and instructions
</message>
<message desc="Label for the access code entry box. This is where the client user enters the code that permits access to the host." name="IDS_ACCESS_CODE"> <message desc="Label for the access code entry box. This is where the client user enters the code that permits access to the host." name="IDS_ACCESS_CODE">
Access code Access code
</message> </message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment