• 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

Not knowing which files you have in mind, I don't know. Make backup copies of any files you change, then try it. If it works, upload the files. If it doesn't, put the backups back in place.
From what I've seen, log entries are spread far and wide everywhere from dialogue files to AIShip.c and many others.
 
On a first try (I only did the title), it seems to work for dialogue files
1681762338166.png


Edit: uh, weird, title is fine but out of all the parts that comprise the main text only the "of" is being trnaslated. And I've used the exact same function
if (PChar.sex == "man") WriteNewLogEntry(GetTranslatedLog("Married my beautiful wife"), GetTranslatedLog("On this wonderful day I married my beautiful wife,")+" "+GetMySimpleName(NPChar)+", "+XI_ConvertString(NPChar.relationtype)+" "+GetTranslatedLog("of")+" "+GetMySimpleName(Characters[ix])+GetTranslatedLog(", the governor of")+" "+FindTownName(GetCurrentTownID())+GetTranslatedLog(". I won her heart with my wit and charm, and last but not least with my swordmanship, as I had to defeat her jealous suitor, before she could agree to a marriage. We're both very happy, and now I am going to finish this writing, because I have something more important to do ..."),"Personal",true);

The parts in bold are the ones that work. I added the " " independently bacause I remember from other files that the string is not translated if it ends or begins with a space. Commas and periods don't make any difference (I tried removing the comma after "beautiful wife" and still wouldn't work).

Ah, I see. It's taking the "of" from interface_strings, so it's ignoring the entries in shipslogs_strings, except for the titles.

Well, some titles apparently, in the next entrry (the female player marriage), not even the title works.:shrug
 
Last edited:
A correction is needed in "RESOUCE\INI\TEXTS\Spanish\Storyline\DevlinOpera\storyline_strings.txt". At present it translates from this:
Code:
A quest that leads you to find long lost family members, and a vast treasure... that is, if you can survive! Along the way you will encounter a band of rather colourful characters who will help you on your journey. You will get the choice whose help you want, each character offering a different style in achieving your goal.
But in "PROGRAM\Storyline\DevlinOpera.c", the line is now:
Code:
A quest that leads you to find long lost family members, and a vast treasure... that is, if you can survive! Along your way through the vastness of the new world, you will encounter various rather colourful characters and adventures that put the wide spectrum of your skills to the test.
If they don't match then the line will not be translated and you'll see the story description in English.
 
A correction is needed in "RESOUCE\INI\TEXTS\Spanish\Storyline\DevlinOpera\storyline_strings.txt". At present it translates from this:
Code:
A quest that leads you to find long lost family members, and a vast treasure... that is, if you can survive! Along the way you will encounter a band of rather colourful characters who will help you on your journey. You will get the choice whose help you want, each character offering a different style in achieving your goal.
But in "PROGRAM\Storyline\DevlinOpera.c", the line is now:
Code:
A quest that leads you to find long lost family members, and a vast treasure... that is, if you can survive! Along your way through the vastness of the new world, you will encounter various rather colourful characters and adventures that put the wide spectrum of your skills to the test.
If they don't match then the line will not be translated and you'll see the story description in English.
Done. My English storyline_strings.txt had the same problem so I fixed and added it too just in case, along with some more dialogs and extra stuff (the Min/Max crew string from the transfer/ransack menu).

Any input on the problem with log entries? At worst, I guess I could do what I did before and add all the log entries to interface-strings, but it would bloat even more an already huge file and it'd be a shame to waste the specific file made for log entries.
 

Attachments

  • dialogs and more.zip
    122.4 KB · Views: 66
Last edited:
I haven't had time to try anything with marriage-related log entries. Do you have a savegame where you're in a position to propose but have not yet actually done it? That would save me a lot of time in investigating what is happening.
 
Yep. The one from August is with a male character and the one from July is female (although they're actually from the same game, I just changed the character's clothes and created a savepoint before the nephew/niece spawned and then did all the progress with both versions of the character, in case that matters)
 

Attachments

  • FreePlay.zip
    1.6 MB · Views: 73
12 more dialog files revised from the general DIALOGS folder. 227 to go

I think I'll do the standard storyline dialogs next, I think most of those files are still in English and it's probably the first thing most player play, so I should have done it first
 

Attachments

  • SPANISH.zip
    14 KB · Views: 60
