• 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

Oh, bugger. Those texts are only for the Free Play "storylines". The descriptions for the main storylines appear to be only in each storyline files, for example WooodesRogers.c , etc. The plot thickens. I guess that could also be relayed to the INI folder but I'll be damned if I know how. There is a line that says " switch (LanguageGetLanguage())" just before so I assume that has something to do with it...

Code:
   switch (LanguageGetLanguage())
   {
     // default:
       sl.(sn).title = "Woodes Rogers";
       sl.(sn).description = "In 1717 Rogers was appointed Royal Governor of the Bahamas where he helped suppress piracy in the Caribbean by offering caught pirates pardons. Many notorious pirates accepted this while others were hunted down and killed. The Golden Age of Piracy is about to end and Woodes Rogers, now retired, is living in Port Royale. The rumour has it that he is looking for adventurers. There is only one small problem with your crew...";
   }

In other news, I was trying to test ingame what I have so far but the Languages selection in the options menu seems to be stuck in English. The Keyboard Layout selection cycles through the options just fine. Languages.ini seems to be in order. Is there something somewhere else that has to be enabled? I could swear that I did a test some months ago with the earlier version of the mod, and had to tweak something to make it work, (sort of, the Start Game screen always resetted the whole game to English) but I don't remember what.
 
Oh, bugger. Those texts are only for the Free Play "storylines". The descriptions for the main storylines appear to be only in each storyline files, for example WooodesRogers.c , etc. The plot thickens. I guess that could also be relayed to the INI folder but I'll be damned if I know how. There is a line that says " switch (LanguageGetLanguage())" just before so I assume that has something to do with it...
You can do that particular translation within that file itself. I think the Standard storyline has an example for translating it into Polish.

In other news, I was trying to test ingame what I have so far but the Languages selection in the options menu seems to be stuck in English. The Keyboard Layout selection cycles through the options just fine. Languages.ini seems to be in order. Is there something somewhere else that has to be enabled? I could swear that I did a test some months ago with the earlier version of the mod, and had to tweak something to make it work, (sort of, the Start Game screen always resetted the whole game to English) but I don't remember what.
I haven't tried that selector in over 5 years, so don't remember at all....
 
You can do that particular translation within that file itself. I think the Standard storyline has an example for translating it into Polish.
Excellent, that's much easier. Thanks for the tip!

I haven't tried that selector in over 5 years, so don't remember at all....

Looking around I stumbled upon this in option_screen.c:
Code:
// KK -->
   LanguageQty = 1;
   if (FindLocalLanguage("russian")) LanguageQty++;
   if (FindLocalLanguage("french")) LanguageQty++;
   if (FindLocalLanguage("german")) LanguageQty++;
   if (FindLocalLanguage("spanish")) LanguageQty++;
   if (FindLocalLanguage("polish")) LanguageQty++;
// <-- KK

I changed LanguageQty from 1 to 6 to see if that's what was locking the options to English only. Something did change, now I can select English or Polish but nothing else (and trying Polish causes the game to crash). I guess someone who was working on a Polish translation did something to unlock the option while the other have remained locked but I can't find where, I think the answer has to be somewhere in option_screens but from what I can tell all the languages follow the same patterns, there not seem to be a reason why English and Polish behave differently.

