Last updated
Last updated
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
.
Open the newly created de.json
file.
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):
After (de.json):
cfg.lua
FileChange 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:
Replace "en"
with the language code of the new translation file you created. For German, it should be:
After making these changes:
Save your edited de.json
and cfg.lua
files.
Restart your FiveM server to apply the new language settings.
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.