Yep. The one from August is with a male character and the one from July is female (although they're actually from the same game, I just changed the character's clothes and created a savepoint before the nephew/niece spawned and then did all the progress with both versions of the character, in case that matters)
Thanks - that helped a lot!

The main problem is that the log text is assembled from various component phrases and function calls. One solution would be to have a separate entry in "shipslog_strings.txt" for each phrase, though extra " " spaces would need to be added to the 'WriteNewLogEntry' line because they won't work in "shipslog_strings.txt", and the finished sentence would still be in correct grammatical order for English but not necessarily other languages.

I tried replacing it with a single sentence using preprocessed variables, and at first it refused to process them - it didn't show blanks the way it usually does when a preprocessed variable hasn't worked, it showed the actual labels. Then I found a function 'PreprocessText' which does the actual processing, added that to the line, and it worked.

The attached zip contains a new version of "Gov MR_dialog.c" which sets up a lot of preprocessed variables including some to account for male or female characters, translates title and text to use them, and then uses 'PreProcessText' in the 'WriteNewLogEntry' line. There's a lot of nonsense at the end of "shipslog_strings.txt" because I can't write Spanish, so I just put some rubbish there to show that the translation is working. Replace the nonsense with proper Spanish translations and you should get a proper Spanish logbook entry for the wedding.

And also for promotions. I've done the same for the logbook entry in "PROGRAM\Characters\CharacterUtilite.c", function 'Promote' - turned an assembled sentence into a single sentence with preprocessed variables and put some nonsense at the end of "shipslog_strings.txt" to show that it's being translated.
 

Attachments

  • Marriage.zip
    54 KB · Views: 58
One solution would be to have a separate entry in "shipslog_strings.txt" for each phrase, though extra " " spaces would need to be added to the 'WriteNewLogEntry' line because they won't work in "shipslog_strings.txt", and the finished sentence would still be in correct grammatical order for English but not necessarily other languages
Yep, that's what I was trying to do, the grammatical order can be worked around for the most part (as with the governor ship hunt quests) but I couldn't make it to work
 
The other advantage of this method is that it's easier to read, and easier to edit if you want to change any of the components.

Old version for marriage:
Code:
            if (PChar.sex == "man") WriteNewLogEntry("Married my beautiful wife", "On this wonderful day I married my beautiful wife, "+GetMySimpleName(NPChar)+", "+XI_ConvertString(NPChar.relationtype)+" of "+GetMySimpleName(Characters[ix])+", the governor of "+FindTownName(GetCurrentTownID())+". I won her heart with my wit and charm, and last but not least with my swordmanship, as I had to defeat her jealous suitor, before she could agree to a marriage. We're both very happy, and now I am going to finish this writing, because I have something more important to do ...","Personal",true);
            else WriteNewLogEntry("Married my handsome husband", "On this wonderful day I married my handsome husband, "+GetMySimpleName(NPChar)+", "+XI_ConvertString(NPChar.relationtype)+" of "+GetMySimpleName(Characters[ix])+", the governor of "+FindTownName(GetCurrentTownID())+". I won his heart with my wit and charm, and last but not least with my swordmanship, as I had to defeat his jealous suitor, before he could agree to a marriage. We're both very happy, and now I am going to finish this writing, because I have something more important to do ...","Personal",true);

New version:
Code:
            switch(GetAttribute(PChar, "sex"))
            {
                case "man": Preprocessor_Add("spouse", GetTranslatedLog("my beautiful wife")); break;
                case "woman": Preprocessor_Add("spouse", GetTranslatedLog("my handsome husband")); break;
                // neither "man" nor "woman" - the line below should never be seen, if it is then I want to know why! - GR
                Preprocessor_Add("spouse", GetTranslatedLog("my pet human"));
            }
            Preprocessor_Add("pronoun1", XI_ConvertString(GetMyPronounSubj(NPChar)));
            Preprocessor_Add("pronoun3", XI_ConvertString(GetMyPronounPossessive(NPChar)));
            Preprocessor_Add("name", GetMySimpleName(NPChar));
            Preprocessor_Add("relation", XI_ConvertString(NPChar.relationtype));
            Preprocessor_Add("governor", GetMySimpleName(Characters[ix]));
            Preprocessor_Add("town", FindTownName(GetCurrentTownID()));

            title = GetTranslatedLog("Married #sspouse#"));
            text = GetTranslatedLog("On this wonderful day I married #sspouse#, #sname#, #srelation# of #sgovernor#, the governor of #stown#. I won #spronoun3# heart with my wit and charm, and last but not least with my swordmanship, as I had to defeat #spronoun3# jealous suitor, before #spronoun1# could agree to a marriage. We're both very happy, and now I am going to finish this writing, because I have something more important to do ...");
            WriteNewLogEntry(PreprocessText(title), PreprocessText(text),"Personal",true);
