Angular Modernizer
    Preparing search index...
    • Translation sources of a project: finds the translation files a project loads and indexes their keys, without configuration.

      • TS object literals handed to setTranslation of TranslateService (ngx-translate, (lang, data)) or TranslocoService ((data, lang)). The data argument is followed back to the object literal: variables, imports, parameters through the arguments of their callers (rest parameters and spread included), forEach/for...of elements, array and object literals, and lookups like MAP[key].
      • JSON files named by a TranslateHttpLoader (prefix and suffix) or by the URL template of a TranslocoLoader class, resolved against the ancestors of the loader's file. Without a loader or registration, the convention assets/i18n/*.json below the program's top-level folders.

      A source reached through a lookup with a runtime key, or registered in an if/switch/ternary branch, is conditional (an overlay). A registration the trace cannot follow to an object is reported as unresolved, never filled in from file or variable names.

      Keys are flattened with . ({ A: { B: 'x' } } -> A.B), each with its line and value.

      Parameters

      • project: Project

        Project whose program files are scanned.

      • options: I18nSourceOptions = {}

        Project root for loader paths and the convention fallback.

      Returns I18nSourceScan

      The sources found and the registrations that could not be followed.

      const scan = findI18nSources(project, { rootDir: '/app' });
      // scan.sources[0] -> { file: '/app/src/i18n/de.ts', kind: 'ts-object', lang: 'de', conditional: false, ... }