AsfComponents 1.03

 

ASF Component Palette for Delphi 6 Applications

 

Please, forgive our not well English one.

 

History

 

1.00: 03/01/2002: First Release.

1.01: 03/06/2002: Solver Bug in win NT "Access Violation in Ntdll.dll"

1.02: 03/18/2002: Remove not used variables in 1.01; Notification is added for resolve an    access violation on destroy reference server; Destroy component access violation resolved.

1.03: 05/18/2002: Make AsfComponents where AsfLocalize just included.

 

Components

 

  1. TAsfLocalizeClient and TAsfLocalizeServer.

 

The objective of this components is to allow in a simple way the internationalization, globalization or localization of applications created with Delphi 6. 

It allows the translation of the " Caption ", Texts, etc. according to an selected language and that it can produce the developer like the final user. 

It includes an editor of languages and it allows the language change in runtime (on fly). 

It is based on the string and not in the individual components for what requires very little work to define new values for each language to use. 

Works with Forms, QuickReport and FastReport. 

Translates messages, lists, columns in your grid, reports, etc.. 

The resources characteristic of Delphi are not translated, but for it Delphi has the necessary tools.

 

2.    TAsfTimer.

 

AsfTimer is a thread timer for multiple purpose.

 

3.    TAsfKeyPad.

 

AsfKeyPad allows to create a visible keyboard with different Layouts (Telephone, Normal Calculator, Administrative Calculator, PC KeyBoard). AsfKeyPad generates an event when a key is pressed, returning the necessary data as to identify the same one.

 

4.    TAsfDigit.

 

AsfDigit is a visual component that shows a leds digit.

 

5.    TAsfDigitPanel.

 

AsfDigitPanel is a visual component that shows a panel of digits (TAsfDigit) with characteristic special that allow to send him direct data to show.

 

6.    TAsfTapeDisplay.

 

AsfTapeDisplay represents a small printer of paper ribbon (of the type used in administrative calculators).

 

7.    TAsfCalcUnit.

 

AsfCalcUnit is a non visual component that is in charge of solving operations according to the elected way. It was thought mainly to solve mathematical operations starting from the entrance of loose characters. It possesses exits for different types of components.

 

8.    TAsfCalculator.

 

AsfCalculator is a non visual component that when calling to the method Execute, a calculator that can be administrative or normal rises (according to a property). This component returns the final value that is shown in the display. 

 

Tested With:

 

Delphi 6 Enterprise Update 2.

 

Way of Operation

 

This system is based on two non visual components AsfLocalizeServer and AsfLocalizeClient. 

 

An only Server will be enough for an entire application that works entire under oneself language, however, is possible to use several of them if it was sought to work with different languages according to the part of the application. 

 

The first thing that it is necessary to make is to hit a Server in a Form or DataModule of the application (preferably the main). 

 

Then, a Client will stick in each Form, DataModule, etc that is used in the application. It doesn't care if the Form, for example, is believed in automatic form or by means of code. 

 

To each Client is defined the property LocalizeServer pointing to the Server placed before pasted. When a Client is in a different unit that the Server, will have to place the main unit in you use clause. 

 

When everything is clever and if the Server has the property Active in True and Language in "Default", then when calling to the method SetGetAllProperties in a Client they will take all the visual string of the components in the Form, for example, where Client is hit. These string will be written in special files of dictionary of the style ini but with the extension lng. For each string type a section different from the file is used (Caption, Text, Hint, etc). Initially the system will create a Dictionary Default, but with the included editor's help, you will be able to create the dictionaries that wants. When a new component is added in the Form the entrance it will be created for its string in automatic form in all the registered dictionaries. 

 

The existent languages register in Windows Registry and the included editor allows to make it. There is also a method for it. 

 

The following step is that you define that wants that appears as string for each visual element (according to the one that before had, not depending on the component but of the string). For the included editor of languages it uses it. 

 

Important: 

 

