But if I've understood it correctly, shouldn't it be in a single string like this, so the words are not checked separately? (and consequently, "Street Merchant" as a single string in all the character_names files too?)
Code:
ch.name = TranslateString("","Street Merchant");
No, "TranslateString" takes two string arguments. That's why "StreetMerchants.c" defines most of their names like this:
Code:
ch.name = TranslateString("","Street");
ch.lastname = TranslateString("","Merchant");
If either argument is blank, it simply translates the one which is not blank. If both arguments are not blank, e.g.:
Code:
ch.name = TranslateString("Street","Merchant");
then it translates both parts and puts them together, in reverse order if the chosen language is Russian or Polish.
Having said that, what "TranslateString" does in detail at each stage is this:
Code:
resultString = SpellString(GetStorylinePath(FindCurrentStoryline()), "characters_names.txt", &str1, &str2, joinString);
if (resultString != "") return resultString;
if (rStr1 == "") rStr1 = str1;
if (rStr2 == "") rStr2 = str2;
"joinString" is set earlier in the function to be both parts joined together, with a space between if neither part is blank. "SpellString" is another function, also defined in "Dialog_func.c", which does the actual translating using the translation file provided - in this example, it's told to use the storyline-specific version of "characters_names.txt". It passes back translated versions of "str1" and "str2", and also tries to translate "joinString". If the translation of "joinString" was successful then "TranslateString" simply returns that.
What this means is that if "StreetMerchants.c" says:
Code:
ch.name = TranslateString("Street","Merchant");
and "characters_names.txt" contains a translation of "Street Merchant", then "TranslateString" should return the translation of the combined string as if it had been a single string originally.
Try it. Edit "StreetMerchants.c" and change "Muelle_Street_merchant_1" to use this:
Code:
ch.name = TranslateString("Street","Merchant");
ch.lastname = "";
Then add a line in "characters_names.txt":
Code:
Street Merchant{Mercader callejero}
"Muelle_Street_merchant_1" is the one in the port area of San Juan. Start a FreePlay game as a Spanish character so that you start in San Juan, find the street merchant in the port, and see if his "name" appears correctly.