It is a translation of the game Psychonauts into Thai. It will collect the Dialogues files that have been translated into Thai.
The extraction code and replacement code are originally from TrupSteam/psychonauts-translator and have been further developed to support python3.X.
- Extract dialogues from game file (
.lub
file) to csv - dialogues/ to store csv file of dialogues that are being translated or have been translated
- cutscenes/ to store dialogue files according to cutscenes for easy translation
⚠️ Develop⚠️ Replace dialogues from csv into game file (.lub
file)- ❌💥 Do not use at this time because the game font does not support Thai language.
see sample in dialogues/
id | character | origin_dialogue | translated_dialogue |
---|---|---|---|
CABD001RA | RA | Dogen! Are you okay? | โดแกน! นายไม่เป็นอะไรใช่ไหม? |
id: There will be 9 characters consisting of 3 UPPER Characters + 3 numbers + 2 UPPER Characters, where the last 2 characters are an abbreviation of the name of the character being spoken.
character: It is derived from the last two characters of id
and is like an abbreviation of the character name or you can view it as a "character id". We will store the character abbreviation and the full name in a separate file named character_name.json.
origin_dialogue: The original English dialogue, some of which may contain special characters such as \n
.
translated_dialogue: Column for adding Thai translations
Note: File CSV use delimeter ;
and endline \r\n
- Install Python 3.X (recommend 3.10+)
Comming Soon !!
- Workspace to Easy Development
- Docker
- Devcontainer
The game will store dialogue files in a path like this Psychonauts/WorkResource/Localization/English/**_StringTable.lub
Which can be extracted into a CSV file using the command
Example: Need a CSV file of dialogue from AS_StringTable.lub
python unpack_strings.py --file AS_StringTable.lub
You will get a file dialogues/AS_StringTable.csv
Example: Need a CSV file of all dialogues from Psychonauts/WorkResource/Localization/English
python unpack_strings.py --folder Psychonauts/WorkResource/Localization/English
The file will be in dialogues/
Sometimes if you want to change the destination folder where you want to save the csv from dialogues/
to another folder, you can do it by adding the --dest
flag, for example:
python unpack_strings.py --folder Psychonauts/WorkResource/Localization/English --dest new_dialogues/
Command to extract character from dialogue CSV file and store in character_name.json
Usage: character.py save [OPTIONS]
Options:
-d, --dialogue-folder DIRECTORY
[default: dialogues]
-n, --name FILE [default: character_name.json]
--help Show this message and exit.
Example
python character.py save
If you update the full name in the file character_name.json and want to update the full name in the dialogue CSV file, you can do so with the following command.
Usage: character.py update-dialogue [OPTIONS]
Options:
-d, --dialogue-folder DIRECTORY
[default: dialogues]
-n, --name FILE [default: character_name.json]
--help Show this message and exit.
Example
python character.py update-dialogue
Sample result
Notice the column character
Before
id | character | origin_dialogue | translated_dialogue |
---|---|---|---|
ASGD027GL | GL | Oh, no! | โอ้, ไม่นะ! |
After
id | character | origin_dialogue | translated_dialogue |
---|---|---|---|
ASGD027GL | Gloria | Oh, no! | โอ้, ไม่นะ! |
The principle of creating cutscene dialogue file is to use .dfs
file in Folder psychonauts/WorkResource/cutscenes/prerendered/*.dfs
to search for dialogue in each cutscene and the result file will be stored in folder cutscenes
.
Usage: cutscene.py generate [OPTIONS] [FILE_PATH]...
Generate cutscene dialogue
FILE_PATH: .dfs file path or folder path e.g.
- file path: cutscene.py generate
/psychonauts/WorkResource/cutscenes/prerendered/CABD.dfs
- folder path: cutscene.py generate
/psychonauts/WorkResource/cutscenes/prerendered/
Options:
-c, --cutscene-folder, --dest-folder DIRECTORY
[default: cutscenes]
-d, --dialogue-folder DIRECTORY
[default: dialogues]
--help Show this message and exit.
Example of extracting from some .dfs
files such as CABD.dfs
and CABV.dfs
.
python cutscene.py generate /psychonauts/WorkResource/cutscenes/prerendered/CABD.dfs /psychonauts/WorkResource/cutscenes/prerendered/CABV.dfs
Result file cutscenes/CABD_dialogue.txt and cutscenes/CABD_dialogue.txt
python cutscene.py generate /psychonauts/WorkResource/cutscenes/prerendered/
If we have translated the dialogue from the cutscene dialogue file (cutscenes/*_dialogue.txt) and want to update the translated dialogue into the dialogue CSV file (the file is in the folder dialogues/).
Usage: cutscene.py update-csv [OPTIONS] [FILE_PATH]...
Update cutscene to csv dialogue
FILE_PATH: file path or folder path of cutscene e.g.
- file path: cutscene.py update-csv cutscenes/CASA_dialogue.txt
- folder path: cutscene.py update-csv cutscenes
Options:
--all Update all cutscene in folder 'cutscenes'
-d, --dialogue-folder DIRECTORY
[default: dialogues]
--help Show this message and exit.
python cutscene.py update-csv --all
Example of updating from cutscenes/CASA_dialogue.txt
and cutscenes/CASB_dialogue.txt
python cutscene.py update-csv cutscenes/CASA_dialogue.txt cutscenes/CASB_dialogue.txt