@intlayer/core
Version:
Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.
30 lines (28 loc) • 969 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
let _intlayer_types_nodeType = require("@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) => (0, _intlayer_types_nodeType.formatNodeType)(_intlayer_types_nodeType.TRANSLATION, content);
//#endregion
exports.t = translation;
//# sourceMappingURL=translation.cjs.map