<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSOrthography",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOrthography"
  },
  "title" : "NSOrthography"
}
-->

# NSOrthography

A description of the linguistic content of natural language text, typically used for spelling and grammar checking.

```
class NSOrthography
```

## Overview

Use [`NSOrthography`](/documentation/Foundation/NSOrthography) objects to describe the linguistic content of a piece of text, including which scripts the text contains, a dominant language (and possibly other languages) for each script, and a dominant script and language for the text as a whole.

Scripts are uniformly described by four-letter ISO 15924 script codes, such as `"Latn"`, `"Grek"`, and `"Cyrl"`. The supertags `"Jpan"` and `"Kore"` are typically used for Japanese and Korean text, and `"Hans"` and `"Hant"` are typically used for Chinese text. The tag `"Zyyy"` is used if a specific script cannot be identified. See [Internationalization and Localization Guide](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/Introduction/Introduction.html#//apple_ref/doc/uid/10000171i) for more information.

Languages are uniformly described by BCP-47 tags (preferably in canonical form). The tag `"und"` is used if a specific language cannot be determined.

You typically work with orthography objects returned from methods and properties for classes like [`NSLinguisticTagger`](/documentation/Foundation/NSLinguisticTagger) and <doc://com.apple.documentation/documentation/AppKit/NSSpellChecker>.

### Subclassing Notes

Subclasses must override the [`dominantScript`](/documentation/Foundation/NSOrthography/dominantScript) and [`languageMap`](/documentation/Foundation/NSOrthography/languageMap) properties. These properties are set using [`init(dominantScript:languageMap:)`](/documentation/Foundation/NSOrthography/init(dominantScript:languageMap:)) or [`orthographyWithDominantScript:languageMap:`](/documentation/Foundation/NSOrthography/orthographyWithDominantScript:languageMap:) in Objective-C.

## Topics

### Creating Orthography Objects

[`+  defaultOrthographyForLanguage:`](/documentation/Foundation/NSOrthography/defaultOrthography(forLanguage:))

Creates and returns an orthography object with the default language map for the specified language.

[`-  initWithDominantScript:languageMap:`](/documentation/Foundation/NSOrthography/init(dominantScript:languageMap:))

Creates an orthography object with the specified dominant script and language map.

[`+  orthographyWithDominantScript:languageMap:`](/documentation/Foundation/NSOrthography/orthographyWithDominantScript:languageMap:)

Creates and returns an orthography object with the specified dominant script and language map.

### Determining Correspondences Between Languages and Scripts

[`languageMap`](/documentation/Foundation/NSOrthography/languageMap)

A dictionary that maps script tags to arrays of language tags.

[`dominantLanguage`](/documentation/Foundation/NSOrthography/dominantLanguage)

The first language in the list of languages for the dominant script.

[`dominantScript`](/documentation/Foundation/NSOrthography/dominantScript)

The dominant script for the text.

[`-  dominantLanguageForScript:`](/documentation/Foundation/NSOrthography/dominantLanguage(forScript:))

Returns the dominant language for the specified script.

[`-  languagesForScript:`](/documentation/Foundation/NSOrthography/languages(forScript:))

Returns the list of languages for the specified script.

[`allScripts`](/documentation/Foundation/NSOrthography/allScripts)

The scripts appearing as keys in the language map.

[`allLanguages`](/documentation/Foundation/NSOrthography/allLanguages)

The languages appearing in values of the language map.

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)