UNPKG

@intlayer/core

Version:

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

22 lines (20 loc) 899 B
import { getDictionary } from "./getDictionary.mjs"; import { getAppLogger } from "@intlayer/config/client"; import configuration from "@intlayer/config/built"; import { getDictionaries } from "@intlayer/dictionaries-entry"; //#region src/interpreter/getIntlayer.ts const getIntlayer = (key, locale, plugins) => { const dictionaries = getDictionaries(); const dictionary = dictionaries[key]; if (!dictionary) { if (configuration.build.optimize) getAppLogger(configuration)("Build optimization is enabled, the dictionary may have been purged. You can disable build optimization, or configure the traversePattern to include the current component.", { level: "error", isVerbose: true }); throw new Error(`Dictionary ${key} not found`, dictionaries); } return getDictionary(dictionary, locale, plugins); }; //#endregion export { getIntlayer }; //# sourceMappingURL=getIntlayer.mjs.map