When one chooses a language in the editor included and/or a folder of languages a mark it is left in the Registry that then the system uses to pull up the applications with those parameters. If you make an application that allows the user to change the language on fly, the last one used it will be the outburst language. 

Remember that these data, in the same way registrations of existent languages likewise they will be valid for all the applications that you run in that PC and the component ASFLocalize use.   

 

Properties, Methods and Events (Server)

 

Properties

Description

Active: Boolean

It defines if the localization Server will record and/or he will read data in or of the dictionaries. If it Active = false although calls to methods of translation they won't have effect.

DicPath: String

I walk (Path) to the folder where they are the dictionaries of languages. Without the \ (slash) in the end. The used Path is engraving in the Registry for what doesn't need to be loaded every time. It can be changed with the Included Editor.

Language: String

Here it is chosen among the registered languages. When calls himself to a method of translation the selected language it will be used. In the measure that you add more dictionaries to the system, the corresponding languages will be available to be selected. Remember that to load the initial data automatically in the dictionaries Language it will be in " Default " and Active in true. When the language is changed, automatically they will be reflected the changes in the application.

Languages: TStringList

Not published property (but public) that represents a list of the registered Languages.

 

 

Procedures

 

PutListProperty(List, ViewList: TStringList)

Only for internal use.

RegisterClient(AClient: TComponent)

Only for internal use.

UnRegisterClient(AClient: TComponent)

Only for internal use.

CreateLanguageMenu(Item: TMenuItem; Default, BitMaps: Boolean)

In Item spends a TMenuItem that you create, habitually inside the main menu, for example, "Languages". This procedure will create a sub menu with the available languages to allow the Final User to choose the one that prefers. If Default is true, it implies that in the menu one will be able to select Default like language. If BitMaps is true the BitMaps they will be seen in the menu, otherwise they won't be visible.

SetNewLanguage(Lang: String; Image: TBitMap)

It generates a new group of language files * .lng and * .bmp. Lang will be the name of the language (automatically it converts to capital the first letter and to minuscule the rest). Image should be a bmp that will be used to create flags for example in the automatic menu of languages. The name of created files is generated by a special method to avoid problems with the operating system one and to help to prevent the final user to publish the same ones. The new language incorporates to the Registry.

RegisterLanguages

It registers in the Registry all the languages that finds in the folder indicated in DicPath.

DeleteLanguage(Lang: String)

It erases a given language completely, as much the files as the entrance in the Registry.

SetItem(Section, Item, Value: String)

It places the value for the Section and Item chosen for the current language.

SetImage(Image: TBitMap)

It places the image for the current language Image. This image is used in the menu of languages.

AddToDictionaries(Section, Item, Value: ShortString)

Adds the section, Item and Value to all the languages. If is defined an existent Item won't be changed the value with this procedure. Use for it SetItem (). If the section or the Item already exist they are not added again. For defect, a new Item will take the value similar to the Item.

DeleteDictionaryItem(Section, Item: String)

It erases a certain Item of the suitable section for all the languages.

DeleteDictionarySection(Section: String)

It erases a certain section of all the languages.

SetGetAllProperties(Sender: Tobject; Lang: String; Write: Boolean; NoLocalize: TStrings)

This procedure in fact should not be used directly. It is called internally by the Client.

 

 

Functions

 

Msg(MessageStr: String; Values: Array of String): String

This function returns a string that is formed with Message and where Message has variables they will be replaced by Values. Ej. Message := Msg (' Today is "%1" at "%2" hours', [DateToStr(Date), TimeToStr(Time)]); If Language was prepared this way: Now it is the "%2" of the "%1", then the function will return the final message with the inverted parameters.

GetLanguageFileName(Language: String): String

This function returns the name and Path of the file of the suitable language.

GetString(Section, Item: String): String

It returns the string that represents the value of a property for the section and indicated Item. This happens for the current language.

GetClients: TStringList

Return the connected Clients to this Server.

GetSections(List: TStrings): Boolean

