Angular Modernizer
    Preparing search index...

    Translation keys of a project: definitions, usages and their gaps.

    Joins the translation sources (findI18nSources) with the key usages (collectI18nUsages) and answers per key or for the whole project: where a key is defined (per language, with file, line and value), where it is used, in which language it is missing, which used keys are defined nowhere and which defined keys have no static usage.

    Layers: unconditional sources form the base, conditional sources (overlays) are grouped by their lookup key; each app of the workspace (folder with a tsconfig.app.json) has its own layers. missingIn compares a key with the languages of each layer that defines it, so an overlay-only key never counts as missing in the base. An overlay definition of a base key is marked overrides. A usage in an app is checked against that app's sources; usages in libraries against all.

    "Unused" cannot be proven without running the app. A defined key without a static usage is covered-by-dynamic when a dynamic key prefix ('A.' + x) covers it, referenced-as-literal when its text appears as a complete string in code or a template (menu configs, inputs passed on to a translating child), and no-static-usage otherwise.

    const report = new I18nInspector(project, { rootDir: '/app', key: 'ERRORS.NO_ACCESS' }).inspect();
    // report.keys[0] -> { key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], missingIn: [], usages: [...] }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Scans sources and usages and builds the report.

      Returns I18nReport

      The report, limited to the matching keys when key or prefix is set.