Specific clause before country name in sentence

I have an iOS app where I want to include a custom country (defined by region) in a text string. "In Portugal, this is ...". For most country names, this is easy:

        let countryCode = locale.objectForKey(NSLocaleCountryCode) as! String
        let countryName = locale.displayNameForKey(NSLocaleCountryCode,
                                                   value: countryCode)!
        let text = "In \(countryName) this is …"

      

However, for some country names, the name must be prefixed with "the", such as "Netherlands" and "United States". Is this information available in NSLocale in some way or are there other libraries that can help with this?

+3


source to share





All Articles