Get in List all the names of the sections that form a dictionary of languages (Captions, Text, etc.). it Returns true if could read the list and false if it failed.

GetActualImage(Image: TBitMap): Boolean

Get in Image the image bmp for the current language. If finds the appropriate image it returns true. If there is not a defined image or doesn't find it will bring an empty image and it returns false.

GetItem(Section, Item: String): String

It returns the value (string) corresponding to the Section and sent Item. If it is not opposing the value returns an empty string.

GetItems(Section: String; List: TStrings): Boolean

Get in List all the Item for a given section. True returns if it achieved it or False if it failed.

 

 

Events

 

OnLanguageChange: TNotifyEvent

It happens when it is changed language during the execution of the application.

OnLanguageMenuClick: TNotifyEvent

It happens when the Final User makes click in an option of the sub menu of languages. For it, call should be had CreateLanguageMenu () previously, habitually in the beginning of OnFormShow. If  makes TMenuItem(Sender) .Caption inside this event will obtain the elected language for the User.

 

Properties, Methods and Events (Client)

 

Properties

Description

LocalizeServer

Choose the Server here to which the Client will connect.

NoLocalize

Here is defined a list of components (your name) in this Form whose string should not be translated (Exceptions).

 

 

Procedures

 

SetGetAllProperties

Writes all the string in the dictionaries if Server.Active is True and Server.Language it is Default. Read and it loads the string from the Language selected to the components (Translates). This procedure habitually is placed in OnShow for Forms, BeforePrint in the case of QuickReport. It is not usually used in DataModules. A DataModule doesn't show anything but it can use the function msg to translate messages. If the language used on fly is changed then it won't be necessary to already call to this method for the Forms created. When changing the language, automatically a sweeping of all the Clients takes place and calls himself to this procedure in automatic form.

PutListProperty(List, ViewList: TStringList)

This procedure allows to translate clever as in the case of the memos of FastReport. For example, in the case of FastReport you can use in OnBeforePrint where List = Memo and ViewList = View.Memo.

 

 

Functions

 

Msg(Message: String; Values: Array of String): String

This function returns a string that is formed with Message and where Message has variables they will be replaced for your Value. E.g. Message := Msg (' Today is "%1" at "%2" hours', [DateToStr(Date), TimeToStr(Time)]) ;If Language was prepared this way: Now it is the "%2" of the "%1", then the function will return the final message with the inverted parameters.

GetString(Section, Item: String): String

Given a section of the dictionaries (Caption, Text, etc) and an Item (for example: Button1) it will return the translation for the current language.

 

 

Installation

 

To install this package in Delphi 6, follow the following steps:

 

*  The .zip of the package decompress in a folder.

*  Run Delphi.

* Choose the option of the menu: Tools | Environment Options | Library and add in Library Path the Path to the folder that has created for Localize.

*  Make File | Open and choose ASFLocalize.dpk.

*  Make Click in it Compiles and then in Install.

* Two warnings will appear. This is because the package installs in form implicit two units. Don't worry.

*  It can already begin to use ASFLocalize.

* Remember that there are five folders that have been created where you installed ASFLocalize that are of a lot of help. In Demo will find a project that allows to see like ASFLocalize works and in Editor will find an editor of languages that besides helping to understand like the methods and properties are used it works to Edit. In Help will be able to consent to the whole help in English and Spanish. In Languages will find that they are the language files for the demo. In Images will find some flags to use.

* When has everything installed, begin to call to the editor and to define the folder of languages to Languages so that then the demo can work. Make Languages then | Refresh Languages, this registers the opposing languages.

License

 

Read carefully the file Readme.txt that accompanies our package.

 

History

 

1.0 : 03/01/2002: First Release.

1.01: 03/06/2002: Solver Bug in win NT "Access Violation in Ntdll.dll"

1.02: 03/18/2002: Remove not used variables in 1.01; Notification is added for resolve an    access violation on destroy reference server.

 

As contacting us

 

Site:         http://www.asfcompu.com

Email:       Shareware@asfcompu.com