Embed Notice
HTML Code
Corresponding Notice
- Embed this noticebut if this is the best way to do this I hate it
program Hello;
type
greeting = record
lang, str: string;
end;
greetings = array of greeting;
const
TXT: greetings = (
(lang: 'pl'; str: 'Ahoj, przygodo!'),
(lang: 'en'; str: 'Hello world')
);
CFGFILE = 'config';
{----------------------------------------------------------------------}
function config(fn: string): string;
var
f: text;
begin
assign(f, fn);
reset(f);
read(f, config);
close(f);
end;
{main------------------------------------------------------------------}
var
lang: string;
g: greeting;
begin
lang := config(CFGFILE);
for g in TXT do begin
if g.lang = lang then begin
writeln(g.str);
break;
end;
end;
end.