Localize (IOS-245)

This commit is contained in:
Nathan Mattes 2024-04-19 15:57:21 +02:00
parent c85b778c64
commit 7c3805dc42
7 changed files with 16 additions and 14 deletions

View File

@ -877,7 +877,9 @@
"account_list": {
"tab_bar_hint": "Current selected profile: %s. Double tap then hold to show account switcher",
"dismiss_account_switcher": "Dismiss Account Switcher",
"add_account": "Add Account"
"add_account": "Add Account",
"logout_all_accounts": "Log Out Of All Accounts",
"logout": "Logout"
},
"bookmark": {
"title": "Bookmarks"

View File

@ -877,7 +877,9 @@
"account_list": {
"tab_bar_hint": "Current selected profile: %s. Double tap then hold to show account switcher",
"dismiss_account_switcher": "Dismiss Account Switcher",
"add_account": "Add Account"
"add_account": "Add Account",
"logout_all_accounts": "Log Out Of All Accounts",
"logout": "Logout"
},
"bookmark": {
"title": "Bookmarks"

View File

@ -99,10 +99,9 @@ extension AccountListViewController: UITableViewDelegate {
guard let diffableDataSource = viewModel.diffableDataSource,
let item = diffableDataSource.itemIdentifier(for: indexPath) else { return nil }
switch item {
case .authentication(let record):
let logoutAction = UIContextualAction(style: .destructive, title: "Logout", handler: { [weak self] action, view, completion in
let logoutAction = UIContextualAction(style: .destructive, title: L10n.Scene.AccountList.logout, handler: { [weak self] action, view, completion in
guard let self else { return }
UserDefaults.shared.setNotificationCountWithAccessToken(accessToken: record.userAccessToken, value: 0)
@ -154,8 +153,7 @@ extension AccountListViewController: UITableViewDelegate {
case .logoutOfAllAccounts:
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
//TODO: Localization
let logoutAction = UIAlertAction(title: "Log Out Of All Accounts", style: .destructive) { _ in
let logoutAction = UIAlertAction(title: L10n.Scene.AccountList.logoutAllAccounts, style: .destructive) { _ in
Task { @MainActor in
self.coordinator.showLoading()
for authenticationBox in self.context.authenticationService.mastodonAuthenticationBoxes {
@ -169,7 +167,7 @@ extension AccountListViewController: UITableViewDelegate {
alert.addAction(logoutAction)
let cancelAction = UIAlertAction(title: "Cancel", style: .default)
let cancelAction = UIAlertAction(title: L10n.Common.Controls.Actions.cancel, style: .default)
alert.addAction(cancelAction)
present(alert, animated: true)
}

View File

@ -1,11 +1,8 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import UIKit
import MetaTextKit
import MastodonAsset
import MastodonLocalization
import MastodonCore
import MastodonUI
final class AddAccountTableViewCell: UITableViewCell {

View File

@ -1,10 +1,7 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import UIKit
import MetaTextKit
import MastodonAsset
import MastodonLocalization
import MastodonCore
final class LogoutOfAllAccountsCell: UITableViewCell {
@ -17,7 +14,7 @@ final class LogoutOfAllAccountsCell: UITableViewCell {
configuration.image = UIImage(systemName: "rectangle.portrait.and.arrow.forward")
configuration.imageProperties.tintColor = .systemRed
configuration.text = "Logout of all accounts"
configuration.text = L10n.Scene.AccountList.logoutAllAccounts
configuration.textProperties.color = .systemRed
configuration.textProperties.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .regular), maximumPointSize: 22)
backgroundColor = .secondarySystemGroupedBackground

View File

@ -572,6 +572,10 @@ public enum L10n {
public static let addAccount = L10n.tr("Localizable", "Scene.AccountList.AddAccount", fallback: "Add Account")
/// Dismiss Account Switcher
public static let dismissAccountSwitcher = L10n.tr("Localizable", "Scene.AccountList.DismissAccountSwitcher", fallback: "Dismiss Account Switcher")
/// Logout
public static let logout = L10n.tr("Localizable", "Scene.AccountList.Logout", fallback: "Logout")
/// Log Out Of All Accounts
public static let logoutAllAccounts = L10n.tr("Localizable", "Scene.AccountList.LogoutAllAccounts", fallback: "Log Out Of All Accounts")
/// Current selected profile: %@. Double tap then hold to show account switcher
public static func tabBarHint(_ p1: Any) -> String {
return L10n.tr("Localizable", "Scene.AccountList.TabBarHint", String(describing: p1), fallback: "Current selected profile: %@. Double tap then hold to show account switcher")

View File

@ -202,6 +202,8 @@ Your profile looks like this to them.";
"Extension.OpenIn.InvalidLinkError" = "This doesn't seem to be a valid Mastodon link.";
"Scene.AccountList.AddAccount" = "Add Account";
"Scene.AccountList.DismissAccountSwitcher" = "Dismiss Account Switcher";
"Scene.AccountList.Logout" = "Logout";
"Scene.AccountList.LogoutAllAccounts" = "Log Out Of All Accounts";
"Scene.AccountList.TabBarHint" = "Current selected profile: %@. Double tap then hold to show account switcher";
"Scene.Bookmark.Title" = "Bookmarks";
"Scene.Compose.Accessibility.AppendAttachment" = "Add Attachment";