UNPKG

@intlayer/core

Version:

Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.

31 lines (29 loc) 966 B
import { deepTransformNode } from "./deepTransform.mjs"; import { conditionPlugin, enumerationPlugin, filePlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./plugins.mjs"; import configuration from "@intlayer/config/built"; //#region src/interpreter/getContent/getContent.ts /** * Transforms a node in a single pass, applying each plugin as needed. * * @param node The node to transform. * @param locale The locale to use if your transformers need it (e.g. for translations). */ const getContent = (node, nodeProps, locale) => { const defaultLocale = configuration?.internationalization?.defaultLocale; const plugins = [ insertionPlugin, translationPlugin(locale ?? defaultLocale, defaultLocale), enumerationPlugin, conditionPlugin, nestedPlugin, filePlugin, ...nodeProps.plugins ?? [] ]; return deepTransformNode(node, { ...nodeProps, plugins }); }; //#endregion export { getContent }; //# sourceMappingURL=getContent.mjs.map