Problem with TXT files.

IceHunt7

Chieftain
Joined
Feb 7, 2012
Messages
3
Hey guys.I have a question. Do I need a specific program to edit TXT files?

Because I wanted to translate to my native language, but after translating and saving the file, no letters are visible. For example, Navigation. I change the BLURB0 file. Then I save and run the game. I go to civilopedia and selecting Navigation, an empty board appears instead of an explanation of the above-mentioned technology.
I use Notepad++
 
+1 I've had the same pb in translating in french long time ago
Finally I've given up, i had déduces (maybe i was wrong) that when you translate, you must have the same lenght of the text ...
 
The BLURB?.TXT files are used primarily in Civilopedia.

Heh, there is a clue in BLURB3.TXT :) And also in code: The OpenCiv1 source code specifically, commented section of the code in function F0_2f4d_01ad_GetLanguageItemBySectionAndKey()

The beginning of a file contains the binary index to an hashed entry names that are seeked. This index can be replaced by an empty index (consisting of a '0' ASCII characters of certain length)

The TXT files have beginning with ASCII '0' at the top of them, which are later replaced by a binary index to a position in the file. Each line has 64 '0' characters followed by line terminator "\n\r" (0xd, 0xa) characters (very important).
For example:
Code:
"0000000000000000000000000000000000000000000000000000000000000000\r\n"

Consisting of 8 lines, followed by one empty line, and then, the file content consisting of entries as follows.

Each entry begins with a '*' character and a description (which must not be changed!).
For example:
Code:
"*NAVIGATION\r\n"

And then, by entry contents:
Code:
"The sailors of antiquity studied the night sky. Reading the sky map, the... \r\n"
The content must be divided in multiple lines of not more than 70 characters in a single line with "\r\n" line terminator. The content ends with a space and a line terminator.

Between entries there is a line terminator.

The file end consists of "*END\r\n\r\n\x1a" entry ("\x1a" represents single character in hex).


To summarize (A new file template), replace '\r' character with hex 0xd, '\n' with 0xa and '\x1a' with 0x1a:
Code:
"0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
0000000000000000000000000000000000000000000000000000000000000000\r\n
\r\n
*NAVIGATION\r\n
The sailors... \r\n
\r\n
*CONSTRUCTION\r\n
Advancing beyond... \r\n
\r\n
*END\r\n
\r\n
\x1a"

When editing a file there are two options:
1) Editing with a hex editor the entry name has to remain the same, but the contents can be edited, providing that you don't overwrite: line length and line terminator, ending space at the end of the entry content and line terminator between the next entry.

2) Editing with a text editor. It is important to reproduce the file header at the beginning of the file exactly as in template. You have to keep all of the entry names intact! The text editor has to reproduce the line terminator exactly with "\r\n" characters, and the file structure has to precisely consist of entries, preserved entry names, their contents, and ending with '*END' entry has to be precisely followed.


I have not yet tested this thoroughly. Please give me a feedback if it works for you ;)
 
Last edited:
Back
Top Bottom