NSOrthography Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in iOS 4.0 and later.
Declared in
NSOrthography.h

Overview

The NSOrthography class describes the linguistic content of a piece of text, typically used for the purposes of spelling and grammar checking.

An NSOrthography instance describes:

Scripts are uniformly described by standard four-letter tags (Latn, Grek, Cyrl, etc.) with the supertags Jpan and Kore typically used for Japanese and Korean text, Hans and Hant for Chinese text; the tag Zyyy is used if a specific script cannot be identified. See Internationalization Programming Topics for more information on internationalization.

Languages are uniformly described by BCP-47 tags , preferably in canonical form; the tag und is used if a specific language cannot be determined.

Subclassing Notes

Methods to Override

The dominantScript and languageMap properties are the primitive values that a subclass must implement. The properties are set using the initWithDominantScript:languageMap: or orthographyWithDominantScript:languageMap:.

Tasks

Creating Instances of NSOrthography

Defining the Language Map

Managing Languages and Scripts

Properties

allLanguages

Returns an array containing all the languages appearing in the values of the language map. (read-only)

@property(readonly) NSArray *allLanguages
Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

allScripts

Returns an array containing all the scripts appearing as keys in the language map. (read-only)

@property(readonly) NSArray *allScripts
Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

dominantLanguage

Returns the first language in the list of languages for the dominant script. (read-only)

@property(readonly) NSString *dominantLanguage
Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

dominantScript

The dominant script for the text. (read-only)

@property(readonly) NSString *dominantScript
Discussion

The dominant script should be a script tag, such as Latn, Cyrl, etc.

Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

languageMap

A dictionary that map script tags to arrays of language tags. (read-only)

@property(readonly) NSDictionary *languageMap
Discussion

The dictionary’s keys are script tags (such as Latn, Cyrl, and so forth) and whose values are arrays of language tags (such as en, fr, de, etc.)

Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

Class Methods

orthographyWithDominantScript:languageMap:

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

+ (id)orthographyWithDominantScript:(NSString *)script languageMap:(NSDictionary *)map
Parameters
script

The dominant script.

map

A dictionary containing the language map.

Return Value

An initialized orthography object for the specified script and language map.

Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

Instance Methods

dominantLanguageForScript:

Returns the dominant language for the specified script.

- (NSString *)dominantLanguageForScript:(NSString *)script
Parameters
script

The script.

Return Value

A string containing the dominant language

Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

initWithDominantScript:languageMap:

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

- (id)initWithDominantScript:(NSString *)script languageMap:(NSDictionary *)map
Parameters
script

The dominant script.

map

A dictionary containing the language map.

Return Value

An initialized orthography object for the specified script and language map.

Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h

languagesForScript:

Returns the list of languages for the specified script.

- (NSArray *)languagesForScript:(NSString *)script
Parameters
script

The script.

Return Value

An array of strings containing the languages.

Availability
  • Available in iOS 4.0 and later.
Declared In
NSOrthography.h