1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00
Files
php-flarum/js/dist-typings/common/Translator.d.ts
flarum-bot 851907b88c Bundled output for commit dfa3b47cf3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-02-09 23:18:18 +00:00

35 lines
1.3 KiB
TypeScript

/// <reference path="../@types/translator-icu-rich.d.ts" />
import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter';
import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter';
declare type Translations = Record<string, string>;
declare type TranslatorParameters = Record<string, unknown>;
export default class Translator {
/**
* A map of translation keys to their translated values.
*/
translations: Translations;
/**
* The underlying ICU MessageFormatter util.
*/
protected formatter: RichMessageFormatter;
setLocale(locale: string): void;
addTranslations(translations: Translations): void;
/**
* An extensible entrypoint for extenders to register type handlers for translations.
*/
protected formatterTypeHandlers(): {
plural: typeof pluralTypeHandler;
select: typeof selectTypeHandler;
};
/**
* A temporary system to preprocess parameters.
* Should not be used by extensions.
* TODO: An extender will be added in v1.x.
*
* @internal
*/
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
trans(id: string, parameters?: TranslatorParameters): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
}
export {};