Jump to content

Recommended Posts

Posted

For game localization usually not just text exporter-importer and translator tools used, but several small helper programs, scripts also which can be used for only one game or a common tool. These can be small .exe programs, python scripts, .bat files, etc. I've recently just made two program, I think they can help to everyone here. I also think about this topic as a collector topic, and I hope you will post also programs which can be used in common.

(I made this topic here in the Game Localization forum because I think this is the right place in ResHax. At first I looked Tutorials, but I think about this topic as a collector of small helper programs/scripts, not tutorials for some complex solution. Moderators cof course can move/delete if they think else.)

 

The first one I called TxtMergeSplitter. It can merge all text files in a folder and it's subfolders to one text file, or split it to subfolders and files. I stole the idea from DeathloopTextTool (created by Amr Shaheen, thanks!) which do this also but only for Dethloop .decl-s. I thought this is a great fueature! Sometimes the game strings can be extracted for not a manageable amount of files, maybe hundreds with just some lines inside. Open them individually, search a specific string to translate or fix them can be a pain in the ***, but if all strings would be in one or just some files, they will be usable. So Imade this tool for common usage.

Explanation how it works:

Let's assume we have this folder and file structure:

TestFolder
TestFolder\Cinematics.srt
TestFolder\EmptyFile.txt
TestFolder\Env.txt
TestFolder\Innerfolder\Play_08.txt
TestFolder\Innerfolder\Core.eng
TestFolder\Innerfolder\Descriptions.txt

Use
TxtMergeSplitter.exe m "TestFolder"
It will make TestFolder.txt within merged all txt. To separate them at every merged txt starts with [MergeSplitPath:path\filename], so at split the program will know where to put the merged content.

TxtMergeSplitter.exe s "TestFolder.txt"
It will create the above folder structure and within the files.

If you just want to merge files with specific extensions just add them to the command line. Let's assume for some reason you do not want to merge the .srt in the above example, so the command will be:
TxtMergeSplitter.exe m "TestFolder" "*.txt" "*.eng"

 

The second one I called Resorter. The starting point was to help translating Sniper Elite 4 and Zombie Army 4. In the other rebellion games the developers arranged the strings in order as they are spoken in the cutscenes, dialogues, but in these two games are not. My SniperRepacker tool needs the original order as they are in the asr files, otherwise after the import there will be a mess. Of course I could modify the tool, but I thought this feature can be used for other games too; and because I'm lazy 🙂. So I instead made this program for common usage.

How this can be used?

For example, M02_Marina.pc_en contain strings in order as this:

M02_TWO_GRUNTS_WITH_WHEELBARROW_DLG01_L05_GERGRNT01_01=Bound to smell a bit, I guess. Who knows how long it's been in the sea?
M02_IGD1A_L02_KARL_01_ALT=A lot of brave men died on the Orchidea –
M02_IGD1A_L02_KARL_02_ALT= we need to make sure their sacrifice was worth it.
M02_NEAR_VILLAGE_SQUARE_DLG01_L01_GERGRNT01_01=People here think Böhm is the devil.
M02_IGD1A_L09_WEAVER_01=The leader is a woman by the name of Sofia di Rocco.

The capitalized characters with underscore until the equal sign is a text id, afterwards the actual string.

There is some ordering, but mostly a mess. If I open the exported txt in Notepad++ and use Edit, Line operations, Sort lines as abc, this will be the result:

M02_KARLTOSELF_SEE_BRIT_OFFICER_BODY_ON_BEACH_01=A British officer..?!
M02_NEAR_VILLAGE_SQUARE_DLG01_L01_GERGRNT01_01=People here think Böhm is the devil.
M02_NEAR_VILLAGE_SQUARE_DLG01_L02_GERGRNT02_01=And what do you think?
M02_NEAR_VILLAGE_SQUARE_DLG01_L03_GERGRNT01_01=I'm just a soldier. I don't think about those things.
M02_NEAR_VILLAGE_SQUARE_DLG01_L04_GERGRNT02_01=Sure. Me neither.

As you can see, M02_NEAR_VILLAGE_SQUARE_DLG01_xxxx is a dialogue, right now in the right order, much easier to translate and well translate. However as I said, my tool can't import this arranged txt. And here comes the resorter!

So, you will need the original txt file, and the sorted-translated txt file. Give them to the resorter, and it will make a new txt, now with the translations, but with the original order! Aaaand because I wanted to make this to usable in common as possible, you will need some understanding of regular expressions. But do not fear of them, much easier than you think at first. I usually use https://regex101.com/ to create regex, it is highlight what the patterns cover, so much easier than just thinking about with books and tutorials.

For example the below command line can be used for the above file. You can copy the text and the regex for regex101.com to see how regular exp. works. Also this can be used for other game files wich uses the same line structure.

Resorter.exe "^[^=]*=" ".*$" "M02_Marina.pc_en.txt" "M02_Marina.pc_en.sortedtranslated.txt"

^[^=]*= is the start pattern, this covers the text id (^ is line start, [^=] is a character which not equal sign, * is a modifier for the previous char, means zero or more times [^=], = is just equal sign)

.*$ is covers the rest until the line end (. is any character, * is zero or more times the previous char, $ is line end)

The other two parameters are the original and the sorted-translated text files.

 

Most of the times you probably do not need these tools, but if needed, I think they can be a huge help.

  • Like 2
Posted
11 hours ago, Lajti said:

I also think about this topic as a collector topic, and I hope you will post also programs which can be used in common.

Well, I have one piece of software that can fit easily to this category. It's not a standalone program, but rather plugin for OmegaT, which makes translating some games a little easier.
https://github.com/bartlomiejduda/OmegaT-Character-Limiter-Plugin

It is designed to help in cases where translated text can't be longer than original text and you want to insert new text without modyfing original offsets.

  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...