[Already In] Multiple aliases for LANGUAGE strings

Moderator: GZDoom Developers

Multiple aliases for LANGUAGE strings

Postby Player701 » Tue Oct 13, 2020 2:59 pm

NB: This only concerns the plain-text LANGUAGE format and not the CSV format.

Sometimes it so happens that multiple strings defined in a mod's LANGUAGE lump have the same content. For example, suppose we want to replace all menu quit messages with a single new message. Currently, we'd have to do it like this:

Code: Select allExpand view
QUITMSG1 = "My new message";
QUITMSG2 = "My new message";
...
QUITMSG14 = "My new message";
...

IMO, this duplication shouldn't really be necessary. What if it were possible to do this instead:

Code: Select allExpand view
QUITMSG1 =
QUITMSG2 =
QUITMSG3 =
...
QUITMSG14 = "My new message";

Eh?

I'm sure this can be implemented relatively easily. I'd be willing to code it myself and provide a PR unless the developers don't approve of this suggestion for some reason.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Multiple aliases for LANGUAGE strings

Postby Graf Zahl » Tue Oct 13, 2020 4:40 pm

It is already implemented. I needed this feature for Raze. If you prefix a string with "$$" it is treated as a reference to another one in the table. What you propose here does not make much sense. It is not the normal case that you define a long list of identical texts.

(If you want to replace the quit messages, instead of hacking LANGUAGE, change the definition in MAPINFO.)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Multiple aliases for LANGUAGE strings

Postby Player701 » Tue Oct 13, 2020 11:33 pm

Graf Zahl wrote:It is already implemented. I needed this feature for Raze.

Oh, great! Thank you very much for letting me know.

Graf Zahl wrote:What you propose here does not make much sense. It is not the normal case that you define a long list of identical texts.

(If you want to replace the quit messages, instead of hacking LANGUAGE, change the definition in MAPINFO.)

That was just an example. There is an actual use case, it's legitimate but more complicated. My project has code that pulls strings from LANGUAGE based on CVar names to build help screens. Most of them contain a lot of text, and there are a few cases where the texts are the same. Maintaining this hasn't been easy because sometimes it can be difficult to remember where the duplicates are (everything is grouped by CVar name), getting rid of them would improve the situation.

Graf Zahl wrote:If you prefix a string with "$$" it is treated as a reference to another one in the table.

I think that's going to be sufficient. Then I suppose this should be closed as "already in"?
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Multiple aliases for LANGUAGE strings

Postby Graf Zahl » Tue Oct 13, 2020 11:41 pm

Yes.

I implemented it because for Duke Nukem I needed handling for the World Tour variant which uses different content in its scripted text definition but I didn't want to duplicate all that content in the translation sheet. The result looks like this:

[default]
// this is for redirecting World Tour's strings to language.csv
"#AuotAiming" = "$$AUTO AIMING";
"#ShowMapOff" = "$$SHOW MAP: OFF";
"#Activated" = "$$ACTIVATED";
"#PortableMedkit" = "$$PORTABLE MEDKIT";
"#Locked" = "$$LOCKED";
"#GivingEverything" = "$$GIVING EVERYTHING!";
"#Boots" = "$$BOOTS";
"#Wasted" = "$$WASTED!";
"#Unlocked" = "$$UNLOCKED";
"#ASecretPlace" = "$$A SECRET PLACE!";
"#Squish" = "$$SQUISH!";
"#AllDoorsUnlocked" = "$$ALL DOORS UNLOCKED";
"#UsedSteroids" = "$$USED STEROIDS";
"#UseToRestart" = "$$PRESS SPACE TO RESTART LEVEL";
"#AmmoForDevastator" = "$$AMMO FOR DEVASTATOR";
"#Deactivated" = "$$DEACTIVATED";
"#SwitchOperatedOnly" = "$$SWITCH OPERATED ONLY!";
"#GodModeOn" = "$$GOD MODE: ON";
"#GodModeOff" = "$$GOD MODE: OFF";
"#AtomicHealth" = "$$ATOMIC HEALTH!";
"#CrosshairOn" = "$$CROSSHAIR: ON";
"#CrosshairOff" = "$$CROSSHAIR: OFF";
"#Cheater" = "$$YOU'RE TOO GOOD TO BE CHEATING!";
"#MessagesOn" = "$$MESSAGES: ON";
"#MessagesOff" = "$$MESSAGES: OFF";
"#TypeTheCheatCode" = "$$TYPE THE CHEAT CODE:";
"#DetailLow" = "$$DETAIL: LOW";
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Multiple aliases for LANGUAGE strings

Postby Player701 » Tue Oct 13, 2020 11:55 pm

I've updated the corresponding wiki article with the information about this feature, in case other people are going to look for it.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Multiple aliases for LANGUAGE strings

Postby Gez » Thu Oct 15, 2020 8:38 am

Graf Zahl wrote:Yes.

I implemented it because for Duke Nukem I needed handling for the World Tour variant which uses different content in its scripted text definition but I didn't want to duplicate all that content in the translation sheet. The result looks like this:

[default]
// this is for redirecting World Tour's strings to language.csv
"#AuotAiming" = "$$AUTO AIMING";

They called it "AuotAiming" in World Tour?
Gez
 
 
 
Joined: 06 Jul 2007

Re: Multiple aliases for LANGUAGE strings

Postby Graf Zahl » Thu Oct 15, 2020 8:44 am

Yes, they misspelled their label.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests