Skip to main content

Installation

info

To get full image of working Vue integration, check our Vue Example Application.

info

Tolgee for Vue currently supports only Vue v3.

To install Tolgee Vue integration library run:

npm install @tolgee/vue

To install UI bundle for in-context translating you will also need to install package @tolgee/ui.

npm install @tolgee/ui

First, you will need to wrap your application with TolgeeProvider component.

<template>  <TolgeeProvider :config="config">    <Children ... />    <template v-slot:fallback>      <div>Loading...</div>    </template>  </TolgeeProvider></template>
<script>import { TolgeeProvider } from '@tolgee/vue';
export default {  components: { TolgeeProvider },  data() {    return {      config: {        apiUrl: process.env.VUE_APP_TOLGEE_API_URL,        apiKey: process.env.VUE_APP_TOLGEE_API_KEY,        ui: process.env.VUE_APP_TOLGEE_API_KEY          ? require('@tolgee/ui').UI          : undefined,      },    };  },}</script>

If you bootstrapped your application with vue-cli, your .env.development.local file should look like this:

VUE_APP_TOLGEE_API_URL=https://app.tolgee.ioVUE_APP_TOLGEE_API_KEY=<your_api_key>

Otherwise, you can set the properties directly, or you can use plugins like dotenv-webpack plugin.

Obtaining Tolgee API key is described in integration chapter.

Other configuration properties#

Configuration properties for all web integrations are similar. They are described in configuration section.