nuxt-google-translate
Version:
A simple Nuxt module that integrates the Google Translate widget into your Nuxt.js application, allowing seamless multilingual support without requiring an API key.
51 lines (50 loc) • 1.63 kB
TypeScript
/**
* Configuration interface for Google Translate Element
* @interface GoogleTranslateConfig
* @property {string} pageLanguage - The default language of the page
* @property {string} [includedLanguages] - Comma-separated list of supported languages
* @property {string} layout - The layout style of the translate widget
* @property {boolean} autoDisplay - Whether to automatically display the widget
*/
interface GoogleTranslateConfig {
pageLanguage: string;
includedLanguages?: string;
layout: string;
autoDisplay: boolean;
}
/**
* Extend Window interface to include Google Translate types
*/
declare global {
interface Window {
google?: {
translate?: {
TranslateElement: {
new (config: GoogleTranslateConfig, elementId: string): void;
InlineLayout: {
SIMPLE: string;
HORIZONTAL: string;
VERTICAL: string;
};
};
};
};
googleTranslateElementInit?: () => void;
}
}
declare const _default: import("#app").Plugin<{
googleTranslate: {
activeLanguage: any;
supportedLanguages: any;
setLanguage: (lang: string) => void;
isLoaded: Readonly<import("vue").Ref<boolean, boolean>>;
};
}> & import("#app").ObjectPlugin<{
googleTranslate: {
activeLanguage: any;
supportedLanguages: any;
setLanguage: (lang: string) => void;
isLoaded: Readonly<import("vue").Ref<boolean, boolean>>;
};
}>;
export default _default;