LocresExporter is a Python 3.8 script that extracts VALORANT's localized text (in other words, the Game.locres
file)
into a JSON format for general use and better readability.
pip install git+https://github.com/NotToDisturb/LocresExporter.git#egg=LocresExporter
The following tools are also required:
- QuickBMS
- UnrealTournament4 (4.25 downward) (needed for backwards compatibility)
- UnrealTournament4 (4.26 upward)
- UnrealLocres
LocresExporter
<LocresExporter instance>.export_locres
<LocresExporter instance>.extract_locres
<LocresExporter instance>.locres_to_csv
<LocresExporter instance>.csv_to_json
Creates an instace of LocresExporter, loading the config. If
game_path
is provided, it should be a path to aVALORANT-Win64-Shipping.exe
, see more in Example paths.Check the Config file section and the ConfigLoader repo to learn more about how the config file works.
locres_pak_path: str, json_path: str = None, force_overwrite: bool = False,
sort_keys: bool = False, archive: bool = False
) -> dict
Executes
extract_locres
,locres_to_csv
andcsv_to_json
in one go. Check their individual documentations for more information.Returns a
dict
with the contents ofGame.locres
Extracts
Game.locres
from the pak proved inlocres_pak_path
into the working path (working_path
in the config) by running two QuickBMS (quickbms_path
in the config) scripts:
- First the UnrealTournament4 script (4.26 upward) (
ut4_path
in the config) is run.- If no result is obtained, the UnrealTournament4 (4.25 downward) script (
ut4_old_path
in the config) is run.
locres_pak_path
should be a path to a{language}_Text-WindowsClient.pak
file
Runs UnrealLocres (
ul_path
in the config) to parseGame.locres
into a CSV and removesGame.locres
.If
csv_path
is provided, the parsed CSV will be copied to that location.
json_path: str = None, force_overwrite: bool = False,
sort_keys: bool = False, archive: bool = False
) -> dict
Converts the CSV file resulting from
locres_to_csv
to JSON.
- If
json_path
is provided, the JSON will be saved there. Otherwise, it will be saved in the output path (output_path
in the config) .- If true,
force_overwrite
skips the overwrite dialogue when the JSON already exists.- If true,
sort_keys
sorts the keys within each group in natural order.- If true,
archive
also copies the JSON to an archival path. See more in the Archiving section.Returns a
dict
with the contents ofGame.locres
LocresExporter uses a configuration file to know where the needed tools and other paths are:
Path | Validation type | Description |
---|---|---|
quickbms_path | File | Path to the QuickBMS executable. |
ut4_path | File | Path to the UnrealTournament4 (4.25 downward) script. |
ut4_old_path | File | Path to the UnrealTournament4 (4.26 upward) script. |
ul_path | File | Path to the UnrealLocres executable. |
aes_path: | File | Path to the AES key, a text file containing only the key in 0x<key> format. |
valorant_path | Folder | Path to your VALORANT installation folder. See more on Example paths. |
working_path | Folder | Path where the extraction of Game.locres and its parsing to CSV will take place. The Game.locres file will not be kept after the execution ends. |
output_path | Not empty path | Path where the parsed JSON file will be placed. Check out the available output path keywords. |
Found in | Path | Example |
---|---|---|
Code | game_path |
C:\Riot Games\VALORANT\live\ShooterGame\Binaries\Win64\VALORANT-Win64-Shipping.exe |
Code | locres_pak_path |
C:\Riot Games\VALORANT\live\ShooterGame\Content\Paks\en_US_Text-WindowsClient.pak |
Config | valorant_path |
C:\Riot Games\VALORANT\live\ |
Keyword | Description |
---|---|
{pak_language} |
Replaced by the language of the Game.locres in xx_YY format |
{folder_language} |
Replaced by the language of the Game.locres in xx-YY format |
{game_version} |
Replaced by the game version on the provided executable |
Here is an example of how to use LocresExporter:
from locresexporter import LocresExporter
LOCRES_PAK_PATH = "C:\\Riot Games\\VALORANT\\live\\ShooterGame\\Content\\Paks\\en_US_Text-WindowsClient.pak"
exporter = LocresExporter("en_US", "en-US")
exporter.export_locres(LOCRES_PAK_PATH)
The first time this script is run, it will exit after generating locres_config.json
.
Subsequent runs will continue exiting until the configuration file is filled out correctly.
Once it is, the script will execute properly and the exported JSON will be in the output path (output_path
in the config).
LocresExporter features an archival feature that allows the user to automatically archive
every Game.locres
file exported. The first time a script that uses LocresExporter
is run with archive=True
, a new config file will be generated within the installation path
of LocresExporter (shown by the script upon generation).
That configuration can be identical to the one in your project folder, but in order to not overwrite Game.locres
from other versions, it is recommended that the filename of the path in output_path
be Game-{pak_language}-{game_version}.json
It is also possible to use LocresExporter as a standalone script:
- Download the latest release
- Extract the zip file
- Open a console inside the extracted folder
- Install the required packages using
pip install -r requirements.txt
- Run the script using
python locresexporter.py
In the first execution, the config file is created and needs to be filled out.
Check out Installation for the tools required and
Config file for more details on how to fill out the config.
Running the script after filling out the config file will export Game.locres
file for the language selected.