fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

FRED bug: $Display Name deleted on mission save

Open Achille44 opened this issue 1 year ago • 11 comments

On mission files, $Display Name for ships is required for translations, but FRED deletes it when saving the file.

Steps to reproduce:

  1. Open any mission file with a text editor and add a $Display Name below any ship:
$Name: Beta 1		;! Object #0
$Display Name: XSTR("Beta 1", -1)
  1. Open the mission with FRED, and just save. Now the $Display Name is gone.

Achille44 avatar Oct 06 '24 09:10 Achille44

This is working as designed. The removal of $Display Name, in cases where the display name and the actual name are identical, is required for other reasons.

Translation support is a legitimate reason to keep the $Display Name in place though, so this will require some thought.

Goober5000 avatar Oct 06 '24 18:10 Goober5000

What other reasons is it required for?

naomimyselfandi avatar Oct 07 '24 22:10 naomimyselfandi

I don't remember exactly, and #2710 doesn't completely describe the rationale. I'll have to try to reconstruct the thought process. I do remember that the current display-name behavior was the result of extensive testing and juggling several requirements among several mods. I'm fairly sure Series Resurrecta was one, and I think NeonShivan's mod was another.

Goober5000 avatar Oct 08 '24 02:10 Goober5000

IMHO the solution depends on what "required for translations" from the OP means.

  • If it refers to FSO code that parses the table for translators to view (or something like that), then we'd need to add logic to that parsing code to the effect of "if display name is missing, get the ship name from the 'name' field instead".
  • If it refers to someone (or some other tool) needing to find the ship's "display name", I'd suggest adding support for producing a separate, special version of ships.tbl that won't be added to VPs but is available for translators/translation tools to use, in addition to generating the official ships.tbl. The best way to add that support is probably a FRED option to create that extra copy of ships.tbl. The only other option I can think of is to create a separate post-processing tool to take the mod's official ships.tbl and produce this "special version". The tool could just do rudimentary text processing.

Just my $0.02.

jg18 avatar May 19 '25 03:05 jg18

IMHO the solution depends on what "required for translations" from the OP means.

  • If it refers to FSO code that parses the table for translators to view (or something like that), then we'd need to add logic to that parsing code to the effect of "if display name is missing, get the ship name from the 'name' field instead".
  • If it refers to someone (or some other tool) needing to find the ship's "display name", I'd suggest adding support for producing a separate, special version of ships.tbl that won't be added to VPs but is available for translators/translation tools to use, in addition to generating the official ships.tbl. The best way to add that support is probably a FRED option to create that extra copy of ships.tbl. The only other option I can think of is to create a separate post-processing tool to take the mod's official ships.tbl and produce this "special version". The tool could just do rudimentary text processing.

Just my $0.02.

This is a specific issue where they are trying to translate a ship's naming using the XSTR features in mission files, specifically Display Name. However, for whatever reason Display Name doesn't follow the standard translation rules and FRED yeets it on saving in the standard case. So if you use it to translate ship names and then go modify the mission file in FRED then the XSTR data is discarded.

Achille works hard on translations in the community and it'd be nice to prioritize the required feature-sets to do it right. I'd tackle this myself but given the reason it currently does what it does is for "reasons" that weren't recorded it seems like it'd be wasted effort on my part.

MjnMixael avatar Jun 09 '25 14:06 MjnMixael

From a look at missionsave.cpp, the Display Name of jump nodes is also omitted from mission files, if the display name is identical to the name.

Are there translation issues with jump node names?

jg18 avatar Jun 14 '25 03:06 jg18

From a look at missionsave.cpp, the Display Name of jump nodes is also omitted from mission files, if the display name is identical to the name.

Are there translation issues with jump node names?

If it's omitted, then yes because there's then no good way to translate them.

MjnMixael avatar Jun 14 '25 03:06 MjnMixael

Can translators translate the ship's "$Alt Name" field instead of "$Display Name"?

The ships.tbl parsing code treats the "$Alt Name" and "$Display Name" fields the same. See ship.cpp.

But, hmm, the ship parsing code supports reading "$Alt name", but FRED's missionssave.cpp doesn't support writing "$Alt Name". Weird. That parsing code was touched by Goober's PR, so maybe he can figure out why.

EDIT: Prior to PR #2674, ship_info::display_name was called ship_info::alt_name.

jg18 avatar Jun 14 '25 05:06 jg18

Re: the "not a bug" label on this issue, IIUC, it's now impossible to localize the name of a ship if the ship's official name and its (English) display name are the same.

How could that be anything other than a bug?

EDIT: a clunky workaround: if your ship's name is supposed to be "FooBar", you could make the name, say, "FooBar0" and the alt/display name "FooBar". Then you can translate the ship name.

jg18 avatar Jun 14 '25 05:06 jg18

From a look at missionsave.cpp, the Display Name of jump nodes is also omitted from mission files, if the display name is identical to the name.

Are there translation issues with jump node names?

Indeed the issue is the same with jump node names.

Achille44 avatar Jun 14 '25 20:06 Achille44

Can translators translate the ship's "$Alt Name" field instead of "$Display Name"?

"$Alt Name" is used to translate the ship class name and not the ship name, so it cannot be used instead of $Display Name.

Achille44 avatar Jun 14 '25 20:06 Achille44

#6810 has now been merged. It has multiple tools to improve support for display names, including a new "Always save Display Names" menu option.

Goober5000 avatar Jul 14 '25 00:07 Goober5000