• 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

Huh... Yes, that can happen sometimes. Quite annoying, but what can you do. Anyway, I hope your translation process is a bit more fun again now. If you need anything else just scream, I'll try to help then. :doff
 
Last edited:
Well, now I'll have to rewrite all the other files from which I had already removed the special characters to add them back in, but I'm more than happy to do it, knowing that it will work (I've already succesfully tested about_build).

Actually, it's a good excuse to go over the files again, every time I do it, I find new typos that escaped my eyes earlier.
 
Last edited:
Normally leading and trailing spaces are excluded from the translation strings anyway.
I don't know why, but it can't hurt and maybe this here DOES explain why.

Coming back to this, actually removing the trailing spaces can hurt. Those spaces are there to separate the different strings that make one ingame sentence like "Wind comes from the S at 20 kts". It works when the game reads the files as they are, but as you pointed out, those spaces don't work in translation strings so the result ingame once you add them to interface_strings is "Wind comes from theSat20kts" (or its Spanish equivalent). To fix that I've found a somewhat unorthodox solution, which is adding a º sign at the beginning or the end of the strings with the spaces. The game doesn't recognize the º and can't display it but stil aknowledges that the string ends or starts with a symbol that is not a space so it displays the space. So the strings in interfaces_strings look like this:

Wind is from the{Wind is from the º}
kts{º kts}

But show perfectly ingame. There may be a better way but this works for the moment at least and I'm pretty pleased with myself:p.
 
It would be better to just add:
Code:
+ " " +
In the .c code itself in spots where you need the additional spaces.
That way, the spaces are simply not part of the strings being translated.

This is done quite a lot in the code already. :yes
 
I knew there had to be a less messy way of doing it, but I'm still a bit scared to tinker with the c files too much. Will do that from now on. :thumbs1

You'll make a modder out of me yet :p
 
I'm still a bit scared to tinker with the c files too much.

And rightfully so. Oh my, I've made a mess trying to translate the ship log entries in AIShip.c. I changed only the translatable strings and added spaces where needed and at first things seemed to go fine, with a litle hiccup here and there when a string or two wouldn't show properly because I had forgotten a bracket or something. But then all went to hell: now the battle log entries don't even appear in the log, and what's more, ships don't sink (I get the message onscreen but the ship is still afloat) and can't be boarded, and there are errors everywhere. I don't know how changing the code for the log entries can mess up that much.
 
Loads of stuff, half of the errors in files I haven't even touched or in strings that worked previously and haven't been changed.
 

Attachments

  • error.log
    6.3 KB · Views: 122
What's on the lines referred to here?
Code:
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2947
invalid operand
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2947
function 'ShipDead' stack error
And:
Code:
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2935
invalid operand
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2935
function 'ShipDead' stack error
Those look related.

Also, I think you did edit the select storyline file, right? Might want to check these two lines too:
Code:
COMPILE ERROR - file: interface\select_storyline.c; line: 2187
Invalid Expression
COMPILE ERROR - file: interface\select_storyline.c; line: 2187
Invalid Expression
COMPILE ERROR - file: interface\select_storyline.c; line: 2188
invalid function argument
COMPILE ERROR - file: interface\select_storyline.c; line: 2188
Invalid Expression

If nothing stands out as obviously wrong, you might want to upload those files.
 
Huh, there were two brackets missing from those lines in select_storyline but I'm fairly sure I had put them there in the first place (never had that error before and those strings had always worked since I first edited them until today), somehow they deleted themselves?

And I found a couple of errors in AIShip that, once corrected, seem to have fixed the problem. Not only in those particular lines that the error log pointed at, though.

Now, I'm back to the original problem, one of the strings doesn't show translated in the ship log. It's the longest one, maybe it's too long for common.ini or something?

I've checked several times and the code seems solid to me but I'm missing a lot of stuff lately, so I'll post it in case you can spot some mess-up on my part
AIShip
Code:
          sLogEntry = GetLogTime()+" "+TranslateString("", "we encountered the")+" "+GetMyShipNameShow(rDead)+", "+TranslateString("", "a")+" "+sSunkShipType+" "+TranslateString("", "flying")+" "+XI_ConvertString(GetNationDescByType(iNation))+" "+TranslateString("", "colours while under")+" "+XI_ConvertString(GetNationDescByType(GetCurrentFlag()))+" "+TranslateString("", "flag ourselves.\nWhen they were in reach of our cannons, we opened fire. Our cannons tore their sails to tatters and shattered their hull. After a ferocious battle, the")+" "+GetMyShipNameShow(rKillerCharacter)+" "+TranslateString("", "fired her cannons a last time at the")+" "+sSunkShipType + TranslateString("", ". Its hull was already heavily damaged from a previous broadside and the ship sank like a stone.");
These all work except "flag ourselves.\nWhen they were in reach..."
common.ini
Code:
string = flag ourselves.\nWhen they were in reach of our cannons, we opened fire. Our cannons tore their sails to tatters and shattered their hull. After a ferocious battle, the,".\nCuando estuvieron al alcance de nuestros cañones, abrimos fuego. Nuestros cañones desgarraron sus velas y acribillaron su casco. Después de un feroz combate, el"
The same happens with the other long strings for the other cases (boarding, surrender). the only thing the seem to have in common is their position in the code and their length
 

Attachments

  • Sin título.jpg
    Sin título.jpg
    213.9 KB · Views: 113
Last edited:
Do they all have "\n" in them? That can potentially be a source of trouble.... :(
 
I think so. But I think others that have it aswell do work. I'll have to check.

Edit: At the start of the next paragraph there's "/nAbout" ("En torno a" in the screenshot I posted above) and that one works. If "/n" is the problem, it may be only when it's in the middle of the string, and then the solution could be simply splitting those strings in two at the "/n", right?
 
Last edited:
Now I've definitely broken it. After a crash during testing, when I launch the game the main menu is back in English, when it should be in Spanish and clicking any option other than quit just causes the game to freeze forever. There's no error log. I've reverted all the files I was working on (only AIShip.c and the two common.ini) back to how they were before the crash but it didn't help.
 

Attachments

  • compile.log
    1.7 KB · Views: 96
  • system.log
    462 bytes · Views: 95
I think I know what the problem is... maybe?

The strings that don't translate are the ones that have commas in them. common.ini interprets the comma as the ending of the original string, before the translated one in quote signs, (string = whatever,"whatever") so when there's more commas involved, the poor thing gets confused. So those strings have to go into interface_strings.txt and not common.ini then... I guess.
 
Ah, that makes sense I suppose. :onya

Indeed I'd recommend using common.ini only for short and commonly used texts, while using those other TXT files for everything else.
 
Next stop:

The weekdays on the ship's log didn't translate even if the months did (see screenshot above), but the date you get at the top of the screen while walking/sailing around does include the translated weekday. So I took a look at calendar.c and saw that thelist of the weekdays in there didn't have translation strings. I added them and now the weekday works in the log but has completely disappeared form the date at the top of the screen. Any ideas?
 
I don't see a screenshot.

I wonder if possibly the code ends up calling the translation code twice in a row on the same string.
 
Back
Top