1π
β
Itβs necessary to import $translation
in script section any way, global variables (not properties) canβt appear out of nowhere, unless some kind of magic transforms like Unplugin are used. In order to do that, it should be exported:
export let $translation: (key: string) => string;
export const plugin = {
install(app: App, options: any) {
$translation = (key: string) => {...};
app.config.globalProperties.$translation = $translation
}
}
For Vue 3, @vue/runtime-core
type augmentation can be tried instead of vue
:
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$translation: (key: string) => string;
}
}
π€Estus Flask
Source:stackexchange.com