Reuse shared cell values globally

This commit is contained in:
Davide De Rosa 2019-04-29 09:33:19 +02:00
parent 6f460031a2
commit 6329c32903
8 changed files with 55 additions and 54 deletions

View File

@ -274,14 +274,14 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
cell.rightText = V.TlsWrapping.Value.crypt cell.rightText = V.TlsWrapping.Value.crypt
} }
} else { } else {
cell.rightText = V.All.Value.disabled cell.rightText = L10n.Global.Cells.disabled
} }
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
case .eku: case .eku:
cell.leftText = V.Eku.caption 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.accessoryType = .none
cell.isTappable = false cell.isTappable = false
@ -296,7 +296,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
if let compressionAlgorithm = configuration.compressionAlgorithm { if let compressionAlgorithm = configuration.compressionAlgorithm {
cell.rightText = compressionAlgorithm.cellDescription cell.rightText = compressionAlgorithm.cellDescription
} else { } else {
cell.rightText = V.All.Value.disabled cell.rightText = L10n.Global.Cells.disabled
} }
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
@ -306,7 +306,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
if let policies = configuration.routingPolicies { if let policies = configuration.routingPolicies {
cell.rightText = policies.map { $0.rawValue }.joined(separator: " / ") cell.rightText = policies.map { $0.rawValue }.joined(separator: " / ")
} else { } else {
cell.rightText = V.All.Value.none cell.rightText = L10n.Global.Cells.none
} }
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
@ -322,19 +322,19 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .dnsDomain: case .dnsDomain:
cell.leftText = L10n.Configuration.Cells.DnsDomain.caption 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.accessoryType = .none
cell.isTappable = false cell.isTappable = false
case .httpProxy: case .httpProxy:
cell.leftText = L10n.Configuration.Cells.ProxyHttp.caption 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.accessoryType = .none
cell.isTappable = false cell.isTappable = false
case .httpsProxy: case .httpsProxy:
cell.leftText = L10n.Configuration.Cells.ProxyHttps.caption 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.accessoryType = .none
cell.isTappable = false cell.isTappable = false
@ -343,7 +343,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
if let keepAlive = configuration.keepAliveInterval, keepAlive > 0 { if let keepAlive = configuration.keepAliveInterval, keepAlive > 0 {
cell.rightText = V.KeepAlive.Value.seconds(Int(keepAlive)) cell.rightText = V.KeepAlive.Value.seconds(Int(keepAlive))
} else { } else {
cell.rightText = V.All.Value.disabled cell.rightText = L10n.Global.Cells.disabled
} }
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
@ -353,14 +353,14 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
if let reneg = configuration.renegotiatesAfter, reneg > 0 { if let reneg = configuration.renegotiatesAfter, reneg > 0 {
cell.rightText = V.RenegotiationSeconds.Value.after(TimeInterval(reneg).localized) cell.rightText = V.RenegotiationSeconds.Value.after(TimeInterval(reneg).localized)
} else { } else {
cell.rightText = V.All.Value.disabled cell.rightText = L10n.Global.Cells.disabled
} }
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
case .randomEndpoint: case .randomEndpoint:
cell.leftText = V.RandomEndpoint.caption 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.accessoryType = .none
cell.isTappable = false cell.isTappable = false
} }
@ -438,7 +438,7 @@ private extension SessionProxy.CompressionFraming {
let V = L10n.Configuration.Cells.self let V = L10n.Configuration.Cells.self
switch self { switch self {
case .disabled: case .disabled:
return V.All.Value.disabled return L10n.Global.Cells.disabled
case .compLZO: case .compLZO:
return V.CompressionFraming.Value.lzo return V.CompressionFraming.Value.lzo
@ -454,7 +454,7 @@ private extension SessionProxy.CompressionAlgorithm {
let V = L10n.Configuration.Cells.self let V = L10n.Configuration.Cells.self
switch self { switch self {
case .disabled: case .disabled:
return V.All.Value.disabled return L10n.Global.Cells.disabled
case .LZO: case .LZO:
return V.CompressionAlgorithm.Value.lzo return V.CompressionAlgorithm.Value.lzo

View File

@ -712,7 +712,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
let cell = Cells.setting.dequeue(from: tableView, for: indexPath) let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Service.Cells.Endpoint.caption 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 { if let provider = profile as? ProviderConnectionProfile {
cell.rightText = provider.usesProviderEndpoint ? V.manual : V.automatic cell.rightText = provider.usesProviderEndpoint ? V.manual : V.automatic
} else { } else {

View File

@ -31,6 +31,12 @@
"global.host.title_input.placeholder" = "Mein Profil"; "global.host.title_input.placeholder" = "Mein Profil";
"global.email_not_configured" = "Es wurde kein Email-Account konfiguriert."; "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.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.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!"; "reddit.buttons.subscribe" = "Jetzt abbonnieren!";
@ -99,8 +105,6 @@
"service.cells.account.caption" = "Account"; "service.cells.account.caption" = "Account";
"service.cells.account.none" = "Keiner konfiguriert"; "service.cells.account.none" = "Keiner konfiguriert";
"service.cells.endpoint.caption" = "Endpoint"; "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.pool.caption" = "Ort";
"service.cells.provider.preset.caption" = "Voreinstellung"; "service.cells.provider.preset.caption" = "Voreinstellung";
"service.cells.provider.refresh.caption" = "Infrastruktur neu laden"; "service.cells.provider.refresh.caption" = "Infrastruktur neu laden";
@ -198,9 +202,6 @@
"configuration.cells.renegotiation_seconds.caption" = "erneute Aushandlung"; "configuration.cells.renegotiation_seconds.caption" = "erneute Aushandlung";
"configuration.cells.renegotiation_seconds.value.after" = "nach %@"; "configuration.cells.renegotiation_seconds.value.after" = "nach %@";
"configuration.cells.random_endpoint.caption" = "Endpunkt zufällig wählen"; "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.previous" = "Zurück";
"debug_log.buttons.next" = "Weiter"; "debug_log.buttons.next" = "Weiter";

View File

@ -31,6 +31,12 @@
"global.host.title_input.placeholder" = "My profile"; "global.host.title_input.placeholder" = "My profile";
"global.email_not_configured" = "No e-mail account is configured."; "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.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.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!"; "reddit.buttons.subscribe" = "Subscribe now!";
@ -99,8 +105,6 @@
"service.cells.account.caption" = "Account"; "service.cells.account.caption" = "Account";
"service.cells.account.none" = "None configured"; "service.cells.account.none" = "None configured";
"service.cells.endpoint.caption" = "Endpoint"; "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.pool.caption" = "Location";
"service.cells.provider.preset.caption" = "Preset"; "service.cells.provider.preset.caption" = "Preset";
"service.cells.provider.refresh.caption" = "Refresh infrastructure"; "service.cells.provider.refresh.caption" = "Refresh infrastructure";
@ -195,9 +199,6 @@
"configuration.cells.renegotiation_seconds.caption" = "Renegotiation"; "configuration.cells.renegotiation_seconds.caption" = "Renegotiation";
"configuration.cells.renegotiation_seconds.value.after" = "after %@"; "configuration.cells.renegotiation_seconds.value.after" = "after %@";
"configuration.cells.random_endpoint.caption" = "Randomize endpoint"; "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.previous" = "Previous";
"debug_log.buttons.next" = "Next"; "debug_log.buttons.next" = "Next";

View File

@ -31,6 +31,12 @@
"global.host.title_input.placeholder" = "Il mio profilo"; "global.host.title_input.placeholder" = "Il mio profilo";
"global.email_not_configured" = "Nessun account e-mail configurato."; "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.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.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!"; "reddit.buttons.subscribe" = "Iscriviti ora!";
@ -99,8 +105,6 @@
"service.cells.account.caption" = "Account"; "service.cells.account.caption" = "Account";
"service.cells.account.none" = "Non configurato"; "service.cells.account.none" = "Non configurato";
"service.cells.endpoint.caption" = "Endpoint"; "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.pool.caption" = "Regione";
"service.cells.provider.preset.caption" = "Preset"; "service.cells.provider.preset.caption" = "Preset";
"service.cells.provider.refresh.caption" = "Aggiorna infrastruttura"; "service.cells.provider.refresh.caption" = "Aggiorna infrastruttura";
@ -198,9 +202,6 @@
"configuration.cells.renegotiation_seconds.caption" = "Rinegoziazione"; "configuration.cells.renegotiation_seconds.caption" = "Rinegoziazione";
"configuration.cells.renegotiation_seconds.value.after" = "dopo %@"; "configuration.cells.renegotiation_seconds.value.after" = "dopo %@";
"configuration.cells.random_endpoint.caption" = "Endpoint casuale"; "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.previous" = "Precedente";
"debug_log.buttons.next" = "Successivo"; "debug_log.buttons.next" = "Successivo";

View File

@ -31,6 +31,12 @@
"global.host.title_input.placeholder" = "Meu perfil"; "global.host.title_input.placeholder" = "Meu perfil";
"global.email_not_configured" = "Nenhuma conta de email configurada."; "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.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.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!"; "reddit.buttons.subscribe" = "Seguir!";
@ -99,8 +105,6 @@
"service.cells.account.caption" = "Conta"; "service.cells.account.caption" = "Conta";
"service.cells.account.none" = "Nenhum configurado"; "service.cells.account.none" = "Nenhum configurado";
"service.cells.endpoint.caption" = "Endereço"; "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.pool.caption" = "Localização";
"service.cells.provider.preset.caption" = "Pré-definição"; "service.cells.provider.preset.caption" = "Pré-definição";
"service.cells.provider.refresh.caption" = "Atualizar infraestrutura"; "service.cells.provider.refresh.caption" = "Atualizar infraestrutura";
@ -202,9 +206,6 @@
"configuration.cells.renegotiation_seconds.caption" = "Renegociando"; "configuration.cells.renegotiation_seconds.caption" = "Renegociando";
"configuration.cells.renegotiation_seconds.value.after" = "depois de %@"; "configuration.cells.renegotiation_seconds.value.after" = "depois de %@";
"configuration.cells.random_endpoint.caption" = "Destino randômico"; "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.previous" = "Anterior";
"debug_log.buttons.next" = "Próximo"; "debug_log.buttons.next" = "Próximo";

View File

@ -31,6 +31,12 @@
"global.host.title_input.placeholder" = "Мой профиль"; "global.host.title_input.placeholder" = "Мой профиль";
"global.email_not_configured" = "E-mail аккаунт не создан."; "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.title" = "Reddit";
"reddit.message" = "А Вы знали, что Passepartout имеет свой сабреддит? Подписывайтесь для получения обновлений, обсуждения проблем, функций, новых платформ или чего угодно.\n\nЭто также отличный способ показать поддержку проекта."; "reddit.message" = "А Вы знали, что Passepartout имеет свой сабреддит? Подписывайтесь для получения обновлений, обсуждения проблем, функций, новых платформ или чего угодно.\n\nЭто также отличный способ показать поддержку проекта.";
"reddit.buttons.subscribe" = "Подписаться сейчас!"; "reddit.buttons.subscribe" = "Подписаться сейчас!";
@ -99,8 +105,6 @@
"service.cells.account.caption" = "Аккаунт"; "service.cells.account.caption" = "Аккаунт";
"service.cells.account.none" = "Ничего не создано"; "service.cells.account.none" = "Ничего не создано";
"service.cells.endpoint.caption" = "Конечная точка"; "service.cells.endpoint.caption" = "Конечная точка";
"service.cells.endpoint.value.automatic" = "Автоматически";
"service.cells.endpoint.value.manual" = "Вручную";
"service.cells.provider.pool.caption" = "Местоположение"; "service.cells.provider.pool.caption" = "Местоположение";
"service.cells.provider.preset.caption" = "Пресет"; "service.cells.provider.preset.caption" = "Пресет";
"service.cells.provider.refresh.caption" = "Обновить инфраструктуру"; "service.cells.provider.refresh.caption" = "Обновить инфраструктуру";
@ -198,9 +202,6 @@
"configuration.cells.renegotiation_seconds.caption" = "Перезаключение"; "configuration.cells.renegotiation_seconds.caption" = "Перезаключение";
"configuration.cells.renegotiation_seconds.value.after" = "после %@"; "configuration.cells.renegotiation_seconds.value.after" = "после %@";
"configuration.cells.random_endpoint.caption" = "Рандомная конечная точка"; "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.previous" = "Предыдущий";
"debug_log.buttons.next" = "Следующий"; "debug_log.buttons.next" = "Следующий";

View File

@ -132,16 +132,6 @@ public enum L10n {
public enum Configuration { public enum Configuration {
public enum Cells { 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 { public enum Cipher {
/// Cipher /// Cipher
public static let caption = L10n.tr("Localizable", "configuration.cells.cipher.caption") 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") public static let next = L10n.tr("Localizable", "global.next")
/// OK /// OK
public static let ok = L10n.tr("Localizable", "global.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 Host {
public enum TitleInput { public enum TitleInput {
/// Acceptable characters are alphanumerics plus dash "-", underscore "_" and dot ".". /// Acceptable characters are alphanumerics plus dash "-", underscore "_" and dot ".".
@ -686,12 +688,6 @@ public enum L10n {
public enum Endpoint { public enum Endpoint {
/// Endpoint /// Endpoint
public static let caption = L10n.tr("Localizable", "service.cells.endpoint.caption") 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 Host {
public enum Parameters { public enum Parameters {