• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

WIP Spanish translation

Thanks for all that, @Homo eructus! :cheers

A few more corrections are in order. First, check your English files - some of them aren't entirely in English. ;)

Attached are:
PROGRAM\INTERFACE\interface.c - correction for locations in savegame names
RESOURCE\INI\TEXTS\SPANISH\common.ini - new string "unknown location", should not appear unless "interface.c" can't work out where you are when you're trying to save game
RESOURCE\INI\TEXTS\SPANISH\interface_strings.txt" - new strings "Small cave", "Vice Admiral's Residence", "The Dark Frigate", "The Faithful Bride",
"#stown_name# Naval HQ, "Officer Commanding #stown_name# Naval HQ", "Mrs. Mason's House", "Office". (And some others which either I already translated by copying from elsewhere in the game, or which don't need to be translated.)
RESOURCE\INI\TEXTS\SPANISH\Storyline\storyline_strings.txt - new string "Discovery", which is Beatrice Devlin's ship now, but leave "Quicksilver" in there as well because Bonnie Devlin gets that in FreePlay.
 

Attachments

  • interface.c
    62.6 KB · Views: 76
  • common.ini
    85.8 KB · Views: 68
  • storyline_strings.txt
    35.9 KB · Views: 75
  • interface_strings.txt
    138.3 KB · Views: 62
Last edited:
Two more locations needing to be translated:
Entrance Hall
Cardroom

You'll probably see them if you play a FreePlay gambler...
 
Entrance Hall = Vestíbulo
Cardroom = Salón de juego

I'm translating the fetch quests in PROGRAM/QUESTS/quest_common.c, but I can't figure out how to translate the storetype (dockyard, blacksmith, etc)

I tried adding XI_ConvertString here options[option]=XI_ConvertString("dockyard"), etc. and, although the store type in the log title was correctly translated, the log entry didn't show up. I guess the strings will have to be defined for translation separately but I'm not sure how.
Code:
        {
            storetype = GetAttributeN(&Stores[ctown.store],i);
            switch(GetAttributeName(storetype))
            {
                case "dockyard":
                    options[option]="dockyard"; option++;
                    break;
                case "taylor":
                    options[option]="tailor"; option++;
                    break;
                case "blacksmith":
                    if (ENABLE_WEAPONSMOD) options[option]="blacksmith"; option++; // PB: NOT if the relevant mod is OFF!
                    break;
                case "gunsmith":
                    if (ENABLE_WEAPONSMOD) options[option]="gunsmith"; option++; // PB: NOT if the relevant mod is OFF!
                    break;
                case "apothecary":
                    options[option]="apothecary"; option++;
                    break;
            }
        }

Adding XI_ConvertString also produces this error log
Code:
RUNTIME ERROR - file: quests\quests_common.c; line: 518
invalid index -1 [size:5]
RUNTIME ERROR - file: quests\quests_common.c; line: 518
invalid array index
RUNTIME ERROR - file: quests\quests_common.c; line: 518
Unknown data type
RUNTIME ERROR - file: quests\quests_common.c; line: 518
invalid index -1 [size:5]
RUNTIME ERROR - file: quests\quests_common.c; line: 518
invalid array index
RUNTIME ERROR - file: quests\quests_common.c; line: 518
Unknown data type
RUNTIME ERROR - file: quests\quests_common.c; line: 518
invalid index -1 [size:5]
RUNTIME ERROR - file: quests\quests_common.c; line: 518
invalid array index
RUNTIME ERROR - file: quests\quests_common.c; line: 518
Unknown data type

Here's the file as it is now, with GetTranslatedLog already in place but no solution for the store types
 

Attachments

  • quests_common.c
    278.6 KB · Views: 68
Last edited:
Translating the 'options' array won't work because it's used for switches further down:
Code:
        string choose = options[rand((option-1))];
