- localized some user-facing texts that were still string literals.

This commit is contained in:
Christoph Oelckers 2019-03-19 00:37:43 +01:00 committed by drfrag
parent 508b65bdd8
commit f57ebacae6
7 changed files with 95 additions and 67 deletions

View file

@ -1862,7 +1862,7 @@ CCMD (toggle)
val = var->GetGenericRep (CVAR_Bool); val = var->GetGenericRep (CVAR_Bool);
val.Bool = !val.Bool; val.Bool = !val.Bool;
var->SetGenericRep (val, CVAR_Bool); var->SetGenericRep (val, CVAR_Bool);
Printf ("\"%s\" is \"%s\"\n", var->GetName(), Printf ("\"%s\" = \"%s\"\n", var->GetName(),
val.Bool ? "true" : "false"); val.Bool ? "true" : "false");
} }
} }

View file

@ -74,6 +74,7 @@
#include "events.h" #include "events.h"
#include "i_time.h" #include "i_time.h"
#include "vm.h" #include "vm.h"
#include "gstrings.h"
EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (Int, disableautosave)
EXTERN_CVAR (Int, autosavecount) EXTERN_CVAR (Int, autosavecount)
@ -2200,6 +2201,13 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
case DEM_GIVECHEAT: case DEM_GIVECHEAT:
s = ReadString (stream); s = ReadString (stream);
cht_Give (&players[player], s, ReadLong (stream)); cht_Give (&players[player], s, ReadLong (stream));
if (player != consoleplayer)
{
FString message = GStrings("TXT_X_CHEATS");
message.Substitute("%s", players[player].userinfo.GetName());
Printf("%s: give %s\n", message.GetChars(), s);
}
break; break;
case DEM_TAKECHEAT: case DEM_TAKECHEAT:

View file

@ -58,6 +58,7 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "serializer.h" #include "serializer.h"
#include "vm.h" #include "vm.h"
#include "gstrings.h"
static FRandom pr_pickteam ("PickRandomTeam"); static FRandom pr_pickteam ("PickRandomTeam");
@ -323,7 +324,7 @@ static void UpdateTeam (int pnum, int team, bool update)
if ((dmflags2 & DF2_NO_TEAM_SWITCH) && (alwaysapplydmflags || deathmatch) && TeamLibrary.IsValidTeam (info->GetTeam())) if ((dmflags2 & DF2_NO_TEAM_SWITCH) && (alwaysapplydmflags || deathmatch) && TeamLibrary.IsValidTeam (info->GetTeam()))
{ {
Printf ("Team changing has been disabled!\n"); Printf ("%s\n", GStrings("TXT_NO_TEAM_CHANGE"));
return; return;
} }
@ -338,10 +339,18 @@ static void UpdateTeam (int pnum, int team, bool update)
if (update && oldteam != team) if (update && oldteam != team)
{ {
FString message;
if (TeamLibrary.IsValidTeam (team)) if (TeamLibrary.IsValidTeam (team))
Printf ("%s joined the %s team\n", info->GetName(), Teams[team].GetName ()); {
message = GStrings("TXT_JOINED_TEAM");
message.Substitute("%t", Teams[team].GetName());
}
else else
Printf ("%s is now a loner\n", info->GetName()); {
message = GStrings("TXT_LONER");
}
message.Substitute("%s", info->GetName());
Printf("%s\n", message.GetChars());
} }
// Let the player take on the team's color // Let the player take on the team's color
R_BuildPlayerTranslation (pnum); R_BuildPlayerTranslation (pnum);

View file

@ -1695,16 +1695,9 @@ void G_DoPlayerPop(int playernum)
{ {
playeringame[playernum] = false; playeringame[playernum] = false;
if (deathmatch) FString message = GStrings(deathmatch? "TXT_LEFTWITHFRAGS" : "TXT_LEFTTHEGAME");
{ message.Substitute("%s", players[playernum].userinfo.GetName());
Printf("%s left the game with %d frags\n", message.Substitute("%d", FStringf("%d", players[playernum].fragcount));
players[playernum].userinfo.GetName(),
players[playernum].fragcount);
}
else
{
Printf("%s left the game\n", players[playernum].userinfo.GetName());
}
// [RH] Revert each player to their own view if spying through the player who left // [RH] Revert each player to their own view if spying through the player who left
for (int ii = 0; ii < MAXPLAYERS; ++ii) for (int ii = 0; ii < MAXPLAYERS; ++ii)
@ -1775,7 +1768,7 @@ static bool CheckSingleWad (const char *name, bool &printRequires, bool printwar
{ {
if (!printRequires) if (!printRequires)
{ {
Printf ("This savegame needs these wads:\n%s", name); Printf ("%s:\n%s", GStrings("TXT_SAVEGAMENEEDS"), name);
} }
else else
{ {
@ -1811,6 +1804,12 @@ bool G_CheckSaveGameWads (FSerializer &arc, bool printwarn)
return true; return true;
} }
static void LoadGameError(const char *label, const char *append = "")
{
FString message = GStrings(label);
message.Substitute("%s", savename);
Printf ("%s %s\n", message.GetChars(), append);
}
void G_DoLoadGame () void G_DoLoadGame ()
{ {
@ -1826,13 +1825,13 @@ void G_DoLoadGame ()
std::unique_ptr<FResourceFile> resfile(FResourceFile::OpenResourceFile(savename.GetChars(), true, true)); std::unique_ptr<FResourceFile> resfile(FResourceFile::OpenResourceFile(savename.GetChars(), true, true));
if (resfile == nullptr) if (resfile == nullptr)
{ {
Printf ("Could not read savegame '%s'\n", savename.GetChars()); LoadGameError("TXT_COULDNOTREAD");
return; return;
} }
FResourceLump *info = resfile->FindLump("info.json"); FResourceLump *info = resfile->FindLump("info.json");
if (info == nullptr) if (info == nullptr)
{ {
Printf("'%s' is not a valid savegame: Missing 'info.json'.\n", savename.GetChars()); LoadGameError("TXT_NOINFOJSON");
return; return;
} }
@ -1842,7 +1841,7 @@ void G_DoLoadGame ()
FSerializer arc; FSerializer arc;
if (!arc.OpenReader((const char *)data, info->LumpSize)) if (!arc.OpenReader((const char *)data, info->LumpSize))
{ {
Printf("Failed to access savegame info\n"); LoadGameError("TXT_FAILEDTOREADSG");
return; return;
} }
@ -1860,27 +1859,30 @@ void G_DoLoadGame ()
// have this information. // have this information.
if (engine.IsEmpty()) if (engine.IsEmpty())
{ {
Printf("Savegame is from an incompatible version\n"); LoadGameError("TXT_INCOMPATIBLESG");
} }
else else
{ {
Printf("Savegame is from another ZDoom-based engine: %s\n", engine.GetChars()); LoadGameError("TXT_IOTHERENGINESG", engine.GetChars());
} }
return; return;
} }
if (SaveVersion < MINSAVEVER || SaveVersion > SAVEVER) if (SaveVersion < MINSAVEVER || SaveVersion > SAVEVER)
{ {
Printf("Savegame is from an incompatible version"); FString message;
if (SaveVersion < MINSAVEVER) if (SaveVersion < MINSAVEVER)
{ {
Printf(": %d (%d is the oldest supported)", SaveVersion, MINSAVEVER); message = GStrings("TXT_TOOOLDSG");
message.Substitute("%e", FStringf("%d", MINSAVEVER));
} }
else else
{ {
Printf(": %d (%d is the highest supported)", SaveVersion, SAVEVER); message = GStrings("TXT_TOONEWSG");
message.Substitute("%e", FStringf("%d", SAVEVER));
} }
Printf("\n"); message.Substitute("%d", FStringf("%d", SaveVersion));
LoadGameError(message);
return; return;
} }
@ -1891,7 +1893,7 @@ void G_DoLoadGame ()
if (map.IsEmpty()) if (map.IsEmpty())
{ {
Printf("Savegame is missing the current map\n"); LoadGameError("TXT_NOMAPSG");
return; return;
} }
@ -1907,14 +1909,14 @@ void G_DoLoadGame ()
info = resfile->FindLump("globals.json"); info = resfile->FindLump("globals.json");
if (info == nullptr) if (info == nullptr)
{ {
Printf("'%s' is not a valid savegame: Missing 'globals.json'.\n", savename.GetChars()); LoadGameError("TXT_NOGLOBALSJSON");
return; return;
} }
data = info->CacheLump(); data = info->CacheLump();
if (!arc.OpenReader((const char *)data, info->LumpSize)) if (!arc.OpenReader((const char *)data, info->LumpSize))
{ {
Printf("Failed to access savegame info\n"); LoadGameError("TXT_SGINFOERR");
return; return;
} }
@ -1979,20 +1981,19 @@ void G_SaveGame (const char *filename, const char *description)
{ {
if (sendsave || gameaction == ga_savegame) if (sendsave || gameaction == ga_savegame)
{ {
Printf ("A game save is still pending.\n"); Printf ("%s\n", GStrings("TXT_SAVEPENDING"));
return;
} }
else if (!usergame) else if (!usergame)
{ {
Printf ("not in a saveable game\n"); Printf ("%s\n", GStrings("TXT_NOTSAVEABLE"));
} }
else if (gamestate != GS_LEVEL) else if (gamestate != GS_LEVEL)
{ {
Printf ("not in a level\n"); Printf ("%s\n", GStrings("TXT_NOTINLEVEL"));
} }
else if (players[consoleplayer].health <= 0 && !multiplayer) else if (players[consoleplayer].health <= 0 && !multiplayer)
{ {
Printf ("player is dead in a single-player game\n"); Printf ("%s\n", GStrings("TXT_SPPLAYERDEAD"));
} }
else else
{ {
@ -2258,7 +2259,7 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
if (longsavemessages) Printf ("%s (%s)\n", GStrings("GGSAVED"), filename.GetChars()); if (longsavemessages) Printf ("%s (%s)\n", GStrings("GGSAVED"), filename.GetChars());
else Printf ("%s\n", GStrings("GGSAVED")); else Printf ("%s\n", GStrings("GGSAVED"));
} }
else Printf(PRINT_HIGH, "Save failed\n"); else Printf(PRINT_HIGH, "%s\n", GStrings("TXT_SAVEFAILED"));
BackupSaveName = filename; BackupSaveName = filename;

View file

@ -74,7 +74,7 @@ void cht_DoMDK(player_t *player, const char *mod)
{ {
if (player->mo == NULL) if (player->mo == NULL)
{ {
Printf("What do you want to kill outside of a game?\n"); Printf("%s\n", GStrings("TXT_WHAT_KILL"));
} }
else if (!deathmatch) else if (!deathmatch)
{ {
@ -104,7 +104,6 @@ void cht_DoCheat (player_t *player, int cheat)
AActor *item; AActor *item;
FString smsg; FString smsg;
const char *msg = ""; const char *msg = "";
char msgbuild[32];
int i; int i;
// No cheating when not having a pawn attached. // No cheating when not having a pawn attached.
@ -214,25 +213,25 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_NOTARGET: case CHT_NOTARGET:
player->cheats ^= CF_NOTARGET; player->cheats ^= CF_NOTARGET;
if (player->cheats & CF_NOTARGET) if (player->cheats & CF_NOTARGET)
msg = "notarget ON"; msg = GStrings("TXT_NOTARGET_ON");
else else
msg = "notarget OFF"; msg = GStrings("TXT_NOTARGET_OFF");
break; break;
case CHT_ANUBIS: case CHT_ANUBIS:
player->cheats ^= CF_FRIGHTENING; player->cheats ^= CF_FRIGHTENING;
if (player->cheats & CF_FRIGHTENING) if (player->cheats & CF_FRIGHTENING)
msg = "\"Quake with fear!\""; msg = GStrings("TXT_ANUBIS_ON");
else else
msg = "No more ogre armor"; msg = GStrings("TXT_ANUBIS_OFF");
break; break;
case CHT_CHASECAM: case CHT_CHASECAM:
player->cheats ^= CF_CHASECAM; player->cheats ^= CF_CHASECAM;
if (player->cheats & CF_CHASECAM) if (player->cheats & CF_CHASECAM)
msg = "chasecam ON"; msg = GStrings("TXT_CHASECAM_ON");
else else
msg = "chasecam OFF"; msg = GStrings("TXT_CHASECAM_OFF");
R_ResetViewInterpolation (); R_ResetViewInterpolation ();
break; break;
@ -333,10 +332,18 @@ void cht_DoCheat (player_t *player, int cheat)
{ {
int killcount = P_Massacre (cheat == CHT_MASSACRE2); int killcount = P_Massacre (cheat == CHT_MASSACRE2);
// killough 3/22/98: make more intelligent about plural // killough 3/22/98: make more intelligent about plural
// Ty 03/27/98 - string(s) *not* externalized if (killcount == 1)
mysnprintf (msgbuild, countof(msgbuild), "%d %s%s Killed", killcount, {
cheat==CHT_MASSACRE2 ? "Baddie" : "Monster", killcount==1 ? "" : "s"); msg = GStrings(cheat == CHT_MASSACRE? "TXT_MONSTER_KILLED" : "TXT_BADDIE_KILLED");
msg = msgbuild; }
else
{
// Note: Do not use the language string directly as a format template!
smsg = GStrings(cheat == CHT_MASSACRE? "TXT_MONSTERS_KILLED" : "TXT_BADDIES_KILLED");
FStringf countstr("%d", killcount);
smsg.Substitute("%d", countstr);
msg = smsg.GetChars();
}
} }
break; break;
@ -359,64 +366,64 @@ void cht_DoCheat (player_t *player, int cheat)
{ {
if (player->mo->IsKindOf("PlayerChunk")) if (player->mo->IsKindOf("PlayerChunk"))
{ {
Printf("Unable to resurrect. Player is no longer connected to its body.\n"); Printf("%s\n", GStrings("TXT_NO_RESURRECT"));
return;
} }
else else
{ {
player->Resurrect(); player->Resurrect();
} }
} }
break; break;
case CHT_GIMMIEA: case CHT_GIMMIEA:
cht_Give (player, "ArtiInvulnerability"); cht_Give (player, "ArtiInvulnerability");
msg = "Valador's Ring of Invunerability"; msg = GStrings("TAG_ARTIINVULNERABILITY");
break; break;
case CHT_GIMMIEB: case CHT_GIMMIEB:
cht_Give (player, "ArtiInvisibility"); cht_Give (player, "ArtiInvisibility");
msg = "Shadowsphere"; msg = GStrings("TAG_ARTIINVISIBILITY");
break; break;
case CHT_GIMMIEC: case CHT_GIMMIEC:
cht_Give (player, "ArtiHealth"); cht_Give (player, "ArtiHealth");
msg = "Quartz Flask"; msg = GStrings("TAG_ARTIHEALTH");
break; break;
case CHT_GIMMIED: case CHT_GIMMIED:
cht_Give (player, "ArtiSuperHealth"); cht_Give (player, "ArtiSuperHealth");
msg = "Mystic Urn"; msg = GStrings("TAG_ARTISUPERHEALTH");
break; break;
case CHT_GIMMIEE: case CHT_GIMMIEE:
cht_Give (player, "ArtiTomeOfPower"); cht_Give (player, "ArtiTomeOfPower");
msg = "Tyketto's Tome of Power"; msg = GStrings("TAG_ARTITOMEOFPOWER");
break; break;
case CHT_GIMMIEF: case CHT_GIMMIEF:
cht_Give (player, "ArtiTorch"); cht_Give (player, "ArtiTorch");
msg = "Torch"; msg = GStrings("TAG_ARTITORCH");
break; break;
case CHT_GIMMIEG: case CHT_GIMMIEG:
cht_Give (player, "ArtiTimeBomb"); cht_Give (player, "ArtiTimeBomb");
msg = "Delmintalintar's Time Bomb of the Ancients"; msg = GStrings("TAG_ARTIFIREBOMB");
break; break;
case CHT_GIMMIEH: case CHT_GIMMIEH:
cht_Give (player, "ArtiEgg"); cht_Give (player, "ArtiEgg");
msg = "Torpol's Morph Ovum"; msg = GStrings("TAG_ARTIEGG");
break; break;
case CHT_GIMMIEI: case CHT_GIMMIEI:
cht_Give (player, "ArtiFly"); cht_Give (player, "ArtiFly");
msg = "Inhilicon's Wings of Wrath"; msg = GStrings("TAG_ARTIFLY");
break; break;
case CHT_GIMMIEJ: case CHT_GIMMIEJ:
cht_Give (player, "ArtiTeleport"); cht_Give (player, "ArtiTeleport");
msg = "Darchala's Chaos Device"; msg = GStrings("TAG_ARTITELEPORT");
break; break;
case CHT_GIMMIEZ: case CHT_GIMMIEZ:
@ -424,7 +431,7 @@ void cht_DoCheat (player_t *player, int cheat)
{ {
cht_Give (player, "artifacts"); cht_Give (player, "artifacts");
} }
msg = "All artifacts!"; msg = GStrings("TAG_ALL_ARTIFACTS");
break; break;
case CHT_TAKEWEAPS: case CHT_TAKEWEAPS:
@ -451,9 +458,10 @@ void cht_DoCheat (player_t *player, int cheat)
break; break;
case CHT_MDK: case CHT_MDK:
if (player->mo == NULL) if (player->mo == nullptr)
{ {
Printf ("What do you want to kill outside of a game?\n"); Printf ("%s\n", GStrings("TXT_WHAT_KILL"));
return;
} }
else if (!deathmatch) else if (!deathmatch)
{ {
@ -519,7 +527,7 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_CLEARFROZENPROPS: case CHT_CLEARFROZENPROPS:
player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN); player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN);
msg = "Frozen player properties turned off"; msg = GStrings("TXT_NOT_FROZEN");
break; break;
case CHT_FREEZE: case CHT_FREEZE:
@ -535,13 +543,17 @@ void cht_DoCheat (player_t *player, int cheat)
break; break;
} }
if (!*msg) // [SO] Don't print blank lines! if (!msg || !*msg) // [SO] Don't print blank lines!
return; return;
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
Printf ("%s\n", msg); Printf ("%s\n", msg);
else if (cheat != CHT_CHASECAM) else if (cheat != CHT_CHASECAM)
Printf ("%s cheats: %s\n", player->userinfo.GetName(), msg); {
FString message = GStrings("TXT_X_CHEATS");
message.Substitute("%s", player->userinfo.GetName());
Printf("%s: %s\n", message.GetChars(), msg);
}
} }
FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo) FString cht_Morph(player_t *player, PClassActor *morphclass, bool quickundo)

View file

@ -78,6 +78,7 @@
#include "gi.h" #include "gi.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "gstrings.h"
FGameConfigFile *GameConfig; FGameConfigFile *GameConfig;
@ -529,7 +530,7 @@ void WritePNGfile (FileWriter *file, const uint8_t *buffer, const PalEntry *pale
!M_AppendPNGText (file, "Software", software) || !M_AppendPNGText (file, "Software", software) ||
!M_FinishPNG (file)) !M_FinishPNG (file))
{ {
Printf ("Could not create screenshot.\n"); Printf ("%s\n", GStrings("TXT_SCREENSHOTERR"));
} }
} }

View file

@ -49,9 +49,6 @@ extend class PlayerPawn
Class<Inventory> type; Class<Inventory> type;
let player = self.player; let player = self.player;
if (PlayerNumber() != consoleplayer)
A_Log(String.Format ("%s is a cheater: give %s\n", player.GetUserName(), name));
if (player.mo == NULL || player.health <= 0) if (player.mo == NULL || player.health <= 0)
{ {
return; return;