The Node.js module getTranslations
extracts translation keys and values from HTML files in a specified project directory, returning an object with flat translation keys as properties and arrays of values as values. The function uses glob
to find HTML files, regular expressions to extract translations, and reduces the results into a single object for ease of use.
This code analyzes translation keys to identify misplaced, unused, and missing keys, helping ensure consistency and completeness across different language versions of a project.