...
Code:
        switch(choose)
        {
        case "dockyard":
...
Code:
        tisland.cargos.(cargoid).requester = choose;
That 'requester' attribute is then used in function 'AnnounceFetchQuestEvent', which is where the log is written:
Code:
        logTitle = "The "+tisland.cargos.(cargoid).requester+" of "+FindTownName(tisland.cargos.(cargoid).town)+" needs help.";
        switch(tisland.cargos.(cargoid).requester)
        {
            case "dockyard":
                logEntry = "The governor ordered to build more ships but there aren't enough resources on the island to make them. Looks like they need help to get these goods.";
            break;
So 'logTitle' shows the translated store type but the switch does nothing - it's looking for "dockyard" and seeing the translation of "dockyard". And that's why you're not getting a log entry.

Instead of translating the 'options' array, do the translating at the point where the log is to be written:
Code:
logTitle = "The "+XI_ConvertString(tisland.cargos.(cargoid).requester)+" of "+FindTownName(tisland.cargos.(cargoid).town)+" needs help.";
Or perhaps this is another place where preprocessed variables could be used to make a single string which can go into "shipslog_strings.txt", e.g.:
Code:
Preprocessor_Add("requester", XI_ConvertString(tisland.cargos.(cargoid).requester));
Preprocessor_Add("town", FindTownName(tisland.cargos.(cargoid).town));
logTitle = PreprocessText(GetTranslatedLog("The #srequester# of #stown# needs help."));
Preprocessor_Delete("town");
Preprocessor_Delete("requester");
 
Done. I'll get the other tavern news events and upload

By the way, would it be possible to nudge the title a little to the right in the ship's log? Even some of the longer English titles get mashed wih the date.
1684266637628.png

But it's more noticeable with a lot of the Spanish ones
1684266745330.png

I think this is about as long as titles get so there's still space to the right, even if some are a little bit longer than this.
 
I just realized these tavern events, including the fetch quests, were already translated in EventsDescribe.txt but they don't seem to be working and some of the titles are outdated and some events don't even exist outside of the txt file. So do we try to fix it, or just forget about EventsDescribe.txt and add them to shipslog_strings (like I've already done for the fetchquests)?

The whole process is set in events.c, but as it is, the translation doesn't work
Code:
    //Get a quest
    if(n>=0)
    {
        int chance = rand(TOWNS_QUANTITY*100*EVENT_CHANCE_MULTIPLIER);
        if(chance < QUEST_EVENTS_CHANCE)
        {
            string quest = options[rand(n)];
            int lngFileID = LanguageOpenFile("EventsDesribe.txt");
            switch(quest)
            {
                case "Fetch":
                    //Get data
                    if(FetchQuestType(ctown))
                    {
                        CompleteQuestName("fetch_quest_created");
                        //Set event
                        Preprocessor_Add("town", FindTownName(pchar.quest.fetch_quest_town));
                        logTitle = PreprocessText(LanguageConvertString(lngFileID, quest + "_" + pchar.quest.fetch_quest.type + "_title"));
                        logEntry = PreprocessText(LanguageConvertString(lngFileID, quest + "_" + pchar.quest.fetch_quest.type + "_entry"));
                        Preprocessor_Remove("town");
                    }
                break;
            }
            LanguageCloseFile(lngFileID);
            if(logTitle != "") WriteNewLogEntry(logTitle, logEntry, "General", false);
 
Last edited:
In the meantime, the Spanish questbook for the silver train quest had the wrong encoding and was creating some problems. Fixed
 

Attachments

  • colombian_silver.txt
    4.7 KB · Views: 54
I just realized these tavern events, including the fetch quests, were already translated in EventsDescribe.txt but they don't seem to be working and some of the titles are outdated and some events don't even exist outside of the txt file. So do we try to fix it, or just forget about EventsDescribe.txt and add them to shipslog_strings (like I've already done for the fetchquests)?

The whole process is set in events.c, but as it is, the translation doesn't work
Code:
    //Get a quest
    if(n>=0)
    {
        int chance = rand(TOWNS_QUANTITY*100*EVENT_CHANCE_MULTIPLIER);
        if(chance < QUEST_EVENTS_CHANCE)
        {
            string quest = options[rand(n)];
            int lngFileID = LanguageOpenFile("EventsDesribe.txt");
            switch(quest)
            {
                case "Fetch":
                    //Get data
                    if(FetchQuestType(ctown))
                    {
                        CompleteQuestName("fetch_quest_created");
                        //Set event
                        Preprocessor_Add("town", FindTownName(pchar.quest.fetch_quest_town));
                        logTitle = PreprocessText(LanguageConvertString(lngFileID, quest + "_" + pchar.quest.fetch_quest.type + "_title"));
                        logEntry = PreprocessText(LanguageConvertString(lngFileID, quest + "_" + pchar.quest.fetch_quest.type + "_entry"));
                        Preprocessor_Remove("town");
                    }
                break;
            }
            LanguageCloseFile(lngFileID);
            if(logTitle != "") WriteNewLogEntry(logTitle, logEntry, "General", false);
That part only handles fetch quests and seems to be redundant as fetch quest logs are written in "quests_common.c", function 'AnnounceFetchQuestEvent'. Other events are logged further up in "events.c", function 'LaunchRandomTownEvent':
Code:
            //Get the logTitle and logEntry
            int lngFileID = LanguageOpenFile("EventsDesribe.txt");
            logTitle = PreprocessText(LanguageConvertString(lngFileID, TownEvents[random].id + "_title"));
            logEntry = PreprocessText(LanguageConvertString(lngFileID, TownEvents[random].id + "_entry"));
            LanguageCloseFile(lngFileID);
            
            //Remove preprocessor data
            Preprocessor_Remove("town");
            
            //Write the logentry
            if(logTitle != "") WriteNewLogEntry(logTitle, logEntry, "General", false);

I'm fairly certain this works in English because I'm fairly certain I've seen tavern news entries about malaria, pirates plundering, etc. You could try putting a couple of 'traceandlog' commands before those assignments to 'logTitle' and 'logEntry', e.g.
Code:
traceandlog("LaunchRandomTownEvent: logTitle = '" + TownEvents[random].id + "_title" + "'");
traceandlog("LaunchRandomTownEvent: logEntry = '" + TownEvents[random].id + "_entry" + "'");
That should put the untranslated title and entry both onto screen and into "compile.log" - adding the name of the function to the 'traceandlog' just means you can easily look for the lines by searching "compile.log" for "LaunchRandomTownEvent".
 
I never said the events themselves didn't work, is the translation method set up in events.c that doesn't work, making the file EventsDescribe.txt functionally useless as it is now. That's why I asked whether we should try to fix it to work with EventsDescribe.txt as intended or disregard it , edit the entries directly in Towntables.c with GetTranslatedLog and add them to shipslog_strings instead.
 
Is your file called "EventsDescribe.txt"? If so, it won't work. The function is looking for "EventsDesribe.txt", and that is also the name of the file in the English and Russian folders.
 
Another small fix, CharactersUtilite.c was missing XI_ConvertString for the rank in the promotion logs
 

Attachments

  • CharacterUtilite.c
    150.9 KB · Views: 68
Last edited:
No, it is EventsDesribe.txt, but my brain autocorrected it.

After this line:
Code:
int lngFileID = LanguageOpenFile("EventsDesribe.txt");
... put a 'traceandlog' to show lngFileID. Also add the 'traceandlog' comands which I suggested to show the untranslated versions of logTitle and logEntry, just before the line "//Write the logentry". Then see what shows up on screen and in "compile.log".
 
After this line:
Code:
int lngFileID = LanguageOpenFile("EventsDesribe.txt");
... put a 'traceandlog' to show lngFileID. Also add the 'traceandlog' comands which I suggested to show the untranslated versions of logTitle and logEntry, just before the line "//Write the logentry". Then see what shows up on screen and in "compile.log".
Nothing on screen and nothing on compile.log that I can see

wait, I was missing a ; let me try again

Nop, notthing
 

Attachments

  • compile.log
    41.7 KB · Views: 59
Last edited:
This line:
Code:
traceandlog("lngFileID");
... will only show "lngFileID". If you want to see what the variable holds, change it to:
Code:
traceandlog("lngFileID = " + lngFileID);
But "compile.log" doesn't show even "lngFileID". None of those 'traceandlog' lines have put anything into "compile.log". So function 'LaunchRandomTownEvent' is not being run. If you are getting new town events in the tavern news and nothing from your 'traceandlog' commands in "compile.log", then the town events are being controlled somewhere else.
 
This line:
Code:
traceandlog("lngFileID");
... will only show "lngFileID". If you want to see what the variable holds, change it to:
Code:
traceandlog("lngFileID = " + lngFileID);
But "compile.log" doesn't show even "lngFileID". None of those 'traceandlog' lines have put anything into "compile.log". So function 'LaunchRandomTownEvent' is not being run. If you are getting new town events in the tavern news and nothing from your 'traceandlog' commands in "compile.log", then the town events are being controlled somewhere else.

I think that'd be Towntable.c, where the events are written. I've tested translating them from there with GetTranslatedLog and they seem to work fine, so I guess that makes EventsDesribe.txt obsolete (and maybe events,c too but that one may be controlling other things aswell).
 
Back
Top