Skip to content

[Translator] Literal and (HTML) safe translatables #44937

Closed
@ro0NL

Description

@ro0NL

Description

Inspired by #44911

To work with translatable strings in a uniform way, currently 2 features are missing still IMHO.

  1. bypass the translator for literal text, and avoid if/else based on eg. string|Translatable input
$t = TranslatableMessage::literal('should not be translated')->trans(...);
  1. a bit more controversial; bypass (HTML) escaping

this is arguably already a first-class concept to regognize: https://symfony.com/doc/current/reference/forms/types/form.html#label-html

$t = TranslatableMessage::safe('should be translated, but not escaped when rendered')->trans(...);

This would generalize the case of bypass-escaping in whatever context ...

This could combine 3) safeLiteral()

WDYT?

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions