Definite article before country name in sentence

107 views Asked by At

I have an iOS app where I want to include the user's country (as defined by region) in a text string, e.g. “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 should be prefixed by “the”, for example “the Netherlands” and “the United States”. Is this information available in NSLocale somehow, or are there other libraries that can help with this?

0

There are 0 answers