@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
24 lines • 791 B
JavaScript
import { getConfiguration } from "@intlayer/config";
import { createI18nextDictionaries } from "./convertContentDeclarationInto18nDictionaries.mjs";
import {
writeDictionary
} from "./writeDictionary.mjs";
const buildI18nDictionary = async (contentDeclarations, configuration = getConfiguration()) => {
const dictionariesDeclaration = contentDeclarations.reduce((acc, dictionary) => {
const { key, content } = dictionary;
const i18Content = createI18nextDictionaries(content, configuration);
return {
...acc,
[key]: i18Content
};
}, {});
const dictionariesPaths = await writeDictionary(
dictionariesDeclaration,
configuration
);
return dictionariesPaths;
};
export {
buildI18nDictionary
};
//# sourceMappingURL=buildI18nextDictionary.mjs.map