  GLang

  Autor   : (c) Jose M Gias
  email   : sigekom@arrakis.es
            http://www.arrakis.es/~sigecom

  Date    : 04/19/1999
  Version : 2.1 Freeware


  Delphi 2,3,4

  Unit    :  F_Lang.Pas  (Source Code +
                         6 Languages or unlimited for Soft Change+ 
                         Translator Project - Idioma32.Dpr)

  Commentaries in English and Espaol

English
--------------------------------------------------------------------------------
Utilization license.
--------------------

This component can be used, be distributed and be modified freely for use
particular or didactic, but not for commercial use. For commercial use be put
in touch with the author.

This component can be put on the page WEB that is wished, be redistributed
with an application freely, or be included in any book, CDROM or any other
middle, as long as is included 100% of the content of the component.

To be Freeware, they are not offered guarantees of no class neither are admitted
claims of no type.

It will be thanked the one which any commentary, alteration or improvement
introduced in the component is transmitted to the author.

Installation
-----------
To copy the files in a directory.

It is included the project GLang as Demo of operation and the project Idioma32
as application of translation, guided to be delivered to the persons that 
accomplish the translation of the programs.

Unit F_LANG
-----------
The unit F_LANG.PAS, it contains the necessary functions to obtain the strings
of the components of an Form and to write them in a table in the language field
indicated. For defect table will be called GLang.Dbf and will be kept in the
directory in which take-off the application, but we can incorporate it into an
Alias instead of indicating to you a directory.

In principle this preparation for English, Spanish, Italian, German, French, 
Portuguese, but enough with adding or erasing language fields in table so that 
it is adapted to our needs.

Table by defect is .Dbf, but is wished enough with indicating a  table
with extension .Db so that it will be Paradox, in the variable FicLang.

To generate initial table one must to call to the procedure 'DbfStringComponen
an alone time, and automatically will create table that we indicate to you in
the language elected. If we indicate 'All' will fill all the fields. There is
no limit of quantity of form incorporated to table, enough with calling to this
procedure once by each created Form and will add the data of the same. As option
can be to add the properties that  they do not contain text or re to write them

Also it incorporates the necessary functions to recover the stored String
in table and to return them to our Form in the language that we indicate to you.
For this enough with calling to the procedure 'LangDbfComponent'

They are captured the following properties: Hint, Caption, Title, DisplayLabel,
Lines, Items, Pages, Tab

Utilization summary for a new application
-----------------------------------------

1. To copy the file F_lang.Pas in the directorate of the application or in \Delphi\lib
2. To include F_LANG in the Interface - Uses of the Form that it accomplish calls
   to the functions 'DbfStringComponent' or 'LangDbfComponent'
3. To indicate in the variable FicLang the name and extension of table to create
4. When the application be ended, called to the procedure DbfStringComponent
   in design time to create table for the first time .
5. To translate the languages table
4. To call in time of RunTime to the function LangDbfComponent in the event
   OnCreate or when it is needed, to recover the string of the wished language


Examples of call:
--------------------------------------------------------------------------------
// Call to add the data in GLang.dbf
procedure TForm1.Button2Click(Sender: TObject);
var
 Dir : String;
begin

 Dir := ExtractFilePath(ExpandFileName('F_Lang.Dcu')); // Sample
 if Dir[Length(Dir)] <> '\' then Dir := Dir + '\';

 FicLang := 'GLang.Dbf';
 with Table1 do begin
  DatabaseName := Dir;         {Alias}
  TableName    := FicLang;
  IndexName    := 'Objeto';

  IfExistsTable(Table1, Dir, FicLang); {procedure of F_Lang. If not Exists FicLang, Make file}
  Open;
 end;

 // To capture the string of the components
 DbfStringComponent(Table1, // Data Table
                    Form1,  // Form of where they are captured the string
                    Dir,    // DatabaseName, o directory of de application
                    'ALL',  // Languages that will fill in table. SP,IT,EN,DE,FR,PO,ALL)
                    True,   // To write the Strings in White
                    False;) // ReWrite existing String in table

 // As of here it can be called to the procedure as many times as Form they may
 // have been created with precedence, or well to create them, to call to the
 // function and to eliminate them subsequently. This alone will be necessary to
 // accomplish it an alone time in design time.

 DbfStringComponent(Table1, FmAbout, Dir, 'EN', False, False);
 .....
 .....
 .....

 ShowMessage('Process Finish');
end;

--------------------------------------------------------------------------------
//  Call to recover the String from a language of table
procedure TForm1.Button3Click(Sender: TObject);
begin
 LangDbfComponent(Table1, // Data table
                  Form1,  // Form of the that will be obtained the data
                  'SP');  // Language that will retrieve from the table. EN,SP,IT,DE,FR,PO
 end;

--------------------------------------------------------------------------------

Espaol
--------------------------------------------------------------------------------

Licencia de utilizacin.
------------------------
Este componente puede usarse, distribuirse y modificarse libremente para uso
particular o didctico, pero no para uso comercial. Para uso comercial ponerse
en contacto con el autor.

