File: unit17.pas

package info (click to toggle)
dozzaqueux 3.21-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,140 kB
  • sloc: pascal: 33,352; xml: 961; makefile: 38; sh: 17
file content (93 lines) | stat: -rwxr-xr-x 2,468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
unit Unit17; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls,UChaines,translations,UnitScaleFont;

type

  { Tsplashscreen }

  Tsplashscreen = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { private declarations }
    encreation:boolean;
  public
    { public declarations }
  end; 

var
  splashscreen: Tsplashscreen;
    Lang, FallbackLang: String;
implementation

{ Tsplashscreen }

procedure Tsplashscreen.FormCreate(Sender: TObject);
 var
      PODirectory: String;
      f:textfile;  nom_ini_file:string;
      label 1888;
    begin

      encreation:=true;
    lang:='';  FallbackLang:='';
    
       nom_ini_file:='~/.dozzzaqueux.ini';
      if not(fileexists(nom_ini_file)) then begin
        Lang:='fr_FR';  FallbackLang:='fr';
        goto 1888;
        end;
        assignfile(f,nom_ini_file);
        reset(f);
        readln(f,lang);
               readln(f,FallbackLang);
        closefile(f);
          {$IFDEF MSWINDOWS}
          PODirectory:=extractfilepath(application.ExeName)+'languages\';
        {$ELSE}
            PODirectory:='/usr/share/dozzaqueux/languages/';
        {$ENDIF}

      //GetLanguageIDs(Lang, FallbackLang); // dans l'unité gettext



      1888:
      TranslateUnitResourceStrings('LCLStrConsts', PODirectory + 'lclstrconsts.%s.po', Lang, FallbackLang);
      TranslateUnitResourceStrings('UChaines', PODirectory + 'dozzzaqueux.%s.po', Lang, FallbackLang);


 Caption := rsSplashscreen ;
 Label1.Caption := rsDozzzaqueux;
 Label2.Caption := rsLogicielLibr;
 Label3.Caption := rsVersion30Cod;
 Label4.Caption := rsParJeanMarie;


end;

procedure Tsplashscreen.FormShow(Sender: TObject);
begin
   if encreation then begin scalefont(self); encreation:=false; end;
   label1.Left:=(splashscreen.ClientWidth div 2)- (label1.Canvas.TextWidth(label1.Caption) div 2);
   label2.Left:=(splashscreen.ClientWidth div 2)- (label2.Canvas.TextWidth(label2.Caption) div 2);
   label3.Left:=(splashscreen.ClientWidth div 2)- (label3.Canvas.TextWidth(label3.Caption) div 2);
   label4.Left:=(splashscreen.ClientWidth div 2)- (label4.Canvas.TextWidth(label4.Caption) div 2);
end;

initialization
  {$I unit17.lrs}

end.