UNPKG

1.73 kBTypeScriptView Raw
1/// <reference types="qunit" />
2/// <reference types="ember-qunit" />
3import type { TestContext as BaseTestContext } from 'ember-test-helpers';
4import type IntlService from 'ember-intl/services/intl';
5import type { TOptions } from 'ember-intl/services/intl';
6import type { Translations } from 'ember-intl/-private/store/translation';
7export interface IntlTestContext {
8 intl: IntlService;
9}
10export interface TestContext extends IntlTestContext, BaseTestContext {
11}
12export interface SetupIntlOptions {
13 /**
14 * Whether to install the special `missing-message` handler.
15 *
16 * @defaultValue true
17 */
18 missingMessage?: boolean | ((key: string, locales: string[], options: TOptions) => string);
19 formats?: IntlService['formats'];
20}
21/**
22 * Calling this helper will install a special `missing-message` util that will
23 * serialize all missing translations in a deterministic manner, including
24 * variables you've passed for interpolation. This means that you do not have
25 * to explicitly add any translations and can just rely on the implicit
26 * serialization. See the docs for detailed examples.
27 *
28 * Besides the `hooks` object you can also pass a `locale` string or array to
29 * set the locale, as well as an object of `translations`, if you do want to
30 * bootstrap translations. Both arguments are optional.
31 *
32 * @param {object} hooks
33 * @param {string} [localeOrTranslations]
34 * @param {object} [translations]
35 * @param {object} [options]
36 */
37export default function setupIntl(hooks: NestedHooks, locale: string | string[], translations?: Translations, options?: SetupIntlOptions): void;
38export default function setupIntl(hooks: NestedHooks, translations?: Translations, options?: SetupIntlOptions): void;
39
\No newline at end of file