n How to translate text with parameters with Vue I18n in Vue.js | CodimTh

Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

In this post, I will show you how to translate text with parameters with Vue I18n in Vue.js.

Simple text

To use a translation use the $t() function with a translation id as parameter:

<template>
  <p>{{ $t('hello') }}</p>
</template>

Text with parameters

You can of course add parameters to your translation texts:

{
    "hello": "Hallo {name}!",
}
<template>
  <p>{{ $t('hello', { name: 'Vue.js'}) }}</p>
</template>

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook