Hi all,
SIP-161 (#40679) lets a deployment display chart/dashboard names in the
viewer's locale via a configurable TRANSLATION_HOOK; nothing in core.
Follow-up tracker is #46652. One item there needs consensus because it adds
config surface.
Problem: translation is display-only.
A viewer who sees "Hokohoko" (canonical "Sales") can't find it by typing
"Hokohoko" — the list search filters match the query against canonical columns
only (ChartAllTextFilter, DashboardTitleOrSlugFilter). Search is inconsistent
with what's on screen.
Proposal: an optional, deployment-provided hook that inverts the mapping —
def TRANSLATION_SEARCH_HOOK(query: str, locale: str) -> list[str]:
# canonical source strings whose translation in `locale` matches query
The chart/dashboard text filters would OR the user's raw query with an ILIKE
over each returned candidate. Consistent with SIP-161:
*
Opt-in. Gated on ENABLE_I18N_ASSET_TRANSLATIONS + hook set; otherwise the
filters are unchanged (no cost).
*
Core stores nothing; the hook owns the lookup (inverse of TRANSLATION_HOOK).
*
Canonical query is always still matched, so a bad hook can only be additive.
Hook errors are logged.
First cut: chart + dashboard list search only.
Questions for devs:
*
Hook returns candidate strings — or ready-made SQLAlchemy criteria?
*
Signature (query, locale), or also model/field context like the display hooks
take?
*
Reuse ENABLE_I18N_ASSET_TRANSLATIONS, or a separate flag so deployments can
have display translation without search?
With some consensus I'll open a PR against #46652. The display-side
native-filter-names follow-up is already in #46693 for reference.
Thanks,
alex
Alex Poor
Data Engineer
[Logo Description automatically generated]
Karo Data Management Limited
M +64 272974591 | [email protected]<mailto:[email protected]> |
www.karo.co.nz<http://www.karo.co.nz/>