• 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

I was refering to the screenshot I posted many posts above, nevermind.

This is the code in calendar.c with ConvertStrings added by me (without them, the week days were translated in the onscreen date but not on the log; with them, they're translated on the log but missing altogether in the date onscreen)
Code:
// KK -->
string GetDayName(int weekday)
{
   string tmpstr = "Sunday";
   switch(weekday)
   {
     case 0: tmpstr = XI_ConvertString("Sunday");  break;
     case 1: tmpstr = XI_ConvertString("Monday");  break;
     case 2: tmpstr = XI_ConvertString("Tuesday");  break;
     case 3: tmpstr = XI_ConvertString("Wednesday"); break;
     case 4: tmpstr = XI_ConvertString("Thursday");  break;
     case 5: tmpstr = XI_ConvertString("Friday");  break;
     case 6: tmpstr = XI_ConvertString("Saturday");  break;
   }
   return tmpstr;
}

// Returns: 0 - Sunday, 1 - Monday, ..., 6 - Saturday
int GetWeekday(int day, int month, int year)
{
   int wday;
   int a = (14 - month) / 12;
   int y = year - a;
   int m = month + (12 * a) - 2;
   if (IsGregorian(day, month, year))
     wday = (day + y + makeint(y / 4) - makeint(y / 100) + makeint(y / 400) + makeint((31 * m) / 12)) % 7;
   else
     wday = (5 + day + y + makeint(y / 4) + makeint((31 * m) / 12)) % 7;
   return wday;
}
Abd this is the relevant bit in sulan_shipslog
Code:
   sDateTime=TranslateString("", "On")+" "+GetDayName(GetWeekday(GetDataDay(), GetDataMonth(), GetDataYear()))+", "+GetHumanDate(GetDataYear(), GetDataMonth(), GetDataDay())+" "+tmp;
   return sDateTime;
}
 
without them, the week days were translated in the onscreen date but not on the log; with them, they're translated on the log but missing altogether in the date onscreen
Probably wherever the onscreen date is coded, there is already a translation in place there.
But I don't know where exactly that code is hiding.

Try to find where 'GetDayName' is referenced elsewhere in the code.
 
LogInterface.c was the place, removing the ConvertStrings from there did the job nicely.

There's a lot more stuff in the ship's log than I had expected, all the town events and everything. This will take me a while.
 
