From 6603dc176b62e556d928a272dd2ced408f1a1ccd Mon Sep 17 00:00:00 2001 From: doxa-maps-88655c70 <88627970+doxa-maps-88655c70@users.noreply.github.com> Date: Fri, 25 Sep 2026 03:19:14 +0000 Subject: [PATCH] FilterDropdown: translate when the host has i18n, never require it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit db36397b made the dropdown call useI18n() unconditionally. That throws "Need to install with `app.use` function" on any host that never installed vue-i18n, and people-groups-grid deliberately doesn't (its labels come through its `t` prop). The grid rendered 2 DOM nodes and a page error: standalone, in the plugin studio, and inside every composite that nests it (research-map-plus-grid, stack-demo). The dropdown now uses the host's translations when it has them and the English strings otherwise. Verified: people-groups-grid renders with no error again, and region-dashboards in French still shows "Aucune option trouvée". --- library/components/search/FilterDropdown.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/components/search/FilterDropdown.vue b/library/components/search/FilterDropdown.vue index 5478048a0..355c0cff8 100644 --- a/library/components/search/FilterDropdown.vue +++ b/library/components/search/FilterDropdown.vue @@ -38,7 +38,15 @@ const props = defineProps({ // two visible strings — the clear button and the empty state — were English literals, and one of // them ('No options found') was ALREADY catalogued in eleven locales elsewhere in this repo, so // the translation existed and this component was ignoring it. -const { t } = useI18n() +// +// ★ i18n IS OPTIONAL HERE, NOT REQUIRED. useI18n() THROWS ("Need to install with `app.use` +// function") when the host element never installed vue-i18n — and people-groups-grid deliberately +// doesn't (its labels arrive through its `t` prop). The unguarded call blanked the grid standalone, +// in the studio and inside every composite that nests it (measured 2026-09-25: 2 DOM nodes, page +// error on mount). Use the host's translations when it has them, English otherwise. +const FALLBACK = { 'buttons.clearSelection': 'Clear selection', 'buttons.noOptions': 'No options found' } +let t = (key) => FALLBACK[key] || key +try { t = useI18n().t } catch (_) { /* no i18n on this host: keep the English fallback */ } const emit = defineEmits(['filter-change', 'filter-clear'])