# 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.
