Author: jerome
Date: 2009-09-10 12:37:06 +0200 (Thu, 10 Sep 2009)
New Revision: 5349

Modified:
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
Log:
* Getting used language in the Registery.

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
      2009-09-10 10:09:14 UTC (rev 5348)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/TuxUtils.pas
      2009-09-10 10:37:06 UTC (rev 5349)
@@ -53,6 +53,7 @@
     function GetProgramFilesDir() : string;
     function GetTuxDroidDataBaseDirectory() : string;
     function GetTuxDroidBinariesDirectory() : string;
+    function getRegisteryLanguage(): string;
 
 var
   XmlScanner1 : TXmlScanner;
@@ -506,4 +507,32 @@
  result := TuxUtils.GetProgramFilesDir + '\Kysoh\Tux Droid\bin';
 end;
 
+function getRegisteryLanguage(): string;
+const
+  TUXDROID_REGISTRY_PATH = 'SOFTWARE\Tux Droid\Installation';
+begin
+  with TRegistry.Create do
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+
+      // From Tuxdroid setup
+      if OpenKey(TUXDROID_REGISTRY_PATH, False) then
+      begin
+        // Get tuxdroid installation language
+
+        result := ReadString('Language');
+
+        if ( result <> 'en' ) and (result <> 'en_US') and (result <> 'en_GB') 
and (result <> 'fr')
+         and(result <> 'nl') and (result <> 'nl_BE') and (result <> 'it') and 
(result <> 'es')
+         and(result <> 'de') and (result <> 'ar') and (result <> 'da') and 
(result <> 'sv')
+         and(result <> 'no') and (result <> 'pt' ) then
+          result := 'en';
+
+        CloseKey;
+      end;
+    finally
+      Free;
+    end;
+end;
+
 end.

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
 2009-09-10 10:09:14 UTC (rev 5348)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Unit1.pas
 2009-09-10 10:37:06 UTC (rev 5349)
@@ -43,9 +43,9 @@
   SCREEN_3 = 'Connect the fish dongle to an available USB port on your 
computer using' +
              ' the included USB cable.';
 
-  SCREEN_4 = 'Wait a moment and the blue LED''s in the dongle and Tux Droid 
should be lit.' +
-             ' This indicates Tux Droid is detected by the dongle and Tux 
Droid is ready to' +
-             ' communicate with your computer';
+  SCREEN_4 = 'Wait a moment and the blue LED''''s in the dongle and Tux Droid 
should be lit. ' +
+             'This indicates Tux Droid is detected by the dongle and Tux Droid 
is ready to ' +
+             'communicate with your computer';
 
   SCREEN_5 = 'Everything is set up to test your configuration. Click the Test 
button' +
              ' to start the test.';
@@ -218,12 +218,15 @@
 procedure TForm1.FormCreate(Sender: TObject);
 begin
   //Creating gnugettext object.
-  gnugettext.UseLanguage('en');
+
+  try
+    gnugettext.UseLanguage(TuxUtils.getRegisteryLanguage());
+  except
+    gnugettext.UseLanguage('en');
+  end;
+
   TranslateComponent(self);
 
-  if ParamCount > 0 then
-    gnugettext.UseLanguage(ParamStr(1));
-
   //Setting up steps text.
   ScreenText1.Caption := gettext(SCREEN_1);
   ScreenText2.Caption := gettext(SCREEN_2);


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to