UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

45 lines (44 loc) 1.82 kB
import { AdminCopyDescriptor, CopyDescriptor, LiteralCopy, RegisteredCopyTranslationKey, ServerCopyDescriptor, TranslatableCopy, TranslationValues } from "./types.mjs"; import z from "zod"; //#region src/libs/i18n/copy.d.ts type DefineCopyOptions = { data?: TranslationValues; defaultMessage?: string; }; type AdminCopyKey = `admin:${string}`; type ServerCopyKey = `server:${string}`; type RegisteredAdminCopyKey = Extract<RegisteredCopyTranslationKey, AdminCopyKey>; type RegisteredServerCopyKey = Extract<RegisteredCopyTranslationKey, ServerCopyKey>; type DefineCopy = { (prefixedKey: RegisteredAdminCopyKey, options?: DefineCopyOptions): AdminCopyDescriptor; (prefixedKey: RegisteredServerCopyKey, options?: DefineCopyOptions): ServerCopyDescriptor; (prefixedKey: AdminCopyKey, options?: DefineCopyOptions): AdminCopyDescriptor; (prefixedKey: ServerCopyKey, options?: DefineCopyOptions): ServerCopyDescriptor; (prefixedKey: string, options?: DefineCopyOptions): CopyDescriptor; }; type CopyHelper = DefineCopy & { literal: (value: string, values?: TranslationValues) => LiteralCopy; }; /** * Parses a prefixed translation key into the scope used by the translation * store and the unprefixed key stored in translation files. */ /** * Describes already-written copy while keeping the value compatible with APIs * that accept translatable descriptors. */ declare const copy: CopyHelper; /** * Checks whether a value can be resolved by Lucid's translation helpers. * * @example * ```ts * if (isTranslatableCopy(value)) { * const message = translate(value); * } * ``` */ declare const isTranslatableCopy: (value: unknown) => value is TranslatableCopy; //#endregion export { type AdminCopyDescriptor, type ServerCopyDescriptor, copy, isTranslatableCopy }; //# sourceMappingURL=copy.d.mts.map