- 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
parent e07d413095
commit cda248df66
7 changed files with 95 additions and 67 deletions

View file

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

View file

@ -66,6 +66,7 @@
#include "i_time.h"
#include "i_system.h"
#include "vm.h"
#include "gstrings.h"
EXTERN_CVAR (Int, disableautosave)
EXTERN_CVAR (Int, autosavecount)
@ -2187,6 +2188,13 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
case DEM_GIVECHEAT:
s = ReadString (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;
case DEM_TAKECHEAT:

View file

@ -49,6 +49,7 @@
#include "cmdlib.h"
#include "serializer.h"
#include "vm.h"
#include "gstrings.h"
static FRandom pr_pickteam ("PickRandomTeam");
@ -314,7 +315,7 @@ static void UpdateTeam (int pnum, int team, bool update)
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;
}
@ -329,10 +330,18 @@ static void UpdateTeam (int pnum, int team, bool update)
if (update && oldteam != team)
{
FString message;
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
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
R_BuildPlayerTranslation (pnum);

View file

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

View file

@ -64,7 +64,7 @@ void cht_DoMDK(player_t *player, const char *mod)
{
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)
{
@ -94,7 +94,6 @@ void cht_DoCheat (player_t *player, int cheat)
AActor *item;
FString smsg;
const char *msg = "";
char msgbuild[32];
int i;
// No cheating when not having a pawn attached.
@ -204,25 +203,25 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_NOTARGET:
player->cheats ^= CF_NOTARGET;
if (player->cheats & CF_NOTARGET)
msg = "notarget ON";
msg = GStrings("TXT_NOTARGET_ON");
else
msg = "notarget OFF";
msg = GStrings("TXT_NOTARGET_OFF");
break;
case CHT_ANUBIS:
player->cheats ^= CF_FRIGHTENING;
if (player->cheats & CF_FRIGHTENING)
msg = "\"Quake with fear!\"";
msg = GStrings("TXT_ANUBIS_ON");
else
msg = "No more ogre armor";
msg = GStrings("TXT_ANUBIS_OFF");
break;
case CHT_CHASECAM:
player->cheats ^= CF_CHASECAM;
if (player->cheats & CF_CHASECAM)
msg = "chasecam ON";
msg = GStrings("TXT_CHASECAM_ON");
else
msg = "chasecam OFF";
msg = GStrings("TXT_CHASECAM_OFF");
R_ResetViewInterpolation ();
break;
@ -326,10 +325,18 @@ void cht_DoCheat (player_t *player, int cheat)
{
int killcount = primaryLevel->Massacre (cheat == CHT_MASSACRE2);
// killough 3/22/98: make more intelligent about plural
// Ty 03/27/98 - string(s) *not* externalized
mysnprintf (msgbuild, countof(msgbuild), "%d %s%s Killed", killcount,
cheat==CHT_MASSACRE2 ? "Baddie" : "Monster", killcount==1 ? "" : "s");
msg = msgbuild;
if (killcount == 1)
{
msg = GStrings(cheat == CHT_MASSACRE? "TXT_MONSTER_KILLED" : "TXT_BADDIE_KILLED");
}
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;
@ -352,64 +359,64 @@ void cht_DoCheat (player_t *player, int cheat)
{
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
{
player->Resurrect();
}
}
break;
case CHT_GIMMIEA:
cht_Give (player, "ArtiInvulnerability");
msg = "Valador's Ring of Invunerability";
msg = GStrings("TAG_ARTIINVULNERABILITY");
break;
case CHT_GIMMIEB:
cht_Give (player, "ArtiInvisibility");
msg = "Shadowsphere";
msg = GStrings("TAG_ARTIINVISIBILITY");
break;
case CHT_GIMMIEC:
cht_Give (player, "ArtiHealth");
msg = "Quartz Flask";
msg = GStrings("TAG_ARTIHEALTH");
break;
case CHT_GIMMIED:
cht_Give (player, "ArtiSuperHealth");
msg = "Mystic Urn";
msg = GStrings("TAG_ARTISUPERHEALTH");
break;
case CHT_GIMMIEE:
cht_Give (player, "ArtiTomeOfPower");
msg = "Tyketto's Tome of Power";
msg = GStrings("TAG_ARTITOMEOFPOWER");
break;
case CHT_GIMMIEF:
cht_Give (player, "ArtiTorch");
msg = "Torch";
msg = GStrings("TAG_ARTITORCH");
break;
case CHT_GIMMIEG:
cht_Give (player, "ArtiTimeBomb");
msg = "Delmintalintar's Time Bomb of the Ancients";
msg = GStrings("TAG_ARTIFIREBOMB");
break;
case CHT_GIMMIEH:
cht_Give (player, "ArtiEgg");
msg = "Torpol's Morph Ovum";
msg = GStrings("TAG_ARTIEGG");
break;
case CHT_GIMMIEI:
cht_Give (player, "ArtiFly");
msg = "Inhilicon's Wings of Wrath";
msg = GStrings("TAG_ARTIFLY");
break;
case CHT_GIMMIEJ:
cht_Give (player, "ArtiTeleport");
msg = "Darchala's Chaos Device";
msg = GStrings("TAG_ARTITELEPORT");
break;
case CHT_GIMMIEZ:
@ -417,7 +424,7 @@ void cht_DoCheat (player_t *player, int cheat)
{
cht_Give (player, "artifacts");
}
msg = "All artifacts!";
msg = GStrings("TAG_ALL_ARTIFACTS");
break;
case CHT_TAKEWEAPS:
@ -444,9 +451,10 @@ void cht_DoCheat (player_t *player, int cheat)
break;
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)
{
@ -512,7 +520,7 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_CLEARFROZENPROPS:
player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN);
msg = "Frozen player properties turned off";
msg = GStrings("TXT_NOT_FROZEN");
break;
case CHT_FREEZE:
@ -528,13 +536,17 @@ void cht_DoCheat (player_t *player, int cheat)
break;
}
if (!*msg) // [SO] Don't print blank lines!
if (!msg || !*msg) // [SO] Don't print blank lines!
return;
if (player == &players[consoleplayer])
Printf ("%s\n", msg);
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)

View file

@ -65,6 +65,7 @@
#include "gi.h"
#include "gameconfigfile.h"
#include "gstrings.h"
FGameConfigFile *GameConfig;
@ -511,7 +512,7 @@ void WritePNGfile (FileWriter *file, const uint8_t *buffer, const PalEntry *pale
!M_AppendPNGText (file, "Software", software) ||
!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;
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)
{
return;