# Translate Strings

## Step 1: Adding a New Language

**Copy the Existing `en.json` File**

* Navigate to the `locales` folder within your script files.
* Locate the `en.json` file, which contains the English translations.
* Create a copy of the `en.json` file and rename it to the language code of the new language. For example, if you want to add German, rename it to `de.json`.

## **Translate the New File**

1. Open the newly created `de.json` file.
2. Replace the English text with the corresponding translations for the new language. Make sure to keep the same structure and only change the text values.

For example: **Before (en.json):**

```json
{
    "greeting": "Hello",
    "goodbye": "Goodbye"
}
```

**After (de.json):**

```json
{
    "greeting": "Hallo",
    "goodbye": "Auf Wiedersehen"
}
```

## Step 2: Update the `cfg.lua` File

**Change the Language in `cfg.lua`**

* Open the `cfg.lua` file located in your script's main folder.
* Find the line at the top of the file that sets the current locale:

```lua
lib.locale("en")
```

* Replace `"en"` with the language code of the new translation file you created. For German, it should be:

```lua
lib.locale("de")
```

## Final Steps

After making these changes:

1. Save your edited `de.json` and `cfg.lua` files.
2. Restart your FiveM server to apply the new language settings.
3. Your script will now run in the newly added language.

By following these steps, you can easily add new language support to your script and switch between them by modifying the `cfg.lua` file.


---

# 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://docs.rainmad.com/resources/house-robbery-with-welding-minigame/translate-strings.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.
