@jsverse/transloco-keys-manager
Version:
Extract translatable keys from projects that uses Transloco
14 lines • 713 B
JavaScript
import { initExtraction } from '../../utils/init-extraction.js';
import { devlog } from '../../utils/logger.js';
import { normalizedGlob } from '../../utils/normalize-glob-path.js';
export function extractKeys({ input, scopes, defaultValue, files }, fileType, extractor) {
let { scopeToKeys } = initExtraction();
const fileList = files ||
input.map((path) => normalizedGlob(`${path}/**/*.${fileType}`)).flat();
for (const file of fileList) {
devlog('extraction', 'Extracting keys', { file, fileType });
scopeToKeys = extractor({ file, defaultValue, scopes, scopeToKeys });
}
return { scopeToKeys, fileCount: fileList.length };
}
//# sourceMappingURL=extract-keys.js.map