It's longer but you can see clearly how things are being set up. Then you can translate the whole sentence however you see fit without having to do dirty tricks such as move the translation of half of one sentence fragment into another fragment to make it fit grammatically. You only need to translate it once, not separately for male and female characters. (Though that might be necessary anyway if pronouns cause trouble...)

Incidentally, in "common.ini":
Code:
string = his,"su"
string = hers,"su"
string = his1, "su"
string = her1, "su"
Is that correct? The distinction is that "his" is for situations such as "That ship is his", whereas "his1" is for something like "That is his ship".
 
Code:
Incidentally, in "common.ini":[code]
string = his,"su"
string = hers,"su"
string = his1, "su"
string = her1, "su"
Is that correct? The distinction is that "his" is for situations such as "That ship is his", whereas "his1" is for something like "That is his ship".
Hm, the first "his" could be either "suyo" or "suya" dependeing on the gender of the object (because all nouns, even inanimate objects are gendered in Spanish and Spanish possesives agree in gender and number with the object being possessed rather than the subject doing the possessing).
This ship is his > Este barco es suyo
This sword is his > Esta espada es suya

Now that I think of it, "his" could be replaced by "de él" and "her" by "de ella". Depending of context, it can sound a bit contrived but it's correct.

Similarly with
Code:
string = himself,"el mismísimo"
string = herself,"la mismísima"
The words can have several translation depending on the usage and position in the phrase. "mismísimo/a" is probably not the best choice as it only accounts for one possible option (something along the lines of "If it isn't Grey Roger himself!"), it probably should be "él mismo/ella misma" and the appropriate prepositions, not always necessary in English, be added to the sorrounding text depending on context (a él mismo, para él mismo...). Still, it won't work for all possible uses but in that case, the preprocessor can be disregarded in the translation and replaced with different neutral phrasing.
 
Last edited:
Thanks - that helped a lot!

The main problem is that the log text is assembled from various component phrases and function calls. One solution would be to have a separate entry in "shipslog_strings.txt" for each phrase, though extra " " spaces would need to be added to the 'WriteNewLogEntry' line because they won't work in "shipslog_strings.txt", and the finished sentence would still be in correct grammatical order for English but not necessarily other languages.

I tried replacing it with a single sentence using preprocessed variables, and at first it refused to process them - it didn't show blanks the way it usually does when a preprocessed variable hasn't worked, it showed the actual labels. Then I found a function 'PreprocessText' which does the actual processing, added that to the line, and it worked.

The attached zip contains a new version of "Gov MR_dialog.c" which sets up a lot of preprocessed variables including some to account for male or female characters, translates title and text to use them, and then uses 'PreProcessText' in the 'WriteNewLogEntry' line. There's a lot of nonsense at the end of "shipslog_strings.txt" because I can't write Spanish, so I just put some rubbish there to show that the translation is working. Replace the nonsense with proper Spanish translations and you should get a proper Spanish logbook entry for the wedding.

And also for promotions. I've done the same for the logbook entry in "PROGRAM\Characters\CharacterUtilite.c", function 'Promote' - turned an assembled sentence into a single sentence with preprocessed variables and put some nonsense at the end of "shipslog_strings.txt" to show that it's being translated.
Works flawlessly :cool:

I only added XI_ConvertString to the nationdesc and nationname strings in the promotion entries in CharacterUtilite.c because they weren't being translated

Code:
    Preprocessor_Add("nationdesc", XI_ConvertString(GetNationDescByType(iNation)));
    Preprocessor_Add("nationname", XI_ConvertString(GetNationNameByType(iNation)));
 