I think the key can be in these bits:
Code:
  /*case "B_ENGLISH":
     if(comName=="activate" || comName=="click")
     {
// KK -->
       LanguageSetLanguage("English");
       SetInterfaceLanguage(ILANG_ENG);
       SetKeyboardLayout(ILANG_ENG);
// <-- KK
       AdditionalHide();
       SetSelectable("B_ENGLISH",false);
       if(GetSelectable("B_FRENCH")) SetCurrentNode("B_FRENCH");
       else
       {
         if(GetSelectable("B_GERMAN")) SetCurrentNode("B_GERMAN");
         else
         {
           if(GetSelectable("B_SPANISH")) SetCurrentNode("B_SPANISH");
           else
           {
               if(GetSelectable("B_POLISH")) SetCurrentNode("B_POLISH");
               else
               {
                 if(GetSelectable("B_RUSSIAN")) SetCurrentNode("B_RUSSIAN");
                 else SetCurrentNode("LANGUAGETITLE");
               }
           }
         }
       }
       InitLocalization();
       SetFormatedText("REINITLANGUAGE",XI_ConvertString("Reinit_Language"));//MAXIMUS
       SetNewLanguageView();//MAXIMUS
     }
   break;

   case "B_RUSSIAN":
     if(comName=="activate" || comName=="click")
     {
       LanguageSetLanguage("Russian");
       SetInterfaceLanguage(ILANG_RUS);
       SetKeyboardLayout(ILANG_RUS);
       AdditionalHide();
       SetSelectable("B_RUSSIAN",false);
       if(GetSelectable("B_FRENCH")) SetCurrentNode("B_FRENCH");
       else
       {
         if(GetSelectable("B_GERMAN")) SetCurrentNode("B_GERMAN");
         else
         {
           if(GetSelectable("B_SPANISH")) SetCurrentNode("B_SPANISH");
           else
           {
               if(GetSelectable("B_POLISH")) SetCurrentNode("B_POLISH"); // KK
               else
               {
                 if(GetSelectable("B_ENGLISH")) SetCurrentNode("B_ENGLISH"); // KK
                 else SetCurrentNode("LANGUAGETITLE");
               }
           }
         }
       }
       InitLocalization();
       SetFormatedText("REINITLANGUAGE",XI_ConvertString("Reinit_Language"));//MAXIMUS
       SetNewLanguageView();//MAXIMUS
     }
   break;

   case "B_FRENCH":
     if(comName=="activate" || comName=="click")
     {
       LanguageSetLanguage("French");
       SetInterfaceLanguage(ILANG_FRA);
       SetKeyboardLayout(ILANG_FRA);
       AdditionalHide();
       SetSelectable("B_FRENCH",false);
       if(GetSelectable("B_GERMAN")) SetCurrentNode("B_GERMAN");
       else
       {
         if(GetSelectable("B_SPANISH")) SetCurrentNode("B_SPANISH");
         else
         {
           if(GetSelectable("B_POLISH")) SetCurrentNode("B_POLISH"); // KK
           else
           {
             if(GetSelectable("B_ENGLISH")) SetCurrentNode("B_ENGLISH"); // KK
             else
             {
               if(GetSelectable("B_RUSSIAN")) SetCurrentNode("B_RUSSIAN");
               else SetCurrentNode("LANGUAGETITLE");
             }
           }
         }
       }
       InitLocalization();
       SetFormatedText("REINITLANGUAGE",XI_ConvertString("Reinit_Language"));//MAXIMUS
       SetNewLanguageView();//MAXIMUS
     }
   break;

   case "B_GERMAN":
     if(comName=="activate" || comName=="click")
     {
       LanguageSetLanguage("German");
       SetInterfaceLanguage(ILANG_GER);
       SetKeyboardLayout(ILANG_GER);
       AdditionalHide();
       SetSelectable("B_GERMAN",false);
       if(GetSelectable("B_SPANISH")) SetCurrentNode("B_SPANISH");
       else
       {
         if(GetSelectable("B_POLISH")) SetCurrentNode("B_POLISH"); // KK
         else
         {
           if(GetSelectable("B_ENGLISH")) SetCurrentNode("B_ENGLISH"); // KK
           else
           {
             if(GetSelectable("B_RUSSIAN")) SetCurrentNode("B_RUSSIAN");
             else
             {
               if(GetSelectable("B_FRENCH")) SetCurrentNode("B_FRENCH");
               else SetCurrentNode("LANGUAGETITLE");
             }
           }
         }
       }
       InitLocalization();
       SetFormatedText("REINITLANGUAGE",XI_ConvertString("Reinit_Language"));//MAXIMUS
       SetNewLanguageView();//MAXIMUS
     }
   break;

   case "B_SPANISH":
     if(comName=="activate" || comName=="click")
     {
       LanguageSetLanguage("Spanish"); // KK
       SetInterfaceLanguage(ILANG_SPA);
       SetKeyboardLayout(ILANG_SPA);
       AdditionalHide();
       SetSelectable("B_SPANISH",false);
       if(GetSelectable("B_POLISH")) SetCurrentNode("B_POLISH"); // KK
       else {
         if(GetSelectable("B_ENGLISH")) SetCurrentNode("B_ENGLISH"); // KK
         else
         {
           if(GetSelectable("B_RUSSIAN")) SetCurrentNode("B_RUSSIAN");
           else
           {
             if(GetSelectable("B_FRENCH")) SetCurrentNode("B_FRENCH");
             else
             {
               if(GetSelectable("B_GERMAN")) SetCurrentNode("B_GERMAN");
               else SetCurrentNode("LANGUAGETITLE");
             }
           }
         }
       }
       InitLocalization();
       SetFormatedText("REINITLANGUAGE",XI_ConvertString("Reinit_Language"));//MAXIMUS
       SetNewLanguageView();//MAXIMUS
     }
   break;

// KK -->
   case "B_POLISH":
     if(comName=="activate" || comName=="click")
     {
       LanguageSetLanguage("Polish");
       SetInterfaceLanguage(ILANG_POL);
       SetKeyboardLayout(ILANG_POL);
       AdditionalHide();
       SetSelectable("B_POLISH",false);
       if(GetSelectable("B_SPANISH")) SetCurrentNode("B_SPANISH");
       else {
         if(GetSelectable("B_ENGLISH")) SetCurrentNode("B_ENGLISH");
         else
         {
           if(GetSelectable("B_RUSSIAN")) SetCurrentNode("B_RUSSIAN");
           else
           {
             if(GetSelectable("B_FRENCH")) SetCurrentNode("B_FRENCH");
             else
             {
               if(GetSelectable("B_GERMAN")) SetCurrentNode("B_GERMAN");
               else SetCurrentNode("LANGUAGETITLE");
             }
           }
         }
       }
       InitLocalization();
       SetFormatedText("REINITLANGUAGE",XI_ConvertString("Reinit_Language"));//MAXIMUS
       SetNewLanguageView();//MAXIMUS
     }
   break;*/
   case "B_SELECTLANGUAGE":
     LanguageSetLanguage(GetInterfaceLanguageName(iSelectedInterfaceLanguage));
     SetInterfaceLanguage(iSelectedInterfaceLanguage);
     SetKeyboardLayout(iSelectedKeyboardLayout);
     AdditionalShow();
   break;

   case "B_CANCELLANGUAGE":
     iSelectedInterfaceLanguage = GetInterfaceLanguage();
     iSelectedKeyboardLayout = GetKeyboardLayout();
     AdditionalShow();
   break;
