<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 12.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NaturalLanguage",
  "identifier" : "/documentation/NaturalLanguage/NLTagger/setLanguage(_:range:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Natural Language",
      "NaturalLanguage"
    ],
    "preciseIdentifier" : "s:So8NLTaggerC15NaturalLanguageE03setC0_5rangeySo10NLLanguagea_SnySS5IndexVGtF"
  },
  "title" : "setLanguage(_:range:)"
}
-->

# setLanguage(_:range:)

Sets the language for a range of text within the tagger’s string.

```
@nonobjc func setLanguage(_ language: NLLanguage, range: Range<String.Index>)
```

## Parameters

`language`

The language of the text range.

`range`

The range of the string that is being assigned a language.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)