Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a set of whitelisted HTML tags inside of i18n.defaultMessage. #24090

Closed
azasypkin opened this issue Oct 16, 2018 · 2 comments
Closed

Allow a set of whitelisted HTML tags inside of i18n.defaultMessage. #24090

azasypkin opened this issue Oct 16, 2018 · 2 comments
Assignees
Labels
enhancement New value added to drive a business result Project:i18n stale Used to mark issues that were closed for being stale Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@azasypkin
Copy link
Member

As it turned out Kibana has many places where we may want to use HTML tags/elements inside of defaultMessage, e.g. long texts that include <p>, <ul> or <strong>. For example, for the long text that needs <p> we should write something like this:

<EuiText>
  <p><FormattedMessage id="visHelpText.p1" defaultMessage="P1 ..." /></p>
  <p><FormattedMessage id="visHelpText.p2" defaultMessage="P2 ..." /></p>
  <p><FormattedMessage id="visHelpText.p3" defaultMessage="P3 ..." /></p>
</EuiText>

but ideally we'd rather have something like this:

<EuiText>
  <FormattedMessage id="visHelpText" defaultMessage=`
    <p>P1 ...</p>
    <p>P2 ...</p>
    <p>P3 ...</p>
  `/>
</EuiText>

Currently it's not supported by the FormattedMessage we use for React translations (formatjs/formatjs#513), only by FormattedHTMLMessage usage of which is discouraged and that doesn't work well with textElement=React.Fragment we use to avoid additional spans.

We should define a set of text-level HTML tags (+ <a> and <img>) that we'll allow within localizable text. I like the idea that DOM Overlays rely on, maybe we can implement something similar. The solution we'll find should work for both React and Angular in a similar fashion, and, it seems, will require quite a bit of work on our end.

/cc @timroes @pavel06081991 @elastic/kibana-platform

@azasypkin azasypkin added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Project:i18n enhancement New value added to drive a business result labels Oct 16, 2018
@joshdover joshdover added the stale Used to mark issues that were closed for being stale label Jan 14, 2021
@timroes
Copy link
Contributor

timroes commented Jan 15, 2021

@joshdover could you please explain why this got closed? Have we made a final decision not to implement this? Is this now tracked by some other issue?

@Bamieh
Copy link
Member

Bamieh commented Jan 29, 2021

@timroes We've recently closed all old stale issues. For this specific issue our intl library provides such functionality once we upgrade the package. which is something we're planning to prioratize and work on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Project:i18n stale Used to mark issues that were closed for being stale Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

4 participants