From 6329c32903e35e90ba729ebea27bc2ddd0256fc1 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 29 Apr 2019 09:33:19 +0200 Subject: [PATCH] Reuse shared cell values globally --- .../Scenes/ConfigurationViewController.swift | 24 ++++++++-------- .../Scenes/ServiceViewController.swift | 2 +- .../Resources/de.lproj/Localizable.strings | 11 ++++---- .../Resources/en.lproj/Localizable.strings | 11 ++++---- .../Resources/it.lproj/Localizable.strings | 11 ++++---- .../Resources/pt-br.lproj/Localizable.strings | 11 ++++---- .../Resources/ru.lproj/Localizable.strings | 11 ++++---- Passepartout/Sources/SwiftGen+Strings.swift | 28 ++++++++----------- 8 files changed, 55 insertions(+), 54 deletions(-) diff --git a/Passepartout-iOS/Scenes/ConfigurationViewController.swift b/Passepartout-iOS/Scenes/ConfigurationViewController.swift index 0427b9b9..ec2e5316 100644 --- a/Passepartout-iOS/Scenes/ConfigurationViewController.swift +++ b/Passepartout-iOS/Scenes/ConfigurationViewController.swift @@ -274,14 +274,14 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat cell.rightText = V.TlsWrapping.Value.crypt } } else { - cell.rightText = V.All.Value.disabled + cell.rightText = L10n.Global.Cells.disabled } cell.accessoryType = .none cell.isTappable = false case .eku: cell.leftText = V.Eku.caption - cell.rightText = (configuration.checksEKU ?? false) ? V.All.Value.enabled : V.All.Value.disabled + cell.rightText = (configuration.checksEKU ?? false) ? L10n.Global.Cells.enabled : L10n.Global.Cells.disabled cell.accessoryType = .none cell.isTappable = false @@ -296,7 +296,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat if let compressionAlgorithm = configuration.compressionAlgorithm { cell.rightText = compressionAlgorithm.cellDescription } else { - cell.rightText = V.All.Value.disabled + cell.rightText = L10n.Global.Cells.disabled } cell.accessoryType = .none cell.isTappable = false @@ -306,7 +306,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat if let policies = configuration.routingPolicies { cell.rightText = policies.map { $0.rawValue }.joined(separator: " / ") } else { - cell.rightText = V.All.Value.none + cell.rightText = L10n.Global.Cells.none } cell.accessoryType = .none cell.isTappable = false @@ -322,19 +322,19 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat case .dnsDomain: cell.leftText = L10n.Configuration.Cells.DnsDomain.caption - cell.rightText = configuration.searchDomain ?? L10n.Configuration.Cells.All.Value.none + cell.rightText = configuration.searchDomain ?? L10n.Global.Cells.none cell.accessoryType = .none cell.isTappable = false case .httpProxy: cell.leftText = L10n.Configuration.Cells.ProxyHttp.caption - cell.rightText = configuration.httpProxy?.description ?? L10n.Configuration.Cells.All.Value.none + cell.rightText = configuration.httpProxy?.description ?? L10n.Global.Cells.none cell.accessoryType = .none cell.isTappable = false case .httpsProxy: cell.leftText = L10n.Configuration.Cells.ProxyHttps.caption - cell.rightText = configuration.httpsProxy?.description ?? L10n.Configuration.Cells.All.Value.none + cell.rightText = configuration.httpsProxy?.description ?? L10n.Global.Cells.none cell.accessoryType = .none cell.isTappable = false @@ -343,7 +343,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat if let keepAlive = configuration.keepAliveInterval, keepAlive > 0 { cell.rightText = V.KeepAlive.Value.seconds(Int(keepAlive)) } else { - cell.rightText = V.All.Value.disabled + cell.rightText = L10n.Global.Cells.disabled } cell.accessoryType = .none cell.isTappable = false @@ -353,14 +353,14 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat if let reneg = configuration.renegotiatesAfter, reneg > 0 { cell.rightText = V.RenegotiationSeconds.Value.after(TimeInterval(reneg).localized) } else { - cell.rightText = V.All.Value.disabled + cell.rightText = L10n.Global.Cells.disabled } cell.accessoryType = .none cell.isTappable = false case .randomEndpoint: cell.leftText = V.RandomEndpoint.caption - cell.rightText = (configuration.randomizeEndpoint ?? false) ? V.All.Value.enabled : V.All.Value.disabled + cell.rightText = (configuration.randomizeEndpoint ?? false) ? L10n.Global.Cells.enabled : L10n.Global.Cells.disabled cell.accessoryType = .none cell.isTappable = false } @@ -438,7 +438,7 @@ private extension SessionProxy.CompressionFraming { let V = L10n.Configuration.Cells.self switch self { case .disabled: - return V.All.Value.disabled + return L10n.Global.Cells.disabled case .compLZO: return V.CompressionFraming.Value.lzo @@ -454,7 +454,7 @@ private extension SessionProxy.CompressionAlgorithm { let V = L10n.Configuration.Cells.self switch self { case .disabled: - return V.All.Value.disabled + return L10n.Global.Cells.disabled case .LZO: return V.CompressionAlgorithm.Value.lzo diff --git a/Passepartout-iOS/Scenes/ServiceViewController.swift b/Passepartout-iOS/Scenes/ServiceViewController.swift index db4e3816..ad76a344 100644 --- a/Passepartout-iOS/Scenes/ServiceViewController.swift +++ b/Passepartout-iOS/Scenes/ServiceViewController.swift @@ -712,7 +712,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = L10n.Service.Cells.Endpoint.caption - let V = L10n.Service.Cells.Endpoint.Value.self + let V = L10n.Global.Cells.self if let provider = profile as? ProviderConnectionProfile { cell.rightText = provider.usesProviderEndpoint ? V.manual : V.automatic } else { diff --git a/Passepartout/Resources/de.lproj/Localizable.strings b/Passepartout/Resources/de.lproj/Localizable.strings index 52a96a93..f9b5ac53 100644 --- a/Passepartout/Resources/de.lproj/Localizable.strings +++ b/Passepartout/Resources/de.lproj/Localizable.strings @@ -31,6 +31,12 @@ "global.host.title_input.placeholder" = "Mein Profil"; "global.email_not_configured" = "Es wurde kein Email-Account konfiguriert."; +"global.cells.enabled" = "Aktiviert"; +"global.cells.disabled" = "Deaktiviert"; +"global.cells.none" = "Keine"; +"global.cells.automatic" = "Automatisch"; +"global.cells.manual" = "Manuell"; + "reddit.title" = "Reddit"; "reddit.message" = "Wusstest du, daß Passepartout einen Subreddit hat? Abonniere ihn für Updates oder um Features, Probleme, neue Plattformen zu diskutieren - oder was auch immer du möchtest.\n\nDies ist auch ein guter Weg zu zeigen dass dir dieses Projekt etwas bedeutet."; "reddit.buttons.subscribe" = "Jetzt abbonnieren!"; @@ -99,8 +105,6 @@ "service.cells.account.caption" = "Account"; "service.cells.account.none" = "Keiner konfiguriert"; "service.cells.endpoint.caption" = "Endpoint"; -"service.cells.endpoint.value.automatic" = "Automatisch"; -"service.cells.endpoint.value.manual" = "Manuell"; "service.cells.provider.pool.caption" = "Ort"; "service.cells.provider.preset.caption" = "Voreinstellung"; "service.cells.provider.refresh.caption" = "Infrastruktur neu laden"; @@ -198,9 +202,6 @@ "configuration.cells.renegotiation_seconds.caption" = "erneute Aushandlung"; "configuration.cells.renegotiation_seconds.value.after" = "nach %@"; "configuration.cells.random_endpoint.caption" = "Endpunkt zufällig wählen"; -"configuration.cells.all.value.enabled" = "Aktiviert"; -"configuration.cells.all.value.disabled" = "Deaktiviert"; -"configuration.cells.all.value.none" = "Keine"; "debug_log.buttons.previous" = "Zurück"; "debug_log.buttons.next" = "Weiter"; diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index 3f0eac8f..0a5aea00 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -31,6 +31,12 @@ "global.host.title_input.placeholder" = "My profile"; "global.email_not_configured" = "No e-mail account is configured."; +"global.cells.enabled" = "Enabled"; +"global.cells.disabled" = "Disabled"; +"global.cells.none" = "None"; +"global.cells.automatic" = "Automatic"; +"global.cells.manual" = "Manual"; + "reddit.title" = "Reddit"; "reddit.message" = "Did you know that Passepartout has a subreddit? Subscribe for updates or to discuss issues, features, new platforms or whatever you like.\n\nIt's also a great way to show you care about this project."; "reddit.buttons.subscribe" = "Subscribe now!"; @@ -99,8 +105,6 @@ "service.cells.account.caption" = "Account"; "service.cells.account.none" = "None configured"; "service.cells.endpoint.caption" = "Endpoint"; -"service.cells.endpoint.value.automatic" = "Automatic"; -"service.cells.endpoint.value.manual" = "Manual"; "service.cells.provider.pool.caption" = "Location"; "service.cells.provider.preset.caption" = "Preset"; "service.cells.provider.refresh.caption" = "Refresh infrastructure"; @@ -195,9 +199,6 @@ "configuration.cells.renegotiation_seconds.caption" = "Renegotiation"; "configuration.cells.renegotiation_seconds.value.after" = "after %@"; "configuration.cells.random_endpoint.caption" = "Randomize endpoint"; -"configuration.cells.all.value.enabled" = "Enabled"; -"configuration.cells.all.value.disabled" = "Disabled"; -"configuration.cells.all.value.none" = "None"; "debug_log.buttons.previous" = "Previous"; "debug_log.buttons.next" = "Next"; diff --git a/Passepartout/Resources/it.lproj/Localizable.strings b/Passepartout/Resources/it.lproj/Localizable.strings index 16bca85f..74b89638 100644 --- a/Passepartout/Resources/it.lproj/Localizable.strings +++ b/Passepartout/Resources/it.lproj/Localizable.strings @@ -31,6 +31,12 @@ "global.host.title_input.placeholder" = "Il mio profilo"; "global.email_not_configured" = "Nessun account e-mail configurato."; +"global.cells.enabled" = "Abilitato"; +"global.cells.disabled" = "Disabilitato"; +"global.cells.none" = "Nessuno"; +"global.cells.automatic" = "Automatico"; +"global.cells.manual" = "Manuale"; + "reddit.title" = "Reddit"; "reddit.message" = "Sapevi che Passepartout ha un subreddit? Iscriviti per aggiornamenti o per discutere problemi, aggiunte, nuove piattaforme o qualunque cosa tu voglia.\n\nÈ anche un ottimo modo per dimostrare che hai a cuore questo progetto."; "reddit.buttons.subscribe" = "Iscriviti ora!"; @@ -99,8 +105,6 @@ "service.cells.account.caption" = "Account"; "service.cells.account.none" = "Non configurato"; "service.cells.endpoint.caption" = "Endpoint"; -"service.cells.endpoint.value.automatic" = "Automatico"; -"service.cells.endpoint.value.manual" = "Manuale"; "service.cells.provider.pool.caption" = "Regione"; "service.cells.provider.preset.caption" = "Preset"; "service.cells.provider.refresh.caption" = "Aggiorna infrastruttura"; @@ -198,9 +202,6 @@ "configuration.cells.renegotiation_seconds.caption" = "Rinegoziazione"; "configuration.cells.renegotiation_seconds.value.after" = "dopo %@"; "configuration.cells.random_endpoint.caption" = "Endpoint casuale"; -"configuration.cells.all.value.enabled" = "Abilitato"; -"configuration.cells.all.value.disabled" = "Disabilitato"; -"configuration.cells.all.value.none" = "Nessuno"; "debug_log.buttons.previous" = "Precedente"; "debug_log.buttons.next" = "Successivo"; diff --git a/Passepartout/Resources/pt-br.lproj/Localizable.strings b/Passepartout/Resources/pt-br.lproj/Localizable.strings index e7a70209..283be5ba 100644 --- a/Passepartout/Resources/pt-br.lproj/Localizable.strings +++ b/Passepartout/Resources/pt-br.lproj/Localizable.strings @@ -31,6 +31,12 @@ "global.host.title_input.placeholder" = "Meu perfil"; "global.email_not_configured" = "Nenhuma conta de email configurada."; +"global.cells.enabled" = "Ativado"; +"global.cells.disabled" = "Desativado"; +"global.cells.none" = "Nenhum"; +"global.cells.automatic" = "Automático"; +"global.cells.manual" = "Manual"; + "reddit.title" = "Reddit"; "reddit.message" = "Você sabia que Passepartout tem um subreddit? Siga-nos para atualizações ou para discutir problemas, novas funcionalidades, ou qualquer outro tópico.\n\nÉ uma boa maneira de mostrar seu interesse pelo projeto."; "reddit.buttons.subscribe" = "Seguir!"; @@ -99,8 +105,6 @@ "service.cells.account.caption" = "Conta"; "service.cells.account.none" = "Nenhum configurado"; "service.cells.endpoint.caption" = "Endereço"; -"service.cells.endpoint.value.automatic" = "Automático"; -"service.cells.endpoint.value.manual" = "Manual"; "service.cells.provider.pool.caption" = "Localização"; "service.cells.provider.preset.caption" = "Pré-definição"; "service.cells.provider.refresh.caption" = "Atualizar infraestrutura"; @@ -202,9 +206,6 @@ "configuration.cells.renegotiation_seconds.caption" = "Renegociando"; "configuration.cells.renegotiation_seconds.value.after" = "depois de %@"; "configuration.cells.random_endpoint.caption" = "Destino randômico"; -"configuration.cells.all.value.enabled" = "Ativado"; -"configuration.cells.all.value.disabled" = "Desativado"; -"configuration.cells.all.value.none" = "Nenhum"; "debug_log.buttons.previous" = "Anterior"; "debug_log.buttons.next" = "Próximo"; diff --git a/Passepartout/Resources/ru.lproj/Localizable.strings b/Passepartout/Resources/ru.lproj/Localizable.strings index bcc54ed6..92c11549 100644 --- a/Passepartout/Resources/ru.lproj/Localizable.strings +++ b/Passepartout/Resources/ru.lproj/Localizable.strings @@ -31,6 +31,12 @@ "global.host.title_input.placeholder" = "Мой профиль"; "global.email_not_configured" = "E-mail аккаунт не создан."; +"global.cells.enabled" = "Включен"; +"global.cells.disabled" = "Выключен"; +"global.cells.none" = "Нет"; +"global.cells.automatic" = "Автоматически"; +"global.cells.manual" = "Вручную"; + "reddit.title" = "Reddit"; "reddit.message" = "А Вы знали, что Passepartout имеет свой сабреддит? Подписывайтесь для получения обновлений, обсуждения проблем, функций, новых платформ или чего угодно.\n\nЭто также отличный способ показать поддержку проекта."; "reddit.buttons.subscribe" = "Подписаться сейчас!"; @@ -99,8 +105,6 @@ "service.cells.account.caption" = "Аккаунт"; "service.cells.account.none" = "Ничего не создано"; "service.cells.endpoint.caption" = "Конечная точка"; -"service.cells.endpoint.value.automatic" = "Автоматически"; -"service.cells.endpoint.value.manual" = "Вручную"; "service.cells.provider.pool.caption" = "Местоположение"; "service.cells.provider.preset.caption" = "Пресет"; "service.cells.provider.refresh.caption" = "Обновить инфраструктуру"; @@ -198,9 +202,6 @@ "configuration.cells.renegotiation_seconds.caption" = "Перезаключение"; "configuration.cells.renegotiation_seconds.value.after" = "после %@"; "configuration.cells.random_endpoint.caption" = "Рандомная конечная точка"; -"configuration.cells.all.value.enabled" = "Включен"; -"configuration.cells.all.value.disabled" = "Выключен"; -"configuration.cells.all.value.none" = "Нет"; "debug_log.buttons.previous" = "Предыдущий"; "debug_log.buttons.next" = "Следующий"; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index 02128e1e..17e972d8 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -132,16 +132,6 @@ public enum L10n { public enum Configuration { public enum Cells { - public enum All { - public enum Value { - /// Disabled - public static let disabled = L10n.tr("Localizable", "configuration.cells.all.value.disabled") - /// Enabled - public static let enabled = L10n.tr("Localizable", "configuration.cells.all.value.enabled") - /// None - public static let `none` = L10n.tr("Localizable", "configuration.cells.all.value.none") - } - } public enum Cipher { /// Cipher public static let caption = L10n.tr("Localizable", "configuration.cells.cipher.caption") @@ -382,6 +372,18 @@ public enum L10n { public static let next = L10n.tr("Localizable", "global.next") /// OK public static let ok = L10n.tr("Localizable", "global.ok") + public enum Cells { + /// Automatic + public static let automatic = L10n.tr("Localizable", "global.cells.automatic") + /// Disabled + public static let disabled = L10n.tr("Localizable", "global.cells.disabled") + /// Enabled + public static let enabled = L10n.tr("Localizable", "global.cells.enabled") + /// Manual + public static let manual = L10n.tr("Localizable", "global.cells.manual") + /// None + public static let `none` = L10n.tr("Localizable", "global.cells.none") + } public enum Host { public enum TitleInput { /// Acceptable characters are alphanumerics plus dash "-", underscore "_" and dot ".". @@ -686,12 +688,6 @@ public enum L10n { public enum Endpoint { /// Endpoint public static let caption = L10n.tr("Localizable", "service.cells.endpoint.caption") - public enum Value { - /// Automatic - public static let automatic = L10n.tr("Localizable", "service.cells.endpoint.value.automatic") - /// Manual - public static let manual = L10n.tr("Localizable", "service.cells.endpoint.value.manual") - } } public enum Host { public enum Parameters {