equal
deleted
inserted
replaced
18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 |
20 |
21 unit uLocale; |
21 unit uLocale; |
22 interface |
22 interface |
23 uses uTypes; |
23 uses uTypes{$IFNDEF PAS2C}, gettext{$ENDIF}; |
24 |
24 |
25 const MAX_EVENT_STRINGS = 100; |
25 const MAX_EVENT_STRINGS = 100; |
26 |
26 |
27 procedure LoadLocale(FileName: shortstring); |
27 procedure LoadLocale(FileName: shortstring); |
28 function Format(fmt: shortstring; var arg: shortstring): shortstring; |
28 function Format(fmt: shortstring; var arg: shortstring): shortstring; |
30 function GetEventString(e: TEventId): ansistring; |
30 function GetEventString(e: TEventId): ansistring; |
31 |
31 |
32 {$IFDEF HWLIBRARY} |
32 {$IFDEF HWLIBRARY} |
33 procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export; |
33 procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export; |
34 {$ENDIF} |
34 {$ENDIF} |
|
35 |
|
36 {$IFNDEF PAS2C}var locMOFile: TMOFile;{$ENDIF} |
35 |
37 |
36 implementation |
38 implementation |
37 uses uRandom, uUtils, uVariables, uDebug, uPhysFSLayer; |
39 uses uRandom, uUtils, uVariables, uDebug, uPhysFSLayer; |
38 |
40 |
39 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring; |
41 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring; |
49 for e:= Low(TEventId) to High(TEventId) do |
51 for e:= Low(TEventId) to High(TEventId) do |
50 first[e]:= true; |
52 first[e]:= true; |
51 |
53 |
52 f:= pfsOpenRead(FileName); |
54 f:= pfsOpenRead(FileName); |
53 TryDo(f <> nil, 'Cannot load locale "' + FileName + '"', false); |
55 TryDo(f <> nil, 'Cannot load locale "' + FileName + '"', false); |
|
56 |
|
57 {$IFNDEF PAS2C} |
|
58 locMOFile:= TMOFile.Create('/home/r/dev/hw/.hg-gettext_build/share/hedgewars/Data/Locale/de.mo'); |
|
59 {$ENDIF} |
54 |
60 |
55 s:= ''; |
61 s:= ''; |
56 |
62 |
57 if f <> nil then |
63 if f <> nil then |
58 begin |
64 begin |