There still a couple of loose ends in the Save/Load menu, concerning the location of the save. The names of the islands and towns are translated (irrelevant in this case as they're the same but it works with Havana (La Habana) and Hispaniola (La Española)) as is the "on the ship" bit, but not the specific location like "Ship deck", "Captain's Cabin" and neither the "port" bit. I can't find those strings anywhere. The code ins save_load.c is
Code:
string GetCurLocationName()
{
   if(GetMainCharacterIndex()<0) return "";
   ref PChar = GetMainCharacter();
   if(!CheckAttribute(PChar,"location")) return "";

// rewritten by MAXIMUS 09.10.2006 [for correct location name showing]-->
   string locLabel, curIsland, curComma;
   locLabel = PChar.location;
// rewritten by MAXIMUS 09.10.2006 [for correct location name showing]<--

   //int tmpLangFileID = LanguageOpenFile("interface_strings.txt");

   int locidx = FindLocation(PChar.location);
   if( locidx>=0 )
   {
     if( CheckAttribute(&Locations[locidx],"id.label") ) {
// rewritten by MAXIMUS 09.10.2006 [for correct location name showing]--> // KK -->
       if (CheckAttribute(&Locations[locidx], "townsack")) Preprocessor_Add("town_name", FindTownName(Locations[locidx].townsack));
       if (CheckAttribute(&Locations[locidx], "island"))
         curIsland = FindIslandName(Locations[locidx].island);
       else
         curIsland = FindIslandName(Islands[FindIslandBySeaLocation(GetCharacterShipLocation(PChar))].id);
       Preprocessor_Add("island_name", curIsland);
       curComma = GetSymbol(locLabel, strlen(locLabel)-1);
       if(curComma==".")
         locLabel = TranslateString("", strcut(locLabel,0,strlen(locLabel)-2));
       else
         locLabel = TranslateString("", locLabel);
       locLabel = curIsland + ". " + PreprocessText(Locations[FindLocation(PChar.location)].id.label);
       Preprocessor_Remove("town_name");
       Preprocessor_Remove("island_name");
// rewritten by MAXIMUS 09.10.2006 [for correct location name showing]<-- // <-- KK
     }
   }
   else
   {
     locLabel = TranslateString("", "Open Sea");
   }
Sin título.jpg Sin título1.jpg
 
I have a vague memory of getting quite confused with the save/load texts myself at some point.
If I recall correctly, those strings are saved INSIDE the savegame so by the time you're loading, it is already "too late".
So the place to correct it is in the place where the save is created, which is in a different file somewhere.
If you're really lucky, it is hiding in PROGRAM\INTERFACE\interface.c, but I wouldn't count on my memory being quite that good. :unsure
 
There's this in interface.c
Code:
// KK -->
string CreateLocDescribe()
{
   ref pchar = GetMainCharacter();
   string storyline = GetStoryline(FindCurrentStoryline()); // KK

   string locLabel = pchar.location;
   int locidx = FindLocation(pchar.location);
   if (IsEntity(&worldMap)) {
     locLabel = TranslateString("", "Open Sea");
   } else {
     if (locidx >= 0) {
       int islandidx = locidx;
       bool bOnDeck = ownDeckStarted();
       if (CheckAttribute(&Locations[locidx], "id.label")) {
         Preprocessor_Add("island_name", GetIslandNameByLocationID(Locations[locidx].id));
         if (!CheckAttribute(&Locations[locidx], "townsack")) {
           if (bOnDeck) {
             if (CheckAttribute(pchar, "location.from_sea")) islandidx = FindLocation(pchar.location.from_sea);
             if (CheckAttribute(&Locations[islandidx], "townsack"))
               Preprocessor_Add("town_name", FindTownName(Locations[islandidx].townsack));
             else
               Preprocessor_Add("town_name", "");
           } else {
             locLabel = TranslateString("", "Open Sea");
           }
         } else {
           Preprocessor_Add("town_name", FindTownName(Locations[locidx].townsack));
         }
         locLabel = GetIslandNameByLocationID(Locations[islandidx].id) + ". " + Locations[locidx].id.label;
         if (bOnDeck) locLabel += " " + TranslateString("", "on ship in") + " " + Locations[islandidx].id.label;
         locLabel = PreprocessText(locLabel);
         Preprocessor_Remove("town_name");
         Preprocessor_Remove("island_name");
       } else {
         locLabel = TranslateString("", "Open Sea");
       }
     } else {
       if (bSeaActive) {
         if (pchar.location == "") locLabel = TranslateString("", "Open Sea");
         if (FindIsland(pchar.location) >= 0) {
           Preprocessor_Add("island_name", FindIslandName(pchar.location));
           locLabel = PreprocessText(TranslateString("", "#sisland_name# Waters"));
           Preprocessor_Remove("island_name");
         }
       } else {
         locLabel = "Unknown location";
       }
     }
   }
   return locLabel;
}
But, while there are mentions to " Open sea" which can use the translation code and work, there's no mention to "Ship deck" or "Captain's cabin", or any of the other missing bits, and while the words "captain's cabin" and "port" are all over the files and could be redirected from somewhere else, there's not one single mention to "Ship deck" in all the files that my index can find, except the one in interface_strings, but not a trace of the original string.

By the way, the storyline name at the bottom of the save/load menu appears sometimes in English and sometimes in Spanish. As far as I can tell, it's in English when you access the menu for the first time after booting the game, nad it's in Spanish if you access the menu again while playing, after having started or loaded a game. But I'm willing to let that one slide.
 
Last edited:
That's it, thanks. Now, I have to go through all those and add the translation for each location id. Luckily, they're already in the interface_string files, there's only the TranslateStrings missing in the init files.
 
They're translated on the fast travel icons, can't really think of any other place where those labels show up. But the fast travel icons still work the same after adding the TranslateString and so does the save/load screen, so there seems to be no problem at all. What do you mean with the reloads?
 
Yes, same as the fast travel icons
So they were translated correctly before you changed anything and are still working afterwards?
I've got to admit, that does surprise me! But I suppose.... if it works, shouldn't complain about it. ;)
 
Hello again... First of all, I apologize for not being active this last month... I had to study a lot in order to pass all my exams on September, and that took me a lot of time. Then after finishing it, I decided to take a mini-break to relax after finishing my exams. Sadly I didn't do too much after all, but here I have some files translated which I think you will find it useful @Homo eructus. Not a lot, but It's something. From tomorrow, I will continue translating again more of these files, but don't expect me to continue with this in the future. My last year of college is coming, and I want to finish it well. I hope you understand me :) If I can't continue with it, I will post a message about it.
 

Attachments

  • Files translated to spanish (ENGLISH-Programs-Dialogs).zip
    30 KB · Views: 69
Is there a way to force nation relation changes through console or cheats? I have to test the correspondent log entries and I rather not sit for an hour waiting for the nations to make wars and alliances with each other. Also, how do those news get added to the log? Speaking with the tavernkeepers like the town events? or speaking with the gobernors?
 
Back
Top