// <-- KK

Code:
  case "B_LANGUAGES":
     if(comName=="activate" || comName=="click")
     {
       AdditionalHide();
// KK -->
       /*SetSelectable("B_" + GetInterfaceLanguageName(GetInterfaceLanguage()), false);
       if(!bInterfaceRus && !bInterfaceFra && !bInterfaceGer && !bInterfaceSpa && !bInterfacePol) SetSelectable("B_ENGLISH", false); // KK
       if(bInterfaceRus) SetSelectable("B_RUSSIAN",false);
       if(bInterfaceFra) SetSelectable("B_FRENCH",false);
       if(bInterfaceGer) SetSelectable("B_GERMAN",false);
       if(bInterfaceSpa) SetSelectable("B_SPANISH",false);
       if(bInterfacePol) SetSelectable("B_POLISH",false); // KK
       if(GetSelectable("B_ENGLISH")) SetCurrentNode("B_ENGLISH"); // KK
       else
       {
         if(GetSelectable("B_RUSSIAN")) SetCurrentNode("B_RUSSIAN");
         else
         {
           if(GetSelectable("B_FRENCH")) SetCurrentNode("B_FRENCH");
           else
           {
             if(GetSelectable("B_GERMAN")) SetCurrentNode("B_GERMAN");
             else
             {
               if(GetSelectable("B_SPANISH")) SetCurrentNode("B_SPANISH");
               else
               {
                 if(GetSelectable("B_POLISH")) SetCurrentNode("B_POLISH"); // KK
                 else SetCurrentNode("LANGUAGETITLE");
               }
             }
           }
         }
       }*/
     }
   break;
Or I could be wrong enterily. This is mostly gibberish to me.
 
I could upload some Alpha 9 translation files. That is the last time anyone did anything with that.
 
I think I have them already. But they're all sounds, texts and dialogs I think.
From what I remember, if you installed that archive on Build 14 Alpha 9, immediately all language options would become unlocked.
So whatever is in the archive used to be enough to do the trick. At some point in the very grey and distant past....
 