I'm not sure how to do it in this entry. I understand the if function (if you leave in bad terms, that line gets added) but I don't know how to accommodate the new method around it. The promotion entry also has an if function for landed titles, but in that case it goes the other way round, the function goes if(nolandgiven) to end the entry or else to continue with the extra string. In this case, to replicate the same syntax, it should be something akin to if(leavegood) insterad of if (leavebad), so I don't know how to apply the changes.
Code:
    // Lost LoM
    string sLogTitle = "Left Service of " + GetNationNameByType(iNation);
    string sLogEntry = "This marks the end of my service for " + GetNationNameByType(iNation) + ". But at least I am free now to pursue other goals.";
    if(leavebad)
    {
        sLogEntry += " My leaving was on rather bad terms and left me with decidedly less friends than I had.";
        SetServedNation(PIRATE); // PB
    }
    WriteNewLogEntry(sLogTitle,sLogEntry, "Personal", true);
    LooseLetterOfMarque(iNation);

My incomplete attempt so far
Code:
    // Lost LoM
    string title, text;
           
    Preprocessor_Add("nationname", XI_ConvertString(GetNationNameByType(iNation)));
    title = GetTranslatedLog("Left Service of #snationname#");
    text = GetTranslatedLog("This marks the end of my service for #snationname#. But at least I am free now to pursue other goals.");
    if(leavebad)
    {
        text = text + " " + GetTranslatedLog("My leaving was on rather bad terms and left me with decidedly less friends than I had.");
        SetServedNation(PIRATE); // PB
    }
    WriteNewLogEntry(sLogTitle,sLogEntry, "Personal", true);
    LooseLetterOfMarque(iNation);
 
Hm, the first "his" could be either "suyo" or "suya" dependeing on the gender of the object (because all nouns, even inanimate objects are gendered in Spanish and Spanish possesives agree in gender and number with the object being possessed rather than the subject doing the possessing).
This ship is his > Este barco es suyo
This sword is his > Esta espada es suya

Now that I think of it, "his" could be replaced by "de él" and "her" by "de ella". Depending of context, it can sound a bit contrived but it's correct.
I've been doing a bit of digging and as far as I can see, this isn't all that critical because "his" and "hers" can appear one of two ways:
. From function 'GetMyPronounPoss', defined in "PROGRAM\Dialog_func.c".
. By direct translation, 'XI_ConvertString("his")'.

I can't find any use of 'GetMyPronounPoss' anywhere. The only places I can find direct translations are my own failed first attempt at translatable possessive pronouns:
Code:
            if (PChar.sex == "man") Preprocessor_AddQuestData("pronoun3", XI_ConvertString("her"));
            else Preprocessor_AddQuestData("pronoun3", XI_ConvertString("his"));
That won't work, of course. "her" will translate to the objective pronoun ("do something to her"), while "his" translates to "that thing is his"; neither will translate to the correct pronoun in any language in which possessive "her" differs from objective "her", and "his thing" differs from "the thing is his", which is probably any language except English! In some cases I've commented them out and replaced them with a call on function 'GetMyPronounPossessive', which I wrote to try to do the job properly and which is responsible for the "his1" and "her1" entries. But that still won't work in Spanish because, as you say, Spanish possessive pronouns depend on the entity being possessed, not the entity doing the possessing. (I remember seeing a piece of text, either in a dialog or a questbook, not sure which, but it included "his husband". This wasn't a gay couple. The author wasn't a native English speaker, his own language does the same as Spanish, so he'd applied his language's rule to the text.)

I might try adding a new argument to 'GetMyPronounPossessive' to tell it the gender of the possessed entity. This still won't be perfect because languages such as Spanish which apply gender to inanimate objects might not all use the same gender for the same object, but at least it will allow the correct pronoun when the possessed entity is a person.
 
I'm not sure how to do it in this entry. I understand the if function (if you leave in bad terms, that line gets added) but I don't know how to accommodate the new method around it. The promotion entry also has an if function for landed titles, but in that case it goes the other way round, the function goes if(nolandgiven) to end the entry or else to continue with the extra string. In this case, to replicate the same syntax, it should be something akin to if(leavegood) insterad of if (leavebad), so I don't know how to apply the changes.
Code:
    // Lost LoM
    string sLogTitle = "Left Service of " + GetNationNameByType(iNation);
    string sLogEntry = "This marks the end of my service for " + GetNationNameByType(iNation) + ". But at least I am free now to pursue other goals.";
    if(leavebad)
    {
        sLogEntry += " My leaving was on rather bad terms and left me with decidedly less friends than I had.";
        SetServedNation(PIRATE); // PB
    }
    WriteNewLogEntry(sLogTitle,sLogEntry, "Personal", true);
    LooseLetterOfMarque(iNation);

My incomplete attempt so far
Code:
    // Lost LoM
    string title, text;
          
    Preprocessor_Add("nationname", XI_ConvertString(GetNationNameByType(iNation)));
    title = GetTranslatedLog("Left Service of #snationname#");
    text = GetTranslatedLog("This marks the end of my service for #snationname#. But at least I am free now to pursue other goals.");
    if(leavebad)
    {
        text = text + " " + GetTranslatedLog("My leaving was on rather bad terms and left me with decidedly less friends than I had.");
        SetServedNation(PIRATE); // PB
    }
    WriteNewLogEntry(sLogTitle,sLogEntry, "Personal", true);
    LooseLetterOfMarque(iNation);
That should do it. Don't change the logic, it doesn't need to match the code for promotion. (Which I may rewrite some time anyway because the line doing the actual log writing is now the same whether or not you get land, so that can be taken out of the condition, leaving the part where you don't get land empty. So I'll want to reverse the condition to check that you do get land, and if so, give the land and add the extra text.)

As for your code, the only thing I can see wrong is this line:
Code:
WriteNewLogEntry(sLogTitle,sLogEntry, "Personal", true);
You're now using variables 'title' and 'text, not 'sLogTitle' and 'sLogEntry'. And you need to use 'PreprocessText' otherwise you'll see "#snationname#", not the nation's name. So:
Code:
    WriteNewLogEntry(PreprocessText(title), PreprocessText(text), "Personal", true);

(There was no need to change the variable names, you could have kept 'sLogTitle' and 'sLogEntry' - but since you've done it, there's also no need to change them back again!)
 
Here's ChracterUtilite.c with all the log entries added to the Spanish shipslogstrings (I didn't add them to the English version, which I probably should have for the sake of other translations). Also I added the string "women like you" to common.ini, it's from Danielle's dialog and it wasn't in there, and a couple of small fixes to dialogs.

I've finished Danielle's dialog file but I'll pack it together with others from the same storyline when I get around to them, because now I'm determined to hunt down and translate as many log entries as I can.
 

Attachments

  • promotions.zip
    110.1 KB · Views: 69
Is there a way to force nation relation changes ingame? I'd like to test the log entries for nations making peace and declaring war. But you don't see them very often.

Also I was trying to get myself branded a pirate to test that entry, but try as I may, it didn't happen. I must have attacked a dozen ships under friendly flag and even ransacked San Juan, but even after becoming Terror of the Seas, I didn't offcially become a pirate.
Edit. Finally, it happenned. That one works
 
Last edited:
Here's ChracterUtilite.c with all the log entries added to the Spanish shipslogstrings (I didn't add them to the English version, which I probably should have for the sake of other translations). Also I added the string "women like you" to common.ini, it's from Danielle's dialog and it wasn't in there, and a couple of small fixes to dialogs.
Here's "CharacterUtilite.c" with a few more changes. I added one 'Preprocessor_Delete("nationname");' where it was missing, and moved another one into the same 'if' block that contains the 'Preprocessor_Add' command. Also, I changed the logic for promotion as I mentioned earlier.

Also included is "danielle_dialog.c". That line "Women like you" in "common.ini" won't do anything without a 'XI_ConvertString' at case "resque_danielle_6"!

Is there a way to force nation relation changes ingame? I'd like to test the log entries for nations making peace and declaring war. But you don't see them very often.
It should be possible in "console.c". The attached one should make peace between Britain and France. Change the nations the way you want; change the relation to your choice of "RELATION_FRIEND" (allied), "RELATION_NEUTRAL (peace but not allied) or "RELATION_ENEMY" (war); run the game and press F12. If you don't get the message on screen "Executed Console", look at "error.log" because one us made a mistake. Otherwise check the relations tab to see if the relation change has taken effect. You'll probably need to then visit a tavern and check the news to get the log entry.
 

Attachments

  • CharacterUtilite.c
    150.8 KB · Views: 60
  • danielle_dialog.c
    60.5 KB · Views: 59
  • console.c
    35.3 KB · Views: 63
Also included is "danielle_dialog.c". That line "Women like you" in "common.ini" won't do anything without a 'XI_ConvertString' at case "resque_danielle_6"!
I had that one, forgot to upload it :oops:

The "x nation turned wary of me" when you attack an ally works and it uses the same elements used in the the other nation relations entries, so the basics should be ok, but I'll check'em out
 
Back
Top