hedgewars/uLocale.pas
changeset 83 207c85fbef51
parent 82 2f4f3236cccc
child 108 08f1fe6f21f8
equal deleted inserted replaced
82:2f4f3236cccc 83:207c85fbef51
    33 
    33 
    34 unit uLocale;
    34 unit uLocale;
    35 interface
    35 interface
    36 type TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
    36 type TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
    37                    sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
    37                    sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
    38                    sidDynamite, sidBaseballBat, sidFirePunch);
    38                    sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds);
    39      TMsgStrId = (sidStartFight, sidSeconds);
    39      TMsgStrId = (sidStartFight, sidDraw, sidWinner);
    40 var trammo: array[TAmmoStrId] of shortstring;
    40 var trammo: array[TAmmoStrId] of shortstring;
    41     trmsg: array[TMsgStrId] of shortstring;
    41     trmsg: array[TMsgStrId] of shortstring;
    42 
    42 
    43 procedure LoadLocale(FileName: string);
    43 procedure LoadLocale(FileName: string);
       
    44 function Format(fmt: shortstring; var arg: shortstring): shortstring;
    44 
    45 
    45 implementation
    46 implementation
    46 uses uMisc;
    47 uses uMisc;
    47 
    48 
    48 procedure LoadLocale(FileName: string);
    49 procedure LoadLocale(FileName: string);
    74       end;
    75       end;
    75 closefile(f)
    76 closefile(f)
    76 {$I+}
    77 {$I+}
    77 end;
    78 end;
    78 
    79 
       
    80 function Format(fmt: shortstring; var arg: shortstring): shortstring;
       
    81 var i: integer;
       
    82 begin
       
    83 i:= Pos('%1', fmt);
       
    84 if i = 0 then Result:= fmt
       
    85          else Result:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
       
    86 end;
       
    87 
    79 end.
    88 end.