# Translations

<figure><img src="https://598543987-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3nnlrjn6TtcCpL6SXFhI%2Fuploads%2FvsHhgIogdEfVJbrR9mt6%2FScreenshot%202022-10-31%20at%201.51.19%20PM.png?alt=media&#x26;token=c4770bc2-6b69-4517-9eec-e906632d8644" alt=""><figcaption></figcaption></figure>

we build a translations loader that loads translations from the database, and you can scan current translations and export them to an excel sheet and import it again to the system.

### Install

```bash
composer require queents/translations-module
```

### Install Translations Plugin

Add Module to `modules_statuses.json` if not exists

```json
{
    "Translations": true
}
```

to install translations plugin you must run this command

```bash
php artisan translations:install
```

it will generate a permission for the translations table and append it to the main admin role.

Make a migration

```bash
php artisan migrate
```

Publish Assets

```bash
npm i & npm run build
```

OR

```bash
yarn & yarn build
```

### Active Auto Translation

to active auto translation feature you must go to google cloud and get an api key after allow google translation api and on the .env file

```
GOOGLE_API=
```

set this key to your API key, or you can set it on the Google Settings

### Use Translation Key On JS

you can now access this translations by key from `trans` prop and you can access it like `this.$page.props.trans` as a computed method like

```javascript
computed: {
    lang() {
        return this.$page.props.data.trans
    }
},
```

and you can build an easy to use method for get translation by key like

```javascript
methods: {
    trans(key){
        return this.lang[key] ? this.lang[key] : key;
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://queents.gitbook.io/vilt/plugins/translations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