Este componente puede ponerse en la pgina WEB que se desee, redistribuirse con
una aplicacin libremente, o incluirse en cualquier libro, CDROM o cualquier
otro medio, siempre que se incluya el 100% del contenido del componente.

Al ser Freeware, no se ofrecen garantas de ninguna clase, ni se admiten
reclamaciones de ningun tipo.

Se agradecer el que cualquier comentario, correccin o mejora introducida en
el componente se remita al autor.

Instalacin
-----------
Copiar los ficheros en un directorio.

Se incluye el proyecto GLang como Demo de funcionamiento y el proyecto Idioma32
como aplicacin de traduccin, orientada a ser entregada a las personas que 
realicen la traduccin de los programas.

Unit F_Lang
-----------
La unit F_Lang.Pas, contiene las funciones necesarias para obtener las strings
de los componentes de un Form y escribirlas en una tabla en el campo del lenguaje
indicado. Por defecto la tabla se llamar GLang.Dbf y se guardar en el
directorio en que arranque la aplicacin, pero podemos incorporarla a un Alias
en lugar de indicarle un directorio.

En principio esta preparado para Ingles, Espaol, Italiano, Aleman, Frances y 
Protugues, pero basta con aadir o borrar campos de idioma en la tabla para que 
se adapte a nuestras necesidades.

La tabla por defecto es .Dbf, pero si se desea basta con indicar una tabla
con extensin .Db para que sea Paradox, en la variable FicLang.

Para generar la tabla inicial hay que llamar al procedimiento 'DbfStringComponent'
una sola vez, y automticamente crear la tabla que le indiquemos en el idioma
elegido. Si indicamos 'All' rellenar todos los campos. No hay lmite de
cantidad de form incorporados a la tabla, basta con llamar a este procedimiento
una vez por cada Form creado y aadir los datos del mismo. Como opcin se pueden
aadir las propiedades que no contengan texto o reescribirlas

Tambin incorpora las funciones necesarias para recuperar las String almacenadas
en la tabla y devolverlas a nuestro Form en el idioma que le indiquemos. Para
ello basta con llamar al procedimiento 'LangDbfComponent'

Se capturan las siguientes propiedades: Hint, Caption, Title, DisplayLabel,
Lines, Items, Pages, Tab

Resumen de utilizacin para una nueva aplicacin
------------------------------------------------

1. Copiar el fichero F_lang.Pas en el directorio de la aplicacin o en \Delphi\Lib
2. Incluir F_Lang en la clasula Interface - Uses del Form que realize llamadas
   a las funciones 'DbfStringComponent' o 'LangDbfComponent'
3. Indicar en la variable FicLang el nombre y extensin de la tabla a crear
4. Cuando la aplicacin est terminada, llamar al procedimiento DbfStringComponent
   en tiempo de diseo para crear la tabla por primera vez.
5. Traducir la tabla de idiomas
4. Llamar en tiempo de RunTime a la funcin LangDbfComponent en el evento
   OnCreate o cuando se necesite, para recuperar las string del idioma deseado

Ejemplos de llamada:
--------------------------------------------------------------------------------
// Llamada para aadir los datos en Lang.dbf

procedure TForm1.Button2Click(Sender: TObject);
var
 Dir : String;
begin

 Dir := ExtractFilePath(ExpandFileName('F_Lang.Dcu'));
 if Dir[Length(Dir)] <> '\' then Dir := Dir + '\';

 FicLang := 'GLang.Dbf';
 with Table1 do begin
  DatabaseName := Dir;         {Alias}
  TableName    := FicLang;
  IndexName    := 'Objeto';

  IfExistsTable(Table1, Dir, FicLang); {Procedimiento de F_Lang. Si no existe FicLang, 
                                        crea el fichero}
  Open;
 end;

 // Capturar los textos de los componentes
 DbfStringComponent(Table1, // Tabla de Datos
                    Form1,  // Form de donde se capturan los datos
                    Dir,    // DatabaseName, o directorio de la aplicacin
                    'ALL',  // Idiomas que rellenar en la tabla. EN,SP,IT,DE,FR,PO,ALL (Todos)
                    True,   // Grabar los Strings en Blanco
                    False;) // Sobreescribir las String existentes en la tabla.

 // A partir de aqu se puede llamar al procedimiento tantas veces como Form
 // se hayan creado con anterioridad, o bin crearlos, llamar a la funcin y
 // eliminarlos seguidamente. Esto solo ser necesario realizarlo una sola vez
 // en tiempo de diseo.

 DbfStringComponent(Table1, FmAbout, Dir, 'EN', False, False);
 .....
 .....
 .....

 ShowMessage('Proceso terminado');
end;

--------------------------------------------------------------------------------
// Llamada para recuperar los String desde un idioma de la tabla
procedure TForm1.Button3Click(Sender: TObject);
begin
 LangDbfComponent(Table1, // Tabla de datos
                  Form1,  // Form del cual se obtendrn las string de los componentes
                  'SP');  // Lenguaje que se recuperar de la tabla. EN,SP,IT,DE,FR,PO
end;

