Options
All
  • Public
  • Public/Protected
  • All
Menu

i18n-tag-schema

Index

Type aliases

ExportOptions

ExportOptions: object

Type declaration

  • Optional babylonConfig?: object

    A custom babylon configuration.

  • Optional filePath?: string

    The full path of a source file.

  • Optional filter?: string

    A regex to filter source files by name or extension. Defaults to \.jsx?$.

  • Optional logger?: Logger

    A custom logger.

  • Optional postprocessor?: string | function

    A custom postprocessor like ./postprocessors/po.

  • Optional preprocessor?: string | function

    A custom preprocessor like ./preprocessors/typescript.

  • Optional progress?: function

    A progress callback.

      • (current: number, total: number, name: string): void
      • Parameters

        • current: number
        • total: number
        • name: string

        Returns void

  • rootPath: string

    The root directory of your source files.

Logger

Logger: object

Type declaration

  • Optional error?: function

    A custom error logging function.

      • (message: string): void
      • Parameters

        • message: string

        Returns void

  • Optional info?: function

    A custom info logging function.

      • (message: string): void
      • Parameters

        • message: string

        Returns void

  • Optional toConsole?: boolean

    Log to default console. It true the default console logging functions will be used.

  • Optional trace?: function

    A custom trace logging function.

      • (message: string | Error): void
      • Parameters

        • message: string | Error

        Returns void

  • Optional warn?: function

    A custom warn logging function.

      • (message: string): void
      • Parameters

        • message: string

        Returns void

SchemaOptions

SchemaOptions: object

Type declaration

  • Optional babylonConfig?: object

    A custom babylon configuration.

  • Optional filter?: string

    A regex to filter source files by name or extension. Defaults to \.jsx?$.

  • Optional indention?: number

    The number of spaces to be used instead of tabs. if not set tabs will be used.

  • Optional logger?: Logger

    A custom logger.

  • Optional preprocessor?: string | function

    A custom preprocessor like ./preprocessors/typescript.

  • Optional progress?: function

    A progress callback.

      • (current: number, total: number, name: string): void
      • Parameters

        • current: number
        • total: number
        • name: string

        Returns void

  • rootPath: string

    The root directory of your source files.

  • Optional schemaPath?: string

    The target path of the JSON schema.

TemplateGroup

TemplateGroup: object

Type declaration

  • group: string

    Translation group

  • items: Array<string>

    Translation keys

ValidateOptions

ValidateOptions: object

Type declaration

  • Optional logger?: Logger

    A custom logger.

  • Optional progress?: function

    A progress callback.

      • (current: number, total: number, name: string): void
      • Parameters

        • current: number
        • total: number
        • name: string

        Returns void

  • rootPath: string

    The root directory of your source files.

  • Optional schemaPath?: string

    The path of the JSON schema to validate against.

Functions

exportTranslationKeys

  • Generates an array of all i18n tagged template literals in a file.

    Parameters

    Returns Promise<Array<string | TemplateGroup> | string>

generateTranslationSchema

  • generateTranslationSchema(options: SchemaOptions): Promise<object>
  • Generates a JSON schema based on i18n tagged template literals.

    Parameters

    Returns Promise<object>

validateTranslations

  • Validates a translation file or folder and calculates translation coverage

    Parameters

    Returns Promise<string>