I noticed something looked strange in the latest version regarding the code for the polish conversion for BG1, so I tried to install it. As ALIEN reported, it failed because it couldn't find text @101 (ERROR: No translation provided for @101).
During installation, game.tra was updated but thalan.tra was not (the date changed only for the first one). When I looked at the files while WeiDU was still waiting for my answer about another try (hence backup directory was not empty), I noticed the two files were actually using UTF8 characters, even though there was no sign that HANDLE_CHARSETS had been run (no utf8 something files).
I restarted from the original archive downloaded from the Release list on GitHub (4.1a). The two polish tra files are indeed using UTF8 charset in the archive. This is a big issue for everyone, including BGEE players.
I converted them back to Windows1250 using iconv, then compared them to the previous archive of the Release list (4.1). They were now the same, save for the additional /* BG2engine */ at the beginning.
I tried installing again. I had the same error, and again only game.tra had changed date. But it remained identical. Since the tp2 file and tpa file don't use BUT_ONLY_IF_IT_CHANGES, both files should have changed. That shows that the code in the tp2 is not working.
While studying the conversion script, I found a reason for the failure to convert characters in game.tra, despite it being modified, is that the BG1polish_fonts.tpa file is written in UTF8 encoding. Hence all special characters appearing in the file are actually two bytes characters that don't appear in the Windows1250 encoded files and the REPLACE_TEXTUALLY can only fail.
I rebuilt the BG1polish_fonts.tpa in ANSI encoding, starting from the BG1&BG2UniversalPolishFont.tpa from BG1UB, in order to ensure I copied exactly the character codes.
Still installation wouldn't work properly with the modified tpa file.
Finally, I found the reason why only game.tra was modified. The cause is where I spotted a potential issue at first. The code in the tp2 file was
ACTION_IF "%LANGUAGE%" STR_EQ "polish" && GAME_IS totsc BEGIN
COPY "thalan/tra/polish/thalan.tra"
"thalan/tra/polish/game.tra"
PATCH_INCLUDE "thalan/lib/BG1polish_fonts.tpa"
END
This copies thalan.tra into game.tra, while converting the characters!!! Since thalan.tra doesn't contain @101, the overwritten game.tra didn't either and the installation failed. The game.tra file was then copied from the backup when WeiDU rolled back, this explains the time change and the identical content.
I fixed it like this, adding BUT_ONLY_IF_IT_CHANGES as well in order to easily notice if the files were really changed.
ACTION_IF "%LANGUAGE%" STR_EQ "polish" && GAME_IS totsc BEGIN
COPY "thalan/tra/polish/thalan.tra" "thalan/tra/polish/thalan.tra"
"thalan/tra/polish/game.tra" "thalan/tra/polish/game.tra"
PATCH_INCLUDE "thalan/lib/BG1polish_fonts.tpa"
BUT_ONLY_IF_IT_CHANGES
END
And there weren't!!!
Finally, I found a mistake in BG1polish_fonts.tpa that was another cause of the failure to convert the files.
PATCH_IF FILE_CONTAINS_EVALUATED(~%SOURCE_FILE%~ ~BG2engine~) BEGIN //TRA are BG2 coded
According to the WeiDU readme, SOURCE_FILE is only the file name without the path. Since the files are not in the game directory, that fails. You need to use SOURCE_FILESPEC instead.
After that the installation proceeded properly and the tra files were changed, including BG2engine becoming BG1engine. Since I don't have a polish version of BG1, I can't check the characters. However, comparing the original and the converted tra files bring a lot of differences, and the converted thalan.tra has the same content as thalanBG1_PL.tra, except for one word (Grozy instead of Horroru for text @34).
To sum up, here is an archive containing the files that I had to change:
- game.tra and thalan.tra : Windows1250 encoding
- BG1polish_fonts.tpa : non UTF-8 encoding and SOURCE_FILESPEC change
- thalan.tp2 : proper COPY statement for thalan.tra and game.tra
I also installed in polish on BGEE, these changes included. I invoked an item with the console and its description looked right (I checked the proficiency text, with its dashed l).
However I don't understand how my changes would solve the problem that ALIEN reported. Even if having the tra files already in UTF8 will cause the presence of wrong characters after conversion to UTF8 by HANDLE_CHARSETS, text @1 should be found. Nevertheless, it worked with the changes.