From 18e25aea305c1c3f70c4091ad5feb436a5023b47 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 28 Dec 2022 15:03:50 +0100 Subject: [PATCH] Localize username-suggestion (#690) Please be aware of the username-requirements, when changing the localized versions. --- Localization/app.json | 3 ++- Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift | 4 ++-- .../Sources/MastodonLocalization/Generated/Strings.swift | 4 ++++ .../Resources/Base.lproj/Localizable.strings | 1 + .../Resources/en.lproj/Localizable.strings | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index 79cb79f00..100562a0a 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -329,7 +329,8 @@ }, "username": { "placeholder": "username", - "duplicate_prompt": "This username is taken." + "duplicate_prompt": "This username is taken.", + "suggestion": "amazing_%@" }, "display_name": { "placeholder": "display name" diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift index 1f5e449d0..9c9c2ad1d 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift @@ -49,9 +49,9 @@ struct MastodonRegisterView: View { Button { viewModel.usernameErrorPrompt = nil viewModel.usernameValidateState = .empty - viewModel.username = "amazing_\(viewModel.username)" + viewModel.username = L10n.Scene.Register.Input.Username.suggestion(viewModel.username) } label: { - Text("amazing_\(viewModel.username)") + Text(L10n.Scene.Register.Input.Username.suggestion(viewModel.username)) .foregroundColor(Asset.Colors.Brand.blurple.swiftUIColor) .font(Font(UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .bold)))) diff --git a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift index db3680e92..d9323db45 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift +++ b/MastodonSDK/Sources/MastodonLocalization/Generated/Strings.swift @@ -1034,6 +1034,10 @@ public enum L10n { public static let duplicatePrompt = L10n.tr("Localizable", "Scene.Register.Input.Username.DuplicatePrompt", fallback: "This username is taken.") /// username public static let placeholder = L10n.tr("Localizable", "Scene.Register.Input.Username.Placeholder", fallback: "username") + /// amazing_%@ + public static func suggestion(_ p1: Any) -> String { + return L10n.tr("Localizable", "Scene.Register.Input.Username.Suggestion", String(describing: p1), fallback: "amazing_%@") + } } } } diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index 5ccc8a4c5..9ba832e19 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -351,6 +351,7 @@ uploaded to Mastodon."; "Scene.Register.Input.Password.Require" = "Your password needs at least:"; "Scene.Register.Input.Username.DuplicatePrompt" = "This username is taken."; "Scene.Register.Input.Username.Placeholder" = "username"; +"Scene.Register.Input.Username.Suggestion" = "amazing_%@"; "Scene.Register.Title" = "Create account"; "Scene.Report.Content1" = "Are there any other posts you’d like to add to the report?"; "Scene.Report.Content2" = "Is there anything the moderators should know about this report?"; diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/en.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/en.lproj/Localizable.strings index ebbcfa41c..57113f6e3 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/en.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/en.lproj/Localizable.strings @@ -342,6 +342,7 @@ uploaded to Mastodon."; "Scene.Register.Input.Password.Require" = "Your password needs at least:"; "Scene.Register.Input.Username.DuplicatePrompt" = "This username is taken."; "Scene.Register.Input.Username.Placeholder" = "username"; +"Scene.Register.Input.Username.Suggestion" = "amazing_%@"; "Scene.Register.Title" = "Create account"; "Scene.Report.Content1" = "Are there any other posts you’d like to add to the report?"; "Scene.Report.Content2" = "Is there anything the moderators should know about this report?";