- useSeoLabels(): the L8 dictionary (en, pl) of the page's content locale (resolve locale, then html_lang, then en), overridable and extendable in app.config.ts under seo.labels; no i18n dependency - seo-tokens.css (spacing, colour, small type, breadcrumb separator) and seo-base.css (.seo-visually-hidden, the focus ring of layer links), loaded before the app's CSS and styling only .seo-* classes
17 lines
751 B
TypeScript
17 lines
751 B
TypeScript
// 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 } from 'vue'
|
|
import { pickLabels, type SeoLabelOverrides, type SeoLabels } from '../utils/labels.ts'
|
|
|
|
export function useSeoLabels(): ComputedRef<SeoLabels> {
|
|
const answer = useSeoAnswer()
|
|
const appConfig = useAppConfig() as { seo?: { labels?: SeoLabelOverrides } }
|
|
return computed(() => pickLabels(answer.value?.locale, answer.value?.html_lang, appConfig.seo?.labels ?? {}))
|
|
}
|