Already HTML-escaped text content
Target article language (kept only for backward compatibility; currently not used by this function)
When the environment variable SVSPAN_STRICT=1 is set, this function throws when called for a non-Swedish, non-English target language. This forces the architectural split described in analysis/agentic-workflow-quality-plan ยงP0-1: scripts must never emit untranslated Swedish into a target-language article โ AI translation of titles/summaries must happen upstream. Strict mode is opt-in so that existing test suites continue to pass unchanged; agentic workflows will enable it via their runtimes.env block once the upstream translation contract (see news-translate.md) is in place.
Emit a Swedish-language span.
The span always carries both the
lang="sv"accessibility attribute ANDdata-translate="true"so thattranslateSwedishContent()(intranslation-dictionary.ts) can locate every Swedish phrase, look it up in the per-language dictionary, and replace or clean the marker before the article is written to disk.translateSwedishContent()strips the marker but keeps the Swedish text unchanged.translateSwedishContent()attempts dictionary translation viatranslatePhrase()and removes the marker regardless of whether a match was found, so nodata-translateattributes remain in the final HTML.