---
title: "What is $t() in Vue?"
description: "This article explains what the $t() function is in Vue.js and how you can use it to translate your application into multiple languages."
canonical: "https://www.codeandweb.com/babeledit/knowledgebase/what-is-t-in-vue"
product: "babeledit"
source: "html"
---

# What is \$t() in Vue?

The \$t function is part of the Vue-i18n library, and it is used to translate text in a Vue.js application. It works by looking up a translation key in a language file, and returning the translated text associated with that key.

![How to translate your Vue.js 3 application with vue-i18n](https://www.codeandweb.com/static/06e0cbd5c4f41c3493bcb365199d8de8/d8f52/how-to-translate-your-vue-app-with-vue-i18n.png)

[How to translate your Vue.js 3 application with vue-i18n](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-vue-app-with-vue-i18n.md)

Free tutorial: Set up Vue.js with vue-i18n. Translate your templates, create and edit JSON translation files, switch languages at runtime. Covers Vue 3.

Read now →

For example, if you have a language file that contains the following:

**locales/fr.json**

```json
{
    "hello": "Bonjour"
}
```

You can use the `$t` function to translate the key "hello" like this:

```html
<template>
    <div>{{ $t("hello") }}</div>
</template>
```

In this example, the `$t` function will return "Bonjour". The language file and the translation keys can be customized to meet the needs of your application.

The `$t` function also takes additional parameters that you can use inside the translation messages - e.g. to pass a name or other values.

See our tutorial [How to translate your Vue.js application with vue-i18n](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-vue-app-with-vue-i18n.md) for an in-depth description of how to use vue-i18n.

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "headline": "What is $t() in Vue?"
}
```
