Skip to main content
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