Class

NSOrthography

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

Declaration

@interface NSOrthography : NSObject

Overview

Use 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 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 and NSSpellChecker.

Subclassing Notes

Subclasses must override the dominantScript and languageMap properties. These properties are set using initWithDominantScript:languageMap: or orthographyWithDominantScript:languageMap:.

Topics

Creating Orthography Objects

+ defaultOrthographyForLanguage:

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

- initWithDominantScript:languageMap:

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

+ orthographyWithDominantScript:languageMap:

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

Determining Correspondences Between Languages and Scripts

languageMap

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

dominantLanguage

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

dominantScript

The dominant script for the text.

- dominantLanguageForScript:

Returns the dominant language for the specified script.

- languagesForScript:

Returns the list of languages for the specified script.

allScripts

The scripts appearing as keys in the language map.

allLanguages

The languages appearing in values of the language map.

Initializers

Relationships

Inherits From

See Also

Localization

NSLocale

Information about linguistic, cultural, and technological conventions for use in formatting data for presentation.

NSLocalizedString

Returns a localized version of a string.

NSLocalizedStringFromTable

Returns a localized version of a string from the specified table.

NSLocalizedStringFromTableInBundle

Returns a localized version of a string from the specified table in the given bundle.

NSLocalizedStringWithDefaultValue

Returns a localized version of a string from the specified table in the given bundle while falling back on the given default value.