import type { createI18n } from 'vue-i18n'; import { get } from 'lodash'; import { useVelon } from '../../plugins'; export type TranslateFunc = (key: string) => string; export type SetLocaleFunc = (local: string) => void; export interface YunzaiI18n { instance: ReturnType; translate: TranslateFunc; setLocale: SetLocaleFunc; } export function hashTranslated(path: string): boolean { const velon = useVelon(); const { locale, getLocaleMessage } = velon.i18n!.instance.global; if (!locale) return false; const message = getLocaleMessage(locale as string); if (!message) return false; const data = get(message, path, undefined); return Boolean(data); }