Well, it does unlock some language options, but only French, Russian, Polish, and an extra English (so there's 2 now, but they seem the same). But the only files that have been added seem to be just sounds, texts and dialogs, which makes it even more strange.
 
This is the condition for a Local Language appearing:
Code:
bool FindLocalLanguage(string lang)
{
   string dir = "RESOURCE\INI\TEXTS\" + lang;
   if (FindFile(dir, "*.ini", "common.ini") == "") return false;
   if (CheckDirectory(dir, "*.txt") < 15) return false;
   if (FindFile(dir + "\QUESTBOOK", "*.txt", "quests_texts.txt") == "") return false;
   return true;
}

I think that translates as:
- There must be a RESOURCE\INI\TEXTS\*LANGUAGE*\common.ini file
- There must be less than 15 .txt files in that folder (Uh, WHY???)
- There must be a RESOURCE\INI\TEXTS\*LANGUAGE*\QUESTBOOK\quests_texts.txt file (Again, WHY? Even ENGLISH doesn't have that!)

So you may need to tweak that section of code in PROGRAM\MAXIMUS_functions.c to make more sense.
As it is now, it doesn't make any sense to me. :facepalm
 
In PROGRAM\INTERFACE\select_storyline.c search for idModelDescr to see how the files are linked.
You would need to do the same, but for model.storytext .

I managed to make the storytext traslation show but only in the character selection screen (and without special characters, what's with that? They show anywhere else). When you go back to the main game start screen, it's in English again.
Sin título.jpg Sin título1.jpg
(Date, Period and Flags aren't translated either, as aren't most of the menu texts for the select character screen, but let's sort one problem at a time)

And here's also my select_storyline file, if it's any help. I added a new idStoryText just below idModelDescr and added it wherever it looked like it should go. Maybe I missed some line for it to show in the main screen.
 

Attachments

  • select_storyline.c
    127.8 KB · Views: 249
There are probably more uses of that in the same file.
I can't check it until after the weekend though.

Complex characters work on some fonts, but not all.
I remember waging some serious wars on them and never did quite manage to win. :(
 
I'd appreciate if you or someone else with modding experience could take a look. All I can do is trial and error... and no luck so far.
Thanks for reminding me. Looks like this is the code responsible for setting those texts after using the Select Character interface:
Code:
if (slno == FindStoryline("FreePlay") && CheckAttribute(model, "storytext"))
{
SetFormatedText("INFO_TEXT", model.storytext);
}
else
{
SetFormatedText("INFO_TEXT", GetStorylineDescription(slno));
}
if (slno == FindStoryline("FreePlay") && CheckAttribute(model, "storytitle"))
{
GameInterface.strings.StorylineTitle = model.storytitle;
}
else
{
GameInterface.strings.StorylineTitle = GetStorylineTitle(slno);
}
So that is where you'll need to add the extra translation code.
 
Works for the texts but not for the titles. I already added an idStoryTitle and linked it to the correspondent file the same way I did with idStoryText, but apparently the attribute storytitle works slightly different from storytext. I suppose because it starts with the code "GameInterface.strings.StorylineTitle" instead of "SetFormatedText", and the structure is a bit different so the same kind of code deoesn't seem to work.

(The key to this is probably the key to translate the periods and dates aswell, as they too start with the same code).

Sorry for being so bothersome, this coding business is frustrating but weirdly fascinating in a way.
 
Should something like this not work?
Code:
GameInterface.strings.StorylineTitle = LanguageConvertString(idModelDescr, model.storytitle);
 
Wait a minute, it may be just me being an idiot, I just realized story_title.txt is not in the SPANISH folder, I must have deleted and forgot to put it in there again. :facepalm

EDIT. Well, I'm still an idiot, but stil doesn't work. The title line appears blank
Sin título.jpg

EDIT2: Now it works, I copied your code without looking at it and didn't realize you put idModelDescr instead of idStoryTitle. Fixed now (and the special characters do work in the titles)
 
Last edited:
Inexplicably the only description that doesn't show at all in any of the screens is that of Jean Baptiste du Casse, but I've checked and double checked that the text in initmodels matches the text in story_text.txt and that my initmodels itself is a perfect match with the same file in the unedited install of the mod, so screw Mr. special snowflake Jean Baptiste du Casse, I have more important things to worry about.

Like the dates and periods. They have strings in common.ini that I already translated but don't show translated in the start screen. Should I create new files for them and do the same that with the story texts and titles or can I in any way relay those strings in select_storyline.c back to common.ini? I guess that would be neater and avoid redundance, which is always better.
 
Like the dates and periods. They have strings in common.ini that I already translated but don't show translated in the start screen. Should I create new files for them and do the same that with the story texts and titles or can I in any way relay those strings in select_storyline.c back to common.ini? I guess that would be neater and avoid redundance, which is always better.
Wherever they're used, put XI_ConvertString around it.
That should make it translate through common.ini .
 
I've had to edit periods.c and calendar.c to get the names of the specific periods and months showing correctly and add several strings to common.ini to fully translate the character and ship selection menus. Everything's going swimmingly.:onya

Well, except the title of the nation selection, which shows only as "N" for some baffling reason. Like Du Casse, only a minor annoyance.
Sin título.jpg
 
Back
Top