2.0.0 • Published 11 months ago

@byu-trg/language-code-service v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

Language Code Service

Library for interfacing with the IANA Language Subtag Registry.

The IANA Language Subtag Registry is not fetched in real time and is instead cached within the library upon every release.

Types

interface IANALanguage {
  tag: string,
  description: string
}
interface Subtags {
  primary: string;
  extended: string[];
}
class Language {
  readonly subtags: Subtags;
  readonly description: string;
  get tag(): string;
}

Methods

/** 
 * Retrieves all languages from the IANA Language Subtag Registry.
 */
getAllLanguages(): IANALanguage[]
/** 
 * Retrieves a language using a provided language tag. 
 * 
 * The primary subtag of the provided language tag will be used to query the IANA Language Subtag Registry. 
 * Extended subtags will be derived from the provided language tag.
 *
 * Errors will be thrown if the provided language tag does not follow BCP 47 format or if its primary subtag does not exist in the IANA Language Subtag Registry.
 */
getLanguage = (langTag: string): Language
2.0.0

11 months ago

1.1.9

12 months ago

1.1.8

12 months ago

1.1.10

12 months ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago