Skip to content

Commit

Permalink
PIA-1178: Add tvOS translations (#62)
Browse files Browse the repository at this point in the history
* PIA-1178: Integrate translations on PIA tvOS

* PIA-1178: Add translations to tvOS views
  • Loading branch information
kp-said-rehouni authored Jan 17, 2024
1 parent 63525f2 commit 11c9e89
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion PIA VPN-tvOS/Dashboard/UI/DashboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct DashboardView: View {
Button {
viewModel.logOut()
} label: {
Text("LogOut")
Text(L10n.Localizable.Menu.Logout.confirm)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class LoginPresentableErrorMapper {
func map(error: LoginError) -> String? {
switch error {
case .unauthorized:
return "Your username or password is incorrect."
return L10n.Welcome.Login.Error.unauthorized
case .throttled(retryAfter: let retryAfter):
return "Too many failed login attempts with this username. Please try again after \(retryAfter) second(s)."
return L10n.Welcome.Login.Error.throttled(retryAfter)
case .generic(message: let message):
return message
case .usernameWrongFormat, .passwordWrongFormat:
return "You must enter a username and password."
return L10n.Welcome.Login.Error.validation
default:
return nil
}
Expand Down
13 changes: 6 additions & 7 deletions PIA VPN-tvOS/Login/UI/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@ struct LoginView: View {
if viewModel.loginStatus == .isLogging {
ProgressView().progressViewStyle(.circular)
}

VStack {
Text("Sign in to your account")
Text(L10n.Welcome.Login.title)
.font(.system(size: 36))
TextField("Username(p1234567)", text: $userName)
SecureField("Password", text: $password)
TextField(L10n.Welcome.Login.Username.placeholder, text: $userName)
SecureField(L10n.Welcome.Login.Password.placeholder, text: $password)
Button(action: {
viewModel.login(username: userName, password: password)
}, label: {
Text("LOGIN")
Text(L10n.Welcome.Purchase.Login.button)
})
}
}
}.alert("Error", isPresented: $viewModel.shouldShowErrorMessage, actions: {
Button("OK") {}
}.alert(L10n.Localizable.Global.error, isPresented: $viewModel.shouldShowErrorMessage, actions: {
Button(L10n.Localizable.Global.ok) {}
}, message: {
if case .failed(let errorMessage, _) = viewModel.loginStatus, let errorMessage = errorMessage {
Text(errorMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VPNConfigurationInstallingErrorMapper {

switch error {
case .userCanceled:
return "We need this permission for the application to function."
return L10n.Localizable.VpnPermission.Disallow.Message.basic
default:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ struct VPNConfigurationInstallingView: View {
var body: some View {
VStack {
VStack {
Text("PIA needs access to your VPN profiles to secure your traffic.")
Text(L10n.Localizable.VpnPermission.Body.title)
.font(.title2)
.bold().padding(EdgeInsets(top: 0, leading: 0, bottom: 20, trailing: 0))
Text("You’ll see a prompt for PIA VPN and need to allow access to VPN configurations.\nTo proceed tap on “OK”")
Text(L10n.Localizable.VpnPermission.Body.subtitle(L10n.Welcome.Purchase.continue))
.font(.headline)
.foregroundStyle(.gray)
}.padding(EdgeInsets(top: 20, leading: 0, bottom: 0, trailing: 0))
Expand All @@ -30,14 +30,14 @@ struct VPNConfigurationInstallingView: View {
Button {
viewModel.install()
} label: {
Text("Continue")
Text(L10n.Welcome.Purchase.continue)
}
Text("We don’t monitor, filter or log any network activity.")
Text(L10n.Localizable.VpnPermission.Body.footer)
.font(.footnote)
.foregroundStyle(.gray)
}
}.alert("PIA", isPresented: $viewModel.shouldShowErrorMessage, actions: {
Button("OK") {
Button(L10n.Localizable.Global.ok) {
Task {
viewModel.install()
}
Expand Down
8 changes: 8 additions & 0 deletions PIA VPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@
E5217F732AEB055D00123442 /* Client+Storyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5217F712AEB055D00123442 /* Client+Storyboard.swift */; };
E52E68FE2B55E47600471913 /* Routes.swift in Sources */ = {isa = PBXBuildFile; fileRef = E52E68FD2B55E47500471913 /* Routes.swift */; };
E52E69002B56ABE400471913 /* AppRouterSpy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E52E68FF2B56ABE400471913 /* AppRouterSpy.swift */; };
E52E69012B56E22000471913 /* UI.strings in Resources */ = {isa = PBXBuildFile; fileRef = E501CBBA2AE9806800515006 /* UI.strings */; };
E52E69022B56E22A00471913 /* Signup.strings in Resources */ = {isa = PBXBuildFile; fileRef = E501CBCE2AE9806800515006 /* Signup.strings */; };
E52E69032B56E22D00471913 /* Welcome.strings in Resources */ = {isa = PBXBuildFile; fileRef = E501CBD02AE9806800515006 /* Welcome.strings */; };
E52E69042B56E26700471913 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0E7EC043209326E30029811E /* Localizable.strings */; };
E59E8F942AEA7A29009278F5 /* ActivityButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = E59E8F932AEA7A29009278F5 /* ActivityButton.swift */; };
E59E8F952AEA7A29009278F5 /* ActivityButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = E59E8F932AEA7A29009278F5 /* ActivityButton.swift */; };
E59E8F972AEA7A5A009278F5 /* AutolayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E59E8F962AEA7A5A009278F5 /* AutolayoutViewController.swift */; };
Expand Down Expand Up @@ -3343,9 +3347,13 @@
buildActionMask = 2147483647;
files = (
694AC74F2B17ADF9007E7B56 /* Images.xcassets in Resources */,
E52E69032B56E22D00471913 /* Welcome.strings in Resources */,
69F0534A2B1F1D2800AE0665 /* Colors.xcassets in Resources */,
E5C507812B0E145000200A6A /* Preview Assets.xcassets in Resources */,
E5C5077E2B0E145000200A6A /* Assets.xcassets in Resources */,
E52E69042B56E26700471913 /* Localizable.strings in Resources */,
E52E69022B56E22A00471913 /* Signup.strings in Resources */,
E52E69012B56E22000471913 /* UI.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

0 comments on commit 11c9e89

Please sign in to comment.