• 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

Another thing, this one seems tricky. I've come to the part in the Governor dialog when he asks you to eliminate the hostiles in his waters, and the ship description he gives you of the target doesn't make sense once translated due to the order of the strings in it ([nation] [number of guns] [ship type] "Name"). For it to make sense in Spanish it should be [ship type][nation][number of guns] "Name". I've found what looks like the root code for that dialog in dialog_func.c but my question is: is it possible to change the order in which the strings are phrased in a way that only affects the Spanish vesion while the English one remains the same?

This is the relevant text in Dialog_func.c, I believe
Code:
// MAXIMUS: can be used in any situation [used in Silehard-dialog] --> // KK -->
string GetShipDescribe(string charId, bool nation, bool nguns, bool shipname, bool accusative)
{
   ref chr, shipRef;
   int canQuantity;
   aref arShip;
   string shipType;
   string shipDescribe = "";

   chr = characterFromID(charId);
   shipRef = GetShipByType(GetCharacterShipType(chr));
   shipType = XI_ConvertString(shipRef.Sname);

   if (nation) shipDescribe += XI_ConvertString("sw_" + GetNationDescByType(sti(chr.nation))) + " ";
   if (nguns) shipDescribe += GetMaxCannonQuantity(chr) + XI_ConvertString("cannonsQuantity") + " ";
   shipDescribe += strlower(shipType);
   if (accusative) {
     switch (LanguageGetLanguage()) {
       case "Polish":
         int dl = strlen(shipDescribe);
         if (GetSymbol(shipDescribe, dl - 1) == "a") {
           string tmpstr = "";
           for (int i = 0; i < dl - 1; i++) {
             if (GetSymbol(shipDescribe, i + 1) == " ")
               tmpstr += "№";
             else
               tmpstr += strcut(shipDescribe, i, i);
           }
           tmpstr += "Ч";
           shipDescribe = tmpstr;
         }
       break;
       // default:
     }
   }
   if (shipname) shipDescribe += " " + GetMyShipNameShow(chr);

   if(HasSubStr(shipType,"0") || HasSubStr(shipType,"1") || HasSubStr(shipType,"2") || HasSubStr(shipType,"3") || HasSubStr(shipType,"4") || HasSubStr(shipType,"5") || HasSubStr(shipType,"6") || HasSubStr(shipType,"7") || HasSubStr(shipType,"8") || HasSubStr(shipType,"9"))
   {
     if(!HasSubStr(shipType," 0") && !HasSubStr(shipType," 1") && !HasSubStr(shipType," 2") && !HasSubStr(shipType," 3") && !HasSubStr(shipType," 4") && !HasSubStr(shipType," 5") && !HasSubStr(shipType," 6") && !HasSubStr(shipType," 7") && !HasSubStr(shipType," 8") && !HasSubStr(shipType," 9"))
     {
       shipDescribe = shipType;
     }
   }
   return shipDescribe;

It seems to have a language specific variant for Polish, I assume it is to allow for special characters. Could the same procedure be used to change the order of the strings in just one language?
That's indeed tricky, but what you want should indeed be possible.

I have NOT tested this, but I think in theory it might do the trick:
Code:
string GetShipDescribe(string charId, bool nation, bool nguns, bool shipname, bool accusative)
{
    ref chr, shipRef;
    int canQuantity;
    aref arShip;
    string shipType;
    string shipDescribe = "";

    chr = characterFromID(charId);
    shipRef = GetShipByType(GetCharacterShipType(chr));
    shipType = XI_ConvertString(shipRef.Sname);

    if (nation) shipDescribe += XI_ConvertString("sw_" + GetNationDescByType(sti(chr.nation))) + " ";
    if (nguns) shipDescribe += GetMaxCannonQuantity(chr) + XI_ConvertString("cannonsQuantity") + " ";
    shipDescribe += strlower(shipType);
    switch (LanguageGetLanguage()) {
        case "Polish":
            if (accusative) {
                int dl = strlen(shipDescribe);
                if (GetSymbol(shipDescribe, dl - 1) == "a") {
                    string tmpstr = "";
                    for (int i = 0; i < dl - 1; i++) {
                        if (GetSymbol(shipDescribe, i + 1) == " ")
                            tmpstr += "¹";
                        else
                            tmpstr += strcut(shipDescribe, i, i);
                    }
                    tmpstr += "×";
                    shipDescribe = tmpstr;
                }
        }
        break;
        case "Spanish":
            shipDescribe = strlower(shipType);
            if (nation) shipDescribe += XI_ConvertString("sw_" + GetNationDescByType(sti(chr.nation))) + " ";
            if (nguns) shipDescribe += GetMaxCannonQuantity(chr) + XI_ConvertString("cannonsQuantity") + " ";
        break;
        // default:
    }
    if (shipname) shipDescribe += " " + GetMyShipNameShow(chr);

    if(HasSubStr(shipType,"0") || HasSubStr(shipType,"1") || HasSubStr(shipType,"2") || HasSubStr(shipType,"3") || HasSubStr(shipType,"4") || HasSubStr(shipType,"5") || HasSubStr(shipType,"6") || HasSubStr(shipType,"7") || HasSubStr(shipType,"8") || HasSubStr(shipType,"9"))
    {
        if(!HasSubStr(shipType," 0") && !HasSubStr(shipType," 1") && !HasSubStr(shipType," 2") && !HasSubStr(shipType," 3") && !HasSubStr(shipType," 4") && !HasSubStr(shipType," 5") && !HasSubStr(shipType," 6") && !HasSubStr(shipType," 7") && !HasSubStr(shipType," 8") && !HasSubStr(shipType," 9"))
        {
            shipDescribe = shipType;
        }
    }
    return shipDescribe;
}
Thanks for finding that @Homo eructus, :doff
Drawing Kit is right as that's what the picture shows.
I have changed in the Cartagena hotel_dialog.h now to Drawing Kit.
Obs bugfix.
Be sure to include that in your next upload!

Alternatively @Grey Roger, please add it to your ZIP!
 
That's indeed tricky, but what you want should indeed be possible.

I have NOT tested this, but I think in theory it might do the trick:
Code:
string GetShipDescribe(string charId, bool nation, bool nguns, bool shipname, bool accusative)
{
    ref chr, shipRef;
    int canQuantity;
    aref arShip;
    string shipType;
    string shipDescribe = "";

    chr = characterFromID(charId);
    shipRef = GetShipByType(GetCharacterShipType(chr));
    shipType = XI_ConvertString(shipRef.Sname);

    if (nation) shipDescribe += XI_ConvertString("sw_" + GetNationDescByType(sti(chr.nation))) + " ";
    if (nguns) shipDescribe += GetMaxCannonQuantity(chr) + XI_ConvertString("cannonsQuantity") + " ";
    shipDescribe += strlower(shipType);
    switch (LanguageGetLanguage()) {
        case "Polish":
            if (accusative) {
                int dl = strlen(shipDescribe);
                if (GetSymbol(shipDescribe, dl - 1) == "a") {
                    string tmpstr = "";
                    for (int i = 0; i < dl - 1; i++) {
                        if (GetSymbol(shipDescribe, i + 1) == " ")
                            tmpstr += "¹";
                        else
                            tmpstr += strcut(shipDescribe, i, i);
                    }
                    tmpstr += "×";
                    shipDescribe = tmpstr;
                }
        }
        break;
        case "Spanish":
            shipDescribe = strlower(shipType);
            if (nation) shipDescribe += XI_ConvertString("sw_" + GetNationDescByType(sti(chr.nation))) + " ";
            if (nguns) shipDescribe += GetMaxCannonQuantity(chr) + XI_ConvertString("cannonsQuantity") + " ";
        break;
        // default:
    }
    if (shipname) shipDescribe += " " + GetMyShipNameShow(chr);

    if(HasSubStr(shipType,"0") || HasSubStr(shipType,"1") || HasSubStr(shipType,"2") || HasSubStr(shipType,"3") || HasSubStr(shipType,"4") || HasSubStr(shipType,"5") || HasSubStr(shipType,"6") || HasSubStr(shipType,"7") || HasSubStr(shipType,"8") || HasSubStr(shipType,"9"))
    {
        if(!HasSubStr(shipType," 0") && !HasSubStr(shipType," 1") && !HasSubStr(shipType," 2") && !HasSubStr(shipType," 3") && !HasSubStr(shipType," 4") && !HasSubStr(shipType," 5") && !HasSubStr(shipType," 6") && !HasSubStr(shipType," 7") && !HasSubStr(shipType," 8") && !HasSubStr(shipType," 9"))
        {
            shipDescribe = shipType;
        }
    }
    return shipDescribe;
}
Many thanks. Will give it a try tomorrow, and if it works it may be useful for other bits, like the date, which in Spanish always goes day-month-year and not month-day-year, like it does in the game.
 
Day, month, year is quite normal in Dutch too.
I think in English you can do whatever you like.
I chose the current date format mainly because it looks more old fashioned to me.
 
Worked like a charm:doff. In the end I went with a slightly different order and a few extra words to fit in better.

Where is the date format stored? I've found many instances of months and days but nothing that stablishes the order in which they're presented. It's a minor thing, but if it can be easily changed, it'd be nice.
 
Last edited:
Worked like a charm:doff.
I'm pleasantly surprised it worked, rather than blowing up or something! :cheeky

In the end I went with a slightly different order and a few extra words to fit in better.
Of course feel free to make whatever changes you feel necessary. :onya

Where is the date format stored?
I'd have to look it up; I'm not entirely sure. First place to start looking is PROGRAM\BATTLE_INTERFACE\LogInterface.c (is that its name?).
If I recall, that one contains the code to place that date constantly on the screen.
So even if it isn't in that file itself, at least it should contain the relevant function call.
 
I think I found it, it's in utils.c
Code:
// KK -->
string GetHumanDate(int year, int month, int day)
{
    string sufix = "th";
    if (day == 1 || day == 21 || day == 31) sufix = "st";
    if (day == 2 || day == 22) sufix = "nd";
    if (day == 3 || day == 23) sufix = "rd";
    return XI_ConvertString("g_month_" + month) + " " + day + XI_ConvertString(sufix) + ", " + year; // PB: Formatting changed to appear more historically appropriate
}
// <-- KK

But I'm not sure how to apply the language-specific variant.
 
I think I found it, it's in utils.c
Yep, that's the one! Good find. :onya

But I'm not sure how to apply the language-specific variant.
Maybe this?
Code:
string GetHumanDate(int year, int month, int day)
{
    if (LanguageGetLanguage() == "Spanish")
    {
        return day + " " + XI_ConvertString("g_month_" + month) + " " + year;
    }
    else
    {
        string sufix = "th";
        if (day == 1 || day == 21 || day == 31) sufix = "st";
        if (day == 2 || day == 22) sufix = "nd";
        if (day == 3 || day == 23) sufix = "rd";
        return XI_ConvertString("g_month_" + month) + " " + day + XI_ConvertString(sufix) + ", " + year; // PB: Formatting changed to appear more historically appropriate
    }
}
 
:aarHi everyone I am new in this comunity and this is my first post, Thanks you Pieter to invite me. I discovered PotC New Horizon mod a few months but that it isn's a reason to don't love a lot this moded game.

I have felt the necessity to translate this mod and I was working in my free time to make this real, for the moment I have got translated an a quarter from /RESOURCE/INI/TEXTS/ENGLISH/common.ini and I have got finished /RESOURCE/INI/TEXTS/ENGLISH/globals.txt .

In the one hand I have got problems with accents and character "ñ" because are represented with strange characters.

On the other hand I don't know why when copy /RESOURCE/INI/TEXTS/ENGLISH and paste this like /RESOURCE/INI/TEXTS/SPANISH then when I want to check the changes, I can`t switch between languages in "Interface Settings">"Languages" (In the game). :modding

I am working with version: 2 April 2016 - built 14 Beta 4 WIP.
 
Alright so I need that @Homo erectus dive the work because I don't know what files he is translating now.
 
Alright so I need that @Homo erectus dive the work because I don't know what files he is translating now.
I think his progress is "on hold" for now, so if you continue where he left off, it will probably be fine.

He usually drops by the forum every few days, so he'll probably respond soon(ish).
If not, you could send him a PM. :doff
 
Hi, @Alexar welcome.

Everything in RESOURCE/INI/TEXTS is taken care of (it'll have to be updated but I'll fight that battle when it comes), except the questbook entries for some storylines. What remains are mostly the dialogs, of which I've translated only about 30 files out of over 400.
 
Back
Top