UNPKG

studiocms

Version:

Astro Native CMS for AstroDB. Built from the ground up by the Astro community.

38 lines (37 loc) 1.86 kB
/** * This module handles internationalization (i18n) for the StudioCMS application on the client side. * * It provides utilities for loading and managing translation files, as well as functions for * retrieving translated strings based on the current language context. * * If you are interested in contributing to the translation effort, please visit our Crowdin project: * https://crowdin.com/project/studiocms or submit a pull request to the `translations` folder: * `packages/studiocms/src/virtuals/i18n/translations/` on https://github.com/withstudiocms/studiocms */ import { type Messages } from '@nanostores/i18n'; import type { TranslationsJSON } from '../../schemas/plugins/i18n'; export declare function $pluginI18n(pluginId: string, componentId: string): Messages<TranslationsJSON>; /** * Augments the i18n instance specifically for handling "augments" translations. * * This function creates and returns an i18n instance configured to provide translation * data for the "augments" component, using a custom translation object per language. * If the requested language is not available, it falls back to the default language, * and if that is also unavailable, it returns an empty "augments" object. * * @remarks * Uses a type assertion hack to convince TypeScript that the translation objects * conform to the `ComponentsJSON` type. * * @returns The i18n instance for the "augments" component, initialized with the * default language's "augments" translations or an empty object. */ export declare function $augmentI18n(): Messages<TranslationsJSON>; export declare class PluginTranslations extends HTMLElement { currentLang: string | undefined; unsubscribeLocale?: () => void; unsubscribeTranslations?: () => void; constructor(); connectedCallback(): void; disconnectedCallback(): void; }