Swiftgram/submodules/TelegramUI/TelegramUI/ContactInfoStrings.swift
2019-06-16 00:51:10 +01:00

44 lines
1.2 KiB
Swift

import Foundation
import Contacts
import AddressBook
import TelegramPresentationData
func localizedPhoneNumberLabel(label: String, strings: PresentationStrings) -> String {
if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
if label.isEmpty {
return strings.ContactInfo_PhoneLabelMain
} else if label == "X-iPhone" {
return "iPhone"
} else {
return CNLabeledValue<CNPhoneNumber>.localizedString(forLabel: label)
}
} else {
}
if label == "_$!<Mobile>!$_" {
return "mobile"
} else if label == "_$!<Home>!$_" {
return "home"
} else {
return label
}
}
func localizedGenericContactFieldLabel(label: String, strings: PresentationStrings) -> String {
if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
if label.isEmpty {
return strings.ContactInfo_PhoneLabelMain
}
return CNLabeledValue<NSString>.localizedString(forLabel: label)
} else {
}
if label == "_$!<Mobile>!$_" {
return "mobile"
} else if label == "_$!<Home>!$_" {
return "home"
} else {
return label
}
}