0

Is it possible to output html instead of a string as the object value when using nuxt-i18n?

It would be great if you could teach me!

en.json

{
  "HELLO_WORLD": "<p>Hello World<p>"
}

pages/index.vue

<template>
  <div>
    { $t('HELLO_WORLD') }}
  </div>
</template>

■Desired result

<div>
  <p>Hello World<p> ← html tag
</div>

■Actual results

<div>
  <p>Hello World<p> ← Tags are also strings
</div>

1 Answers1

1

simply replace your template by using below code:

<template>
  <div v-html="$t('HELLO_WORLD')">
  </div>
</template>
Mahamudul Hasan
  • 2,745
  • 2
  • 17
  • 26