diff options
| author | Andrew Bulhak <andrew.bulhak@mullvad.net> | 2025-06-11 14:43:28 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2025-06-11 16:50:32 +0200 |
| commit | 7ca73df4050050573be2ad1d1398dbc1cbb96aa4 (patch) | |
| tree | f72715845a91c4ddd976444e6faecf0f064c73e0 /ios | |
| parent | 4e875e17c928f28a88c783a0d7b983c5d9a0c1dc (diff) | |
| download | mullvadvpn-7ca73df4050050573be2ad1d1398dbc1cbb96aa4.tar.xz mullvadvpn-7ca73df4050050573be2ad1d1398dbc1cbb96aa4.zip | |
Move API method name localisation to UI layer
Diffstat (limited to 'ios')
| -rw-r--r-- | ios/MullvadSettings/AccessMethodRepository.swift | 21 | ||||
| -rw-r--r-- | ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift | 8 |
2 files changed, 10 insertions, 19 deletions
diff --git a/ios/MullvadSettings/AccessMethodRepository.swift b/ios/MullvadSettings/AccessMethodRepository.swift index b0644ce8be..72cfc0668e 100644 --- a/ios/MullvadSettings/AccessMethodRepository.swift +++ b/ios/MullvadSettings/AccessMethodRepository.swift @@ -22,36 +22,21 @@ public class AccessMethodRepository: AccessMethodRepositoryProtocol, @unchecked // to on-device storage, they will not be relocalised if the user changes language. private let direct = PersistentAccessMethod( id: AccessMethodRepository.directId, - name: NSLocalizedString( - "ACCESS_METHOD_NAME_DIRECT", - tableName: "APIAccess", - value: "Direct", - comment: "" - ), + name: "Direct", isEnabled: true, proxyConfiguration: .direct ) private let bridge = PersistentAccessMethod( id: AccessMethodRepository.bridgeId, - name: NSLocalizedString( - "ACCESS_METHOD_NAME_BRIDGES", - tableName: "APIAccess", - value: "Mullvad bridges", - comment: "" - ), + name: "Mullvad bridges", isEnabled: true, proxyConfiguration: .bridges ) private let encryptedDNS = PersistentAccessMethod( id: AccessMethodRepository.encryptedDNSId, - name: NSLocalizedString( - "ACCESS_METHOD_NAME_ENCRYPTED_DNS", - tableName: "APIAccess", - value: "Encrypted DNS proxy", - comment: "" - ), + name: "Encrypted DNS proxy", isEnabled: true, proxyConfiguration: .encryptedDNS ) diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift index bfbf73fb4b..702922b9c0 100644 --- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift +++ b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodInteractor.swift @@ -46,7 +46,13 @@ struct ListAccessMethodInteractor: ListAccessMethodInteractorProtocol { extension PersistentAccessMethod { func toListItem() -> ListAccessMethodItem { let sanitizedName = name.trimmingCharacters(in: .whitespaces) - let itemName = sanitizedName.isEmpty ? kind.localizedDescription : sanitizedName + // the keys look like "ACCESS_METHOD_NAME:Mullvad bridges" + let localizedName = Bundle.main.localizedString( + forKey: "ACCESS_METHOD_NAME:\(sanitizedName)", + value: sanitizedName, + table: "APIAccess" + ) + let itemName = localizedName.isEmpty ? kind.localizedDescription : localizedName return ListAccessMethodItem( id: id, |
