FRAMEWORKS
Frameworks

How to Add a Locale Translation File in ESX

March 29, 2026 · 4 min read

When managing a FiveM server using the ESX framework, providing a multilingual experience can significantly enhance player engagement. Knowing how to add a locale translation file in ESX empowers you to create an environment that caters to diverse communities. This guide walks you through the simple steps necessary to implement this functionality effectively.

Understanding Locale Files in ESX

Locale files in ESX are JSON files used to store translations for various in-game texts. By default, English is the primary language, but by adding locale files, you can introduce additional languages, making your server more accessible and welcoming.

Why Use Locale Files?

  • Improved Accessibility: Players from different linguistic backgrounds can enjoy a better experience.
  • Greater Engagement: A multilingual server attracts a larger audience, fostering community growth.
  • Personalization: Tailor your server’s feel and vibe according to your community’s needs.

Preparing Your ESX Server

Before diving into the actual translation file creation, ensure the ESX framework is correctly installed and configured on your server.

  1. Install ESX: Verify that you have the latest version of the ESX framework and its dependencies.
  2. Check Server Configuration: Open your server.cfg and ensure the required resources are started:
    start es_extended
    start your_resource_name
    

Creating Your Locale Translation File

Step-by-Step Process

  1. Navigate to Your Resource Folder: Open your resource's directory where you want to add the translation file. This file is usually found under resources/[your_resource_name]/locales/.

  2. Create a New Locale File: Create a new file and name it according to the language you want to add, e.g., fr.lua for French.

  3. Define Your Translations: Open the newly created file and define your translations using the following format:

    Lang = { 
        ['welcome'] = 'Bienvenue sur notre serveur!',
        ['exit'] = 'Sortie',
        ['hello'] = 'Bonjour',
    }
    

    Adjust the keys (like ‘welcome’ or ‘exit’) to match the game’s context and add as many translations as necessary.

Example of a Basic Locale File

Here’s a quick example of what your locale file might look like:

Lang = { 
    ['welcome'] = 'Bienvenue sur notre serveur!',
    ['goodbye'] = 'Au revoir!',
    ['help'] = 'Aide',
}

Integrating the Locale Translation File

After creating the locale file, you need to integrate it into your ESX resource:

  1. Edit fxmanifest.lua: Open your resource's fxmanifest.lua file. Add the following line to include your locale file:

    files { 'locales/fr.lua' }
    
  2. Load the Locale: In your resource’s main script file (usually client.lua or main.lua), load the locale file using:

    Locales = require('locales.fr')
    

Testing Your Locale Integration

  1. Restart Your Server: Use the command restart your_resource_name to reload your changes.
  2. Check for Errors: Monitor the server console for any errors related to file loading or syntax issues in your locale file.
  3. Test In-Game: Join your server and attempt to use the translated keys in their respective contexts. For example, display messages using:
    print(Locales['welcome'])
    

Troubleshooting Common Issues

Issues You Might Encounter

  • Translation Not Displaying: Ensure that the keys used in your locale file match exactly with those referenced in your code.
  • File Load Errors: Confirm that the locale file is in the correct directory and correctly listed in fxmanifest.lua.
  • Syntax Errors: Check for typos or formatting mistakes in your locale file. A missing comma or brackets can lead to loading failures.

Quick Troubleshooting Checklist

  • Is the locale file created in the correct directory?
  • Is the locale file correctly referenced in fxmanifest.lua?
  • Are there any syntax errors in the locale file?
  • Are the keys referenced correctly in your scripts?

Frequently Asked Questions

How do I add multiple languages?

To add more languages, simply create additional locale files (e.g., es.lua for Spanish) and follow the same integration steps.

Can I modify existing translations?

Yes, you can modify translations in the existing locale files by changing the values associated with the keys.

What file format do locale files use in ESX?

Locale translations are typically stored in Lua format (.lua) in ESX, using a simple key-value structure.

How can I switch between languages in-game?

You can implement a simple command or UI option that allows players to switch languages, changing the Lang variable dynamically.

Can I use locale files for other frameworks?

Yes, similar methods apply to frameworks like QBCore and QBox, although the specific implementation may vary.

By following these steps, you'll not only learn how to add a locale translation file in ESX but also enhance the overall experience for your players. For more scripts and resources to help you develop your FiveM server, check out our collection of scripts or explore our assets. Happy roleplaying!

#esx#locale#translations#fivem#roleplay

Keep reading