Jump to content

About This File

Re-sort a (translated) text file to it's original order.

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. Below see the usage, and more below some detailed explanation, how and why it is useful.


Sorting based on StartPattern.

Usage: Resorter.exe "StartPattern" "RemainingPattern" "OriginalFile" "SortedFile"
StartPattern:     usually the text id
RemainingPattern: the remaining text (the translation) after the text id
SortedFile:       the sorted (and translated) text file
OriginalFile:     the original sorted (not translated) text file
Target File:      the re-sorted (and translated) text file to it's original order, name will be "[SortedFileName].resorted.[ext]"

Example:
Sniper Elite 4 txt one line: M02_RADIO_OPERATOR_DLG01_L03_GERGRNT01_01=I'm serious, man - radio it in!
Command line: Resorter.exe "^[^=]*=" ".*$" "M02_Marina.pc_en.txt" "M02_Marina.pc_en.sortedtranslated.txt"

FAQ:
If some lines missing from the sorted txt, those lines will be filled from the original file.
Empty lines in original file will be preserved in the resorted txt.
Lines in original file which do not match for the StartPattern, will be preserved in the resorted txt.

 

How this can be used?

For example, in Sniper Elite 4 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.


Game Name

Commonly used

User Feedback

Create an account or sign in to leave a review

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

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

There are no reviews to display.

×
×
  • Create New...