A locale in Hebcal is used for translations/transliterations of holidays. @hebcal/hdate supports four locales by default

  • en - default, Sephardic transliterations (e.g. "Shabbat")
  • ashkenazi - Ashkenazi transliterations (e.g. "Shabbos")
  • he - Hebrew (e.g. "שַׁבָּת")
  • he-x-NoNikud - Hebrew without nikud (e.g. "שבת")

Constructors

Methods

  • Register locale translations.

    Parameters

    • locale: string

      Locale name (i.e.: 'he', 'fr')

    • data: LocaleData

      parsed data from a .po file.

    Returns void

  • Adds a translation to locale, replacing any previous translation.

    Parameters

    • locale: string

      Locale name (i.e: 'he', 'fr').

    • id: string

      Message ID to translate

    • translation: string | string[]

      Translation text

    Returns void

  • Adds multiple translations to locale, replacing any previous translations.

    Parameters

    • locale: string

      Locale name (i.e: 'he', 'fr').

    • data: LocaleData

      parsed data from a .po file.

    Returns void

  • Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')

    Returns string

  • Returns the names of registered locales

    Returns string[]

  • By default, if no translation was found, returns id.

    Parameters

    • id: string

      Message ID to translate

    • Optionallocale: string

      Optional locale name (i.e: 'he', 'fr'). Defaults to active locale.

    Returns string

  • Removes nekudot from Hebrew string

    Parameters

    • str: string

    Returns string

  • Returns translation only if locale offers a non-empty translation for id. Otherwise, returns undefined.

    Parameters

    • id: string

      Message ID to translate

    • Optionallocale: string

      Optional locale name (i.e: 'he', 'fr'). Defaults to active locale.

    Returns string

  • Renders a number in ordinal, such as 1st, 2nd or 3rd

    Parameters

    • n: number
    • Optionallocale: string

      Optional locale name (i.e: 'he', 'fr'). Defaults to active locale.

    Returns string

  • Activates a locale. Throws an error if the locale has not been previously added. After setting the locale to be used, all strings marked for translations will be represented by the corresponding translation in the specified locale.

    Parameters

    • locale: string

      Locale name (i.e: 'he', 'fr')

    Returns StringArrayMap