Check for Missing and/or Unused locale keys in ESX

Locale Check

image

Use this Python utility script, to search for missing and/or unused translation keys in your server’s configured locale file.

This script is intended to scan actual script .lua files inside an FXServer’s (CFX/FiveM server) resources folder, looking for translation keys, used by ESX.

The ESX framework uses two functions called Translate and TranslateCap to retrieve translations from their respective locale files.

Once it finds all the keys used in the script files, it will scan the pt.lua file inside the locales folder.
In order to find out which keys are missing, it will compare the keys found in the script files with the keys found in the pt.lua file.

The script will then print the keys that are missing and/or unused from the pt.lua file
It should be obvious by now that this is hardcoded for the ‘pt’ locale. But it’s fairly trivial to change to whatever language you need. (I find this to be “configurable” enough. But if this isn’t enough to fulfil that rule please tell me.)

It’s a gist, so there’s no license attached to it. Use however you like.

2 Likes

Nice idea, great work

1 Like