add a hardcoded language in case localization files are missing

This commit is contained in:
GenZmeY 2023-05-02 00:37:07 +03:00
parent 0dc735b800
commit b50680554f
4 changed files with 39 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,34 @@
class YAS_LocalMessage extends Object
abstract;
var const String PlayersDefault;
var private localized String Players;
var const String SpectatorsDefault;
var private localized String Spectators;
enum E_YAS_LocalMessageType
{
YAS_Players,
YAS_Spectators
};
public static function String GetLocalizedString(E_YAS_LocalMessageType LMT)
{
switch (LMT)
{
case YAS_Players:
return (default.Players != "" ? default.Players : default.PlayersDefault);
case YAS_Spectators:
return (default.Spectators != "" ? default.Spectators : default.SpectatorsDefault);
}
return "";
}
defaultproperties
{
PlayersDefault = "Players"
SpectatorsDefault = "Spectators"
}

View File

@ -1,6 +1,8 @@
class YAS_ScoreBoard extends KFGUI_Page class YAS_ScoreBoard extends KFGUI_Page
dependson(YAS_Types); dependson(YAS_Types);
const LocalMessage = class'YAS_LocalMessage';
const HeaderWidthRatio = 0.30f; const HeaderWidthRatio = 0.30f;
const PlayerListWidthRatio = 0.6f; const PlayerListWidthRatio = 0.6f;
const PlayerEntryHeightMod = 1.05f; const PlayerEntryHeightMod = 1.05f;
@ -50,8 +52,6 @@ var KFPlayerController OwnerPC;
var Color PingColor; var Color PingColor;
var float PingBars; var float PingBars;
var localized String Players, Spectators;
// Cache // Cache
var public Array<YAS_RepInfoPlayer> RepInfos; var public Array<YAS_RepInfoPlayer> RepInfos;
@ -430,7 +430,9 @@ function DrawMenu()
*/ */
Canvas.SetDrawColorStruct(Settings.Style.PlayerCountTextColor); Canvas.SetDrawColorStruct(Settings.Style.PlayerCountTextColor);
S = Players $ ":" @ NumPlayer @ "/" @ KFGRI.MaxHumanCount $ " " $ Spectators $ ": " $ NumSpec; ; S = LocalMessage.static.GetLocalizedString(YAS_Players) $ ":"
@ NumPlayer @ "/" @ KFGRI.MaxHumanCount $ " "
$ LocalMessage.static.GetLocalizedString(YAS_Spectators) $ ": " $ NumSpec; ;
Canvas.TextSize(S, XL, YL, FontScalar, FontScalar); Canvas.TextSize(S, XL, YL, FontScalar, FontScalar);
DrawTextShadowHLeftVCenter(S, BoxX + EdgeSize, YPos, BoxH, FontScalar); DrawTextShadowHLeftVCenter(S, BoxX + EdgeSize, YPos, BoxH, FontScalar);