// The layer's labels (UI-SPEC L8) in the page's content locale: the resolve // answer's locale, then html_lang's primary subtag, then en. An app // overrides or adds locales in its app.config.ts: // // export default defineAppConfig({ seo: { labels: { pl: { sitemap: { title: 'Spis stron' } } } } }) // // Component props override both. import type { ComputedRef, MaybeRefOrGetter } from 'vue' import { pickLabels, type SeoLabelOverrides, type SeoLabels } from '../utils/labels.ts' /** * The labels of the page's content locale, or of `locale` when given and * not empty (the HTML sitemap pages know theirs from the route). */ export function useSeoLabels(locale?: MaybeRefOrGetter): ComputedRef { const answer = useSeoAnswer() const appConfig = useAppConfig() as { seo?: { labels?: SeoLabelOverrides } } return computed(() => { const own = toValue(locale) if (own) return pickLabels(own, '', appConfig.seo?.labels ?? {}) return pickLabels(answer.value?.locale, answer.value?.html_lang, appConfig.seo?.labels ?? {}) }) }