Use strings from Localazy (#718)

* Adopt strings from Localazy.

* Remove all old Android strings.

* Disable german snapshot tests for now.

* Rebase and add latest strings.
This commit is contained in:
Doug
2023-03-27 18:18:59 +01:00
committed by GitHub
parent 8daa23b27a
commit 2b753b1135
215 changed files with 1911 additions and 118672 deletions
@@ -125,7 +125,7 @@ class AuthenticationCoordinator: CoordinatorProtocol {
private func startLoading() {
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(id: Self.loadingIndicatorIdentifier,
type: .modal,
title: ElementL10n.loading,
title: L10n.commonLoading,
persistent: true))
}
@@ -95,7 +95,7 @@ final class LoginCoordinator: CoordinatorProtocol {
if isInteractionBlocking {
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(id: Self.loadingIndicatorIdentifier,
type: .modal,
title: ElementL10n.loading,
title: L10n.commonLoading,
persistent: true))
} else {
viewModel.update(isLoading: true)
@@ -108,11 +108,11 @@ final class LoginCoordinator: CoordinatorProtocol {
}
private func indicateSuccess() {
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(title: ElementL10n.dialogTitleSuccess))
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(title: L10n.commonSuccess))
}
private func indicateFailure() {
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(title: ElementL10n.dialogTitleError))
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(title: L10n.commonError))
}
/// Processes an error to either update the flow or display it to the user.
@@ -121,13 +121,13 @@ final class LoginCoordinator: CoordinatorProtocol {
switch error {
case .invalidCredentials:
viewModel.displayError(.alert(ElementL10n.authInvalidLoginParam))
viewModel.displayError(.alert(L10n.screenLoginErrorInvalidCredentials))
case .accountDeactivated:
viewModel.displayError(.alert(ElementL10n.authInvalidLoginDeactivatedAccount))
viewModel.displayError(.alert(L10n.screenLoginErrorDeactivatedAccount))
case .slidingSyncNotAvailable:
viewModel.displayError(.slidingSyncAlert)
default:
viewModel.displayError(.alert(ElementL10n.unknownError))
viewModel.displayError(.alert(L10n.errorUnknown))
}
}
@@ -159,7 +159,7 @@ final class LoginCoordinator: CoordinatorProtocol {
Task {
switch await authenticationService.login(username: username,
password: password,
initialDeviceName: UIDevice.current.initialDisplayName,
initialDeviceName: UIDevice.current.initialDeviceName,
deviceId: nil) {
case .success(let userSession):
callback?(.signedIn(userSession))
@@ -56,19 +56,19 @@ class LoginViewModel: LoginViewModelType, LoginViewModelProtocol {
switch type {
case .alert(let message):
state.bindings.alertInfo = AlertInfo(id: type,
title: ElementL10n.dialogTitleError,
title: L10n.commonError,
message: message)
case .invalidHomeserver:
state.bindings.alertInfo = AlertInfo(id: type,
title: ElementL10n.dialogTitleError,
message: ElementL10n.loginSigninMatrixIdErrorInvalidMatrixId)
title: L10n.commonError,
message: L10n.screenLoginErrorInvalidUserId)
case .slidingSyncAlert:
let openURL = { UIApplication.shared.open(ServiceLocator.shared.settings.slidingSyncLearnMoreURL) }
state.bindings.alertInfo = AlertInfo(id: .slidingSyncAlert,
title: ElementL10n.serverSelectionSlidingSyncAlertTitle,
message: ElementL10n.serverSelectionSlidingSyncAlertMessage,
primaryButton: .init(title: ElementL10n.actionLearnMore, role: .cancel, action: openURL),
secondaryButton: .init(title: ElementL10n.actionCancel, action: nil))
title: L10n.commonServerNotSupported,
message: L10n.screenChangeServerErrorNoSlidingSyncMessage,
primaryButton: .init(title: L10n.actionLearnMore, role: .cancel, action: openURL),
secondaryButton: .init(title: L10n.actionCancel, action: nil))
// Clear out the invalid username to avoid an attempted login to matrix.org
state.bindings.username = ""
@@ -53,7 +53,7 @@ struct LoginScreen: View {
/// The header containing a Welcome Back title.
var header: some View {
Text(ElementL10n.ftueAuthWelcomeBackTitle)
Text(L10n.screenLoginTitle)
.font(.element.title1Bold)
.multilineTextAlignment(.center)
.foregroundColor(.element.primaryContent)
@@ -69,16 +69,16 @@ struct LoginScreen: View {
/// The form with text fields for username and password, along with a submit button.
var loginForm: some View {
VStack(alignment: .leading, spacing: 0) {
Text(ElementL10n.ftueAuthSignInEnterDetails)
Text(L10n.screenLoginFormHeader)
.font(.element.footnote)
.foregroundColor(.element.primaryContent)
.padding(.horizontal, 16)
.padding(.bottom, 8)
TextField(ElementL10n.username,
TextField(L10n.commonUsername,
text: $context.username,
// Prompt colour fixes a flicker that occurs before the text field style introspects the field.
prompt: Text(ElementL10n.username).foregroundColor(.element.tertiaryContent))
prompt: Text(L10n.commonUsername).foregroundColor(.element.tertiaryContent))
.focused($isUsernameFocused)
.textFieldStyle(.elementInput(accessibilityIdentifier: A11yIdentifiers.loginScreen.emailUsername))
.disableAutocorrection(true)
@@ -89,10 +89,10 @@ struct LoginScreen: View {
.onSubmit { isPasswordFocused = true }
.padding(.bottom, 20)
SecureField(ElementL10n.loginSignupPasswordHint,
SecureField(L10n.commonPassword,
text: $context.password,
// Prompt colour fixes a flicker that occurs before the text field style introspects the field.
prompt: Text(ElementL10n.loginSignupPasswordHint).foregroundColor(.element.tertiaryContent))
prompt: Text(L10n.commonPassword).foregroundColor(.element.tertiaryContent))
.focused($isPasswordFocused)
.textFieldStyle(.elementInput(accessibilityIdentifier: A11yIdentifiers.loginScreen.password))
.textContentType(.password)
@@ -102,7 +102,7 @@ struct LoginScreen: View {
Spacer().frame(height: 32)
Button(action: submit) {
Text(ElementL10n.loginContinue)
Text(L10n.actionContinue)
}
.buttonStyle(.elementAction(.xLarge))
.disabled(!context.viewState.canSubmit)
@@ -113,7 +113,7 @@ struct LoginScreen: View {
/// The OIDC button that can be used for login.
var oidcButton: some View {
Button { context.send(viewAction: .continueWithOIDC) } label: {
Text(ElementL10n.loginContinue)
Text(L10n.actionContinue)
}
.buttonStyle(.elementAction(.xLarge))
.accessibilityIdentifier(A11yIdentifiers.loginScreen.oidc)
@@ -121,7 +121,7 @@ struct LoginScreen: View {
/// Text shown if neither password or OIDC login is supported.
var loginUnavailableText: some View {
Text(ElementL10n.autodiscoverWellKnownError)
Text(L10n.screenLoginErrorUnsupportedAuthentication)
.font(.body)
.multilineTextAlignment(.center)
.foregroundColor(.element.primaryContent)
@@ -156,9 +156,13 @@ struct Login_Previews: PreviewProvider {
static var previews: some View {
screen(for: LoginViewModel(homeserver: .mockMatrixDotOrg))
.previewDisplayName("matrix.org")
screen(for: credentialsViewModel)
screen(for: LoginViewModel(homeserver: .mockBasicServer))
.previewDisplayName("Credentials Entered")
screen(for: LoginViewModel(homeserver: .mockOIDC))
.previewDisplayName("OIDC")
screen(for: LoginViewModel(homeserver: .mockUnsupported))
.previewDisplayName("Unsupported")
}
static func screen(for viewModel: LoginViewModel) -> some View {
@@ -30,7 +30,7 @@ struct LoginServerInfoSection: View {
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text(ElementL10n.ftueAuthSignInChooseServerHeader)
Text(L10n.screenLoginServerHeader)
.font(.element.footnote)
.foregroundColor(.element.primaryContent)
.padding(.horizontal, 16)
@@ -34,7 +34,7 @@ enum MockServerSelectionScreenState: CaseIterable {
case .invalidAddress:
let viewModel = ServerSelectionViewModel(homeserverAddress: "thisisbad",
isModallyPresented: true)
viewModel.displayError(.footerMessage(ElementL10n.unknownError))
viewModel.displayError(.footerMessage(L10n.errorUnknown))
return viewModel
case .nonModal:
return ServerSelectionViewModel(homeserverAddress: "https://matrix.org",
@@ -69,7 +69,7 @@ final class ServerSelectionCoordinator: CoordinatorProtocol {
// MARK: - Private
private func startLoading(label: String = ElementL10n.loading) {
private func startLoading(label: String = L10n.commonLoading) {
userIndicatorController.submitIndicator(UserIndicator(type: .modal,
title: label,
persistent: true))
@@ -101,11 +101,11 @@ final class ServerSelectionCoordinator: CoordinatorProtocol {
private func handleError(_ error: AuthenticationServiceError) {
switch error {
case .invalidServer, .invalidHomeserverAddress:
viewModel.displayError(.footerMessage(ElementL10n.loginErrorHomeserverNotFound))
viewModel.displayError(.footerMessage(L10n.screenChangeServerErrorInvalidHomeserver))
case .slidingSyncNotAvailable:
viewModel.displayError(.slidingSyncAlert)
default:
viewModel.displayError(.footerMessage(ElementL10n.unknownError))
viewModel.displayError(.footerMessage(L10n.errorUnknown))
}
}
}
@@ -27,9 +27,9 @@ struct ServerSelectionViewState: BindableState {
/// The message to be shown in the text field footer when no error has occurred.
private let regularFooterMessage = {
let linkPlaceholder = "{link}"
var message = AttributedString(ElementL10n.serverSelectionServerFooter(linkPlaceholder))
var message = AttributedString(L10n.screenChangeServerFormNotice(linkPlaceholder))
message.replace(linkPlaceholder,
with: ElementL10n.actionLearnMore,
with: L10n.actionLearnMore,
asLinkTo: ServiceLocator.shared.settings.slidingSyncLearnMoreURL)
return message
}()
@@ -48,7 +48,7 @@ struct ServerSelectionViewState: BindableState {
/// The title shown on the confirm button.
var buttonTitle: String {
isModallyPresented ? ElementL10n.continue : ElementL10n.actionNext
isModallyPresented ? L10n.actionContinue : L10n.actionNext
}
/// The text field is showing an error.
@@ -48,10 +48,10 @@ class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionVie
case .slidingSyncAlert:
let openURL = { UIApplication.shared.open(ServiceLocator.shared.settings.slidingSyncLearnMoreURL) }
state.bindings.alertInfo = AlertInfo(id: .slidingSyncAlert,
title: ElementL10n.serverSelectionSlidingSyncAlertTitle,
message: ElementL10n.serverSelectionSlidingSyncAlertMessage,
primaryButton: .init(title: ElementL10n.actionLearnMore, role: .cancel, action: openURL),
secondaryButton: .init(title: ElementL10n.actionCancel, action: nil))
title: L10n.commonServerNotSupported,
message: L10n.screenChangeServerErrorNoSlidingSyncMessage,
primaryButton: .init(title: L10n.actionLearnMore, role: .cancel, action: openURL),
secondaryButton: .init(title: L10n.actionCancel, action: nil))
}
}
@@ -43,12 +43,12 @@ struct ServerSelectionScreen: View {
AuthenticationIconImage(image: Image(asset: Asset.Images.serverSelectionIcon), insets: 19)
.padding(.bottom, 8)
Text(ElementL10n.ftueAuthChooseServerTitle)
Text(L10n.commonSelectYourServer)
.font(.element.title2Bold)
.multilineTextAlignment(.center)
.foregroundColor(.element.primaryContent)
Text(ElementL10n.ftueAuthChooseServerSignInSubtitle)
Text(L10n.screenChangeServerSubtitle)
.font(.element.subheadline)
.multilineTextAlignment(.center)
.foregroundColor(.element.tertiaryContent)
@@ -59,8 +59,8 @@ struct ServerSelectionScreen: View {
/// The text field and confirm button where the user enters a server URL.
var serverForm: some View {
VStack(alignment: .leading, spacing: 24) {
TextField(ElementL10n.ftueAuthChooseServerEntryHint, text: $context.homeserverAddress)
.textFieldStyle(.elementInput(labelText: Text(ElementL10n.hsUrl),
TextField(L10n.commonServerUrl, text: $context.homeserverAddress)
.textFieldStyle(.elementInput(labelText: Text(L10n.screenChangeServerFormHeader),
footerText: Text(context.viewState.footerMessage),
isError: context.viewState.isShowingFooterError,
accessibilityIdentifier: A11yIdentifiers.changeServerScreen.server))
@@ -85,7 +85,7 @@ struct ServerSelectionScreen: View {
ToolbarItem(placement: .cancellationAction) {
if context.viewState.isModallyPresented {
Button { context.send(viewAction: .dismiss) } label: {
Text(ElementL10n.actionCancel)
Text(L10n.actionCancel)
}
.accessibilityIdentifier(A11yIdentifiers.changeServerScreen.dismiss)
}
@@ -101,7 +101,7 @@ final class SoftLogoutCoordinator: CoordinatorProtocol {
@MainActor private func startLoading() {
ServiceLocator.shared.userIndicatorController.submitIndicator(UserIndicator(id: Self.loadingIndicatorIdentifier,
type: .modal,
title: ElementL10n.loading,
title: L10n.commonLoading,
persistent: true))
}
@@ -124,7 +124,7 @@ final class SoftLogoutCoordinator: CoordinatorProtocol {
Task {
switch await authenticationService.login(username: username,
password: password,
initialDeviceName: UIDevice.current.initialDisplayName,
initialDeviceName: UIDevice.current.initialDeviceName,
deviceId: parameters.credentials.deviceId) {
case .success(let userSession):
callback?(.signedIn(userSession))
@@ -160,11 +160,11 @@ final class SoftLogoutCoordinator: CoordinatorProtocol {
private func handleError(_ error: AuthenticationServiceError) {
switch error {
case .invalidCredentials:
viewModel.displayError(.alert(ElementL10n.authInvalidLoginParam))
viewModel.displayError(.alert(L10n.screenLoginErrorInvalidCredentials))
case .accountDeactivated:
viewModel.displayError(.alert(ElementL10n.authInvalidLoginDeactivatedAccount))
viewModel.displayError(.alert(L10n.screenLoginErrorDeactivatedAccount))
default:
viewModel.displayError(.alert(ElementL10n.unknownError))
viewModel.displayError(.alert(L10n.errorUnknown))
}
}
}
@@ -50,7 +50,7 @@ class SoftLogoutViewModel: SoftLogoutViewModelType, SoftLogoutViewModelProtocol
switch type {
case .alert(let message):
state.bindings.alertInfo = AlertInfo(id: type,
title: ElementL10n.dialogTitleError,
title: L10n.commonError,
message: message)
case .unknown:
state.bindings.alertInfo = AlertInfo(id: type)
@@ -54,20 +54,20 @@ struct SoftLogoutScreen: View {
/// The title, message and icon at the top of the screen.
var header: some View {
VStack(alignment: .leading, spacing: 16) {
Text(ElementL10n.softLogoutSigninTitle)
Text(UntranslatedL10n.softLogoutSigninTitle)
.font(.element.title2Bold)
.multilineTextAlignment(.leading)
.foregroundColor(.element.primaryContent)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.title)
Text(ElementL10n.softLogoutSigninNotice(context.viewState.credentials.homeserverName, context.viewState.credentials.userDisplayName, context.viewState.credentials.userId))
Text(UntranslatedL10n.softLogoutSigninNotice(context.viewState.credentials.homeserverName, context.viewState.credentials.userDisplayName, context.viewState.credentials.userId))
.font(.element.body)
.multilineTextAlignment(.leading)
.foregroundColor(.element.primaryContent)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.message)
if context.viewState.showRecoverEncryptionKeysMessage {
Text(ElementL10n.softLogoutSigninE2eWarningNotice)
Text(UntranslatedL10n.softLogoutSigninE2eWarningNotice)
.font(.element.body)
.multilineTextAlignment(.leading)
.foregroundColor(.element.primaryContent)
@@ -78,7 +78,7 @@ struct SoftLogoutScreen: View {
/// The form with text fields for username and password, along with a submit button.
var loginForm: some View {
VStack(spacing: 14) {
SecureField(ElementL10n.loginSignupPasswordHint, text: $context.password)
SecureField(L10n.commonPassword, text: $context.password)
.focused($isPasswordFocused)
.textFieldStyle(.elementInput())
.textContentType(.password)
@@ -87,7 +87,7 @@ struct SoftLogoutScreen: View {
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.password)
Button { context.send(viewAction: .forgotPassword) } label: {
Text(ElementL10n.ftueAuthForgotPassword)
Text(UntranslatedL10n.softLogoutForgotPassword)
.font(.element.body)
}
.frame(maxWidth: .infinity, alignment: .trailing)
@@ -95,7 +95,7 @@ struct SoftLogoutScreen: View {
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.forgotPassword)
Button(action: submit) {
Text(ElementL10n.loginSignupSubmit)
Text(L10n.actionNext)
}
.buttonStyle(.elementAction(.xLarge))
.disabled(!context.viewState.canSubmit)
@@ -106,14 +106,14 @@ struct SoftLogoutScreen: View {
/// The OIDC button that can be used for login.
var oidcButton: some View {
Button { context.send(viewAction: .continueWithOIDC) } label: {
Text(ElementL10n.loginContinue)
Text(L10n.actionContinue)
}
.buttonStyle(.elementAction(.xLarge))
}
/// Text shown if neither password or OIDC login is supported.
var loginUnavailableText: some View {
Text(ElementL10n.autodiscoverWellKnownError)
Text(L10n.screenLoginErrorUnsupportedAuthentication)
.font(.body)
.multilineTextAlignment(.center)
.foregroundColor(.element.primaryContent)
@@ -123,13 +123,13 @@ struct SoftLogoutScreen: View {
/// The text field and submit button where the user enters an email address.
var clearDataForm: some View {
VStack(alignment: .leading, spacing: 12) {
Text(ElementL10n.softLogoutClearDataTitle)
Text(UntranslatedL10n.softLogoutClearDataTitle)
.font(.element.title2Bold)
.multilineTextAlignment(.leading)
.foregroundColor(.element.primaryContent)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.clearDataTitle)
Text(ElementL10n.softLogoutClearDataNotice)
Text(UntranslatedL10n.softLogoutClearDataNotice)
.font(.element.body)
.multilineTextAlignment(.leading)
.foregroundColor(.element.primaryContent)
@@ -137,17 +137,17 @@ struct SoftLogoutScreen: View {
.padding(.bottom, 12)
Button(action: clearData) {
Text(ElementL10n.softLogoutClearDataSubmit)
Text(UntranslatedL10n.softLogoutClearDataSubmit)
}
.buttonStyle(.elementAction(.xLarge, color: .element.alert))
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.clearData)
.alert(ElementL10n.softLogoutClearDataDialogTitle,
.alert(UntranslatedL10n.softLogoutClearDataDialogTitle,
isPresented: $showingClearDataConfirmation) {
Button(ElementL10n.actionSignOut,
Button(L10n.screenSignoutConfirmationDialogSubmit,
role: .destructive,
action: clearData)
} message: {
Text(ElementL10n.softLogoutClearDataDialogContent)
Text(UntranslatedL10n.softLogoutClearDataDialogContent)
}
}
}