Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
How to use anguluar i18n in html template with variables?

Is it possible to use variables in an angular template i18n string?

In TypeScript I can use template string, eg:

public welcomeMessage = $localize`:@@test.welcome: Hello ${this.name}:user_name:! How's your day?`;

Can I use something similar in html templates? eg

<p i18n="@@test.welcome">Hello {{name}}:user_name:! How's your day?</p>

Hope you get my point.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I've ran into the same issue and the Angular i18n documentation is somewhat unclear about interpolation and naming the interpolated placeholder. For simple text interpolation you can just use:

<p i18n>Hello {{name}}! How's your day?</p>

But AFAIK there is currently no way of naming the interpolated placeholder, it will just end up being the interpolated text:

<source>Hello <x id="INTERPOLATION" equiv-text="{{name}}"/>! How&apos;s your day?</source>

However, you could always change the placeholder (equiv-text) manually in the extracted XLIFF file.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda