qwik-speak
Version:
Internationalization (i18n) library to translate texts, dates and numbers in Qwik apps
84 lines (77 loc) • 2.02 kB
TypeScript
import type { Plugin } from 'vite';
/**
* Qwik Speak Inline Vite plugin
*/
export declare function qwikSpeakInline(options: QwikSpeakInlineOptions): Plugin;
/**
* Qwik Speak Inline Vite Plugin Options
*/
export declare interface QwikSpeakInlineOptions {
/**
* The base path. Default to './'
*/
basePath?: string;
/**
* Path to translation files: [basePath]/[assetsPath]/[lang]/*.json. Default to 'i18n'
*/
assetsPath?: string;
/**
* Optional function to load asset by lang
*/
loadAssets?: (lang: string) => Promise<Translation>;
/**
* The build output directory. Default to 'dist'
*/
outDir?: string;
/**
* Supported langs. Required
*/
supportedLangs: string[];
/**
* Default lang. Required
*/
defaultLang: string;
/**
* Separator of nested keys. Default is '.'
*/
keySeparator?: string;
/**
* Key-value separator. Default is '@@'
*/
keyValueSeparator?: string;
/**
* Automatically handle keys for each string. Default is false.
* Make sure to enable --autoKeys=true when running the extractor
*/
autoKeys?: boolean;
}
export declare interface RewriteRouteOption {
/**
* Optional prefix
*/
prefix?: string;
/**
* Translated segments.
* Key value pairs: folder name - translated value
*/
paths: Record<string, string>;
/**
* In domain-based routing, set the default domain for the prefix
*/
domain?: string;
/**
* In domain-based routing, set another domain for the prefix
*/
withDomain?: string;
}
/**
* In prod, handle the needed prefixes in domain-based routing
*/
export declare function toPrefixAsNeeded(rewriteRoutes: RewriteRouteOption[], mode: string): RewriteRouteOption[];
/**
* Translation data
*/
export declare type Translation = {
[key: string]: any;
};
export { }