From affee39ad5ae924e49fa782d9bdd020abdfe05e0 Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Thu, 20 Aug 2026 20:20:35 +0200 Subject: [PATCH 01/14] ref(csp): Render effective-directive help as JSX The CSP effective-directive help strings embedded literal tags and escaped angle brackets, then rendered them with dangerouslySetInnerHTML. Translators had to carry markup, and a missing slash in the worker-src entry (Worker) produced nested unbalanced tags. Use tctCode() with [code:...] groups so the markup is real JSX and the translated strings hold only text. No visual change. Co-Authored-By: Claude --- .../csp/help/effectiveDirectives.tsx | 134 +++++++++--------- .../events/interfaces/csp/help/index.tsx | 6 +- 2 files changed, 68 insertions(+), 72 deletions(-) diff --git a/static/app/components/events/interfaces/csp/help/effectiveDirectives.tsx b/static/app/components/events/interfaces/csp/help/effectiveDirectives.tsx index 74fbfd69b32e..2e84243e90d0 100644 --- a/static/app/components/events/interfaces/csp/help/effectiveDirectives.tsx +++ b/static/app/components/events/interfaces/csp/help/effectiveDirectives.tsx @@ -1,106 +1,106 @@ -import {t} from 'sentry/locale'; +import {tctCode} from 'sentry/locale'; export const effectiveDirectives = { - 'base-uri': t( - `The base-uri directive defines the URIs that a user agent + 'base-uri': tctCode( + `The [code:base-uri] directive defines the URIs that a user agent may use as the document base URL. If this value is absent, then any URI is allowed. If this directive is absent, the user agent will use the - value in the <base> element.` + value in the [code:] element.` ), - 'child-src': t( - `The child-src directive defines the valid sources for + 'child-src': tctCode( + `The [code:child-src] directive defines the valid sources for web workers and nested browsing contexts loaded using elements such as - <frame> and <iframe>.` + [code:] and [code: