@intlayer/core
Version:
Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.
28 lines (26 loc) • 776 B
JavaScript
import { TRANSLATION, formatNodeType } from "@intlayer/types/nodeType";
//#region src/transpiler/translation/translation.ts
/**
*
* Function intended to be used to build intlayer dictionaries.
*
* Get the content of a translation based on the locale.
*
* Usage:
*
* ```ts
* translation<string>({
* "en": "Hello",
* "fr": "Bonjour",
* // ... any other available locale
* })
* ```
*
* Using TypeScript:
* - this function require each locale to be defined if defined in the project configuration.
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
*/
const translation = (content) => formatNodeType(TRANSLATION, content);
//#endregion
export { translation as t };
//# sourceMappingURL=translation.mjs.map