Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IConfig

Hierarchy

Index

Properties

Optional adapter

adapter: string | Adapter<any>

The compilation adapter that should be used or a path from which adapter should be loaded.

default

"@mfml/cli/lib/adapters/localeFilesAdapter"

Optional cardinal

cardinal: PluralCategory[]

Array of valid plural categories for the current locale, used to validate plural keys.

If undefined, the full set of valid PluralCategory keys is used. To disable this check, pass in an empty array.

Optional cdataEnabled

cdataEnabled: boolean

Toggles CDATA sections recognition <![CDATA[ … ]]>. If set to false then CDATA sections are treated as comments.

Optional include

include: string[]

The list of file paths included in the compilation.

Optional ordinal

ordinal: PluralCategory[]

Array of valid plural categories for the current locale, used to validate selectordinal keys.

If undefined, the full set of valid PluralCategory keys is used. To disable this check, pass in an empty array.

Optional otherSelectCaseKey

otherSelectCaseKey: string

The key that is used as the default for select.

default

"other"

Optional outDir

outDir: string

The output folder for all emitted files.

Optional presets

presets: (string | IConfig)[]

The configuration presets that must be used as a fallback.

Optional processingInstructionsEnabled

processingInstructionsEnabled: boolean

Toggles processing instructions recognition <?xml-stylesheet … ?>. If set to false then processing instructions are treated as comments.

Optional rootDir

rootDir: string

The root folder from which include are resolved.

Optional runtimeImportPath

runtimeImportPath: string

The path from which runtime dependencies are imported.

default

"@mfml/runtime"

Optional selfClosingEnabled

selfClosingEnabled: boolean

Toggles self-closing tags recognition <foo/>. If set to false then slash in self closing tags is ignored or processed as a part of an attribute value, depending on the markup.

Optional strict

strict: boolean

By default, the parsing applies a few relaxations to the ICU MessageFormat spec. Setting strict: true will disable these relaxations.

remarks
  • The argType of simpleArg formatting functions will be restricted to the set of number, date, time, spellout, ordinal, and duration, rather than accepting any lower-case identifier that does not start with a number.

  • The optional argStyle of simpleArg formatting functions will not be parsed as any other text, but instead as the spec requires: "In argStyleText, every single ASCII apostrophe begins and ends quoted literal text, and unquoted {curly braces} must occur in matched pairs."

  • Inside a plural or selectordinal statement, a pound symbol (#) is replaced with the input number. By default, # is also parsed as a special character in nested statements too, and can be escaped using apostrophes ('#'). In strict mode # will be parsed as a special character only directly inside a plural or selectordinal statement. Outside those, # and '#' will be parsed as literal text.

Optional typingsEnabled

typingsEnabled: boolean

If set to true then TypeScript interfaces and function types are rendered.

default

false

Methods

Optional checkCdataTag

  • checkCdataTag(token: IStartTagToken): boolean
  • Checks whether the content of the container tag should be interpreted as a markup or as a character data. Entities aren't decoded in the content of character data tags. Useful when parsing such tags as script, style and others.

    Parameters

    • token: IStartTagToken

      The start tag token read from the source.

    Returns boolean

    true to interpret the contents of the token container tag as a character data, false otherwise.

Optional checkVoidTag

  • checkVoidTag(token: IStartTagToken): boolean
  • Checks whether the tag has no content. Useful when parsing such tags as hr, img and others.

    Parameters

    • token: IStartTagToken

      The start tag token.

    Returns boolean

    true to interpret tag as self-closing even if it isn't marked up as such, false otherwise.

Optional decodeAttribute

  • decodeAttribute(value: string): string
  • Decodes XML entities in an attribute value. If omitted then decodeText callback is used.

    Parameters

    • value: string

      The attribute value to decode.

    Returns string

    The decoded value.

Optional decodeText

  • decodeText(text: string): string
  • Decodes XML entities in a plain text value.

    Parameters

    • text: string

      The text to decode.

    Returns string

    The decoded text.

Optional endsAncestorAt

  • endsAncestorAt(ancestors: ArrayLike<IStartTagToken>, token: IStartTagToken): number
  • Inspects ancestors and returns an index of an ancestor for which end tag is implied. Useful when parsing such tags as p, li, td and others.

    Parameters

    • ancestors: ArrayLike<IStartTagToken>

      The list of start tag tokens of current ancestors.

    • token: IStartTagToken

      The token of the start tag that was read.

    Returns number

    The index among ancestors that points to an ancestor for which an end tag is implied or -1 if no implicit end detected.

Optional extractComment

  • extractComment(messageName: string, message: IMessage): Maybe<string>

Optional onError

  • onError(error: unknown, messageName: string, message: IMessage): void

Optional provideDefaultLocale

  • provideDefaultLocale(messageName: string, message: IMessage): string

Optional provideFunctionType

  • provideFunctionType(functionName: string): Maybe<string>
  • Returns the TypeScript type of the argument that a function expects. If omitted then arguments of all functions are typed as unknown.

    Parameters

    • functionName: string

      The name of the function.

    Returns Maybe<string>

Optional renameArgument

  • renameArgument(name: string): string

Optional renameAttribute

  • renameAttribute(name: string): string
  • Rewrites an attribute name.

    Parameters

    • name: string

      The raw name of the attribute.

    Returns string

    The rewritten name of the attribute.

Optional renameFunction

  • renameFunction(name: string): string

Optional renameInterface

  • renameInterface(messageName: string, message: IMessage): string

Optional renameMessageFunction

  • renameMessageFunction(messageName: string, message: IMessage): string

Optional renameTag

  • renameTag(name: string): string
  • Rewrites a tag name. Start and end tags are matched via tag name comparison. Provide a rewriter to support case-insensitive tag matching.

    Parameters

    • name: string

      The raw name of the tag.

    Returns string

    The rewritten name of the tag.

Optional renderMetadata

Optional rewriteTranslation

  • rewriteTranslation(translation: string, locale: string): string
  • Receives a message translation and returns a new translation.

    Use this to apply preprocessors (such as markdown-to-HTML) or typography re-writers.

    Parameters

    • translation: string

      The text of the translation.

    • locale: string

      The translation locale.

    Returns string

Optional transformTranslationNode

  • transformTranslationNode(node: Node, locale: string, messageName: string, message: IMessage): void | Node
  • Transforms a translation node before it is compiled.

    Parameters

    • node: Node

      The node that represents the parsed translation.

    • locale: string

      The translation locale.

    • messageName: string

      The name of the message.

    • message: IMessage

      The message that contains the translation.

    Returns void | Node

    The transformed node. If undefined is returned then node would be used for compilation.

Generated using TypeDoc