export interface Headers { 'content-type'?: string; 'plural-forms'?: string; } export type StringArrayMap = Record; export interface LocaleData { headers: Headers; contexts: Record; } /** * 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. "שבת") */ export declare class Locale { /** * Returns translation only if `locale` offers a non-empty translation for `id`. * Otherwise, returns `undefined`. * @param id Message ID to translate * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale. */ static lookupTranslation(id: string, locale?: string): string | undefined; /** * By default, if no translation was found, returns `id`. * @param id Message ID to translate * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale. */ static gettext(id: string, locale?: string): string; /** * Register locale translations. * @param locale Locale name (i.e.: `'he'`, `'fr'`) * @param data parsed data from a `.po` file. */ static addLocale(locale: string, data: LocaleData): void; /** * Adds a translation to `locale`, replacing any previous translation. * @param locale Locale name (i.e: `'he'`, `'fr'`). * @param id Message ID to translate * @param translation Translation text */ static addTranslation(locale: string, id: string, translation: string | string[]): void; /** * Adds multiple translations to `locale`, replacing any previous translations. * @param locale Locale name (i.e: `'he'`, `'fr'`). * @param data parsed data from a `.po` file. */ static addTranslations(locale: string, data: LocaleData): void; /** * Returns the names of registered locales */ static getLocaleNames(): string[]; /** * Checks whether a locale has been registered * @param locale Locale name (i.e: `'he'`, `'fr'`). */ static hasLocale(locale: string): boolean; /** * Renders a number in ordinal, such as 1st, 2nd or 3rd * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale. */ static ordinal(n: number, locale?: string): string; /** * Removes nekudot from Hebrew string */ static hebrewStripNikkud(str: string): string; /** * Makes a copy of entire Hebrew locale with no niqqud */ static copyLocaleNoNikud(data: LocaleData): LocaleData; }