NumWords - Developer's Source Code Map.

By Andy Preston, Apollo Developments


Demo.dpr

the demo program, a good place to start.


Demo1.pas

the main unit of the demo program.

By default NumWord's will use the local language and country information obtained from Windows.

In:

Procedure TForm1.FormShow (Sender : TObject);
You can un-comment this line:
InWords.SelectLocale (CTRY_AUSTRIA, LANG_GERMAN, useEuro);
and experiment with other countries / languages, if you leave this line commented out, numwords will work in the user's default locale.


Numwords.pas

This is the code that set's up the local language / currency information

This is where

Procedure TNumWords.SelectLocale (CountryCode, LanguageCode : Integer; EuroMode : Boolean);
can be found. If you want to add new languages you'll need to add another
LANG_XXXXX : LanguageDriver:=TNumWordsXXXXX.Create (CountryCode, EuroMode);
line to this procedure

If you want to add a language driver you'll also have to add your language driver's unit name to the Implementation section's Uses clause, as with NumW_Eng, NumW_Deu, NumW_Esp, NumW_Ita in the current unit.


Numw.pas

The base class for the language drivers.

To add support for a new country, you will need to look at:

Constructor TNumWordsLangDriver.Create (CountryCode : Integer; EuroMode : Boolean);
and add some new code to the switch statement like:
  CTRY_UNITED_KINGDOM : Begin
    CurrencyGender := genNeuter; // No gender in English
    BigSing := 'Pound';
    BigPlural := 'Pounds';
    SmallSing := 'Penny';
    SmallPlural := 'Pence';
  End;
These variables are part of the TNumWordsLangDriver class and are used to return a currency value in words.


Function TNumWordsLangDriver.EMoneyInWords (TheAmount : Extended) : String;
Isn't very well written, I'd be much happier using Marco Bianchini's code in his original bVerbose component, what do you think Marco?


NumW_Deu.pas
NumW_Eng.pas
NumW_Esp.pas
NumW_Ita.pas
NumW_Fra.pas
NumW_Trk.pas

These are the actual language driver classes

TNumWordsEnglish, TNumWordsDeutch, TNumWordsEspanol, TNumWordsItaliano, TNumWordsFrancais, & TNumWordsTurkish are dervied from TNumWordsLangDriver (in Numw.pas). They are the language-specific parts on NumWords

These classes override the virtual functions:

Function NumberInWords (TheNumber : Integer) : String;
Function IMoneyInWords (Major, Minor : Integer) : String;
These functions do the actual conversion work.


In the original source code for the non-English language drivers that has been borrowed from other programmers, there is no code for :

Function IMoneyInWords (Major, Minor : Integer) : String;
this still needs to be added to NumW_Esp.pas for full Espanõl support.
This routine is also untested for NumW_Ita.pas & NumW_Fra.pas so Italiano & Français support is Beta.

Andreas Schmidt has a good idea in:

Function TNumWordsDeutch.NumberInWords (TheNumber : Integer) : String;
The first line of his version of this function is:
If TheNumber<0 Then Result:='minus '+NumberInWords (-TheNumber)
The same 'easy way to get negative numbers' works in English too. Can it be added to Espanõl, Français & Italiano?


QRNumW.pas

All of the design time code for the Q.R. Component. To install the component in your VCL, install this file


QRCusDBT.pas

The plan was to make the component inherit from a mythical one something like a halfway point between TQRCustomLabel and TQRDBText. But no such component exists, so we've had to copy most of TQRDBText from the Q.R. Sources. The result, TQRCustomDBText, is in this file.


QRDBCash.pas

This is the actual code of the Q.R. component


Authors.htm

Author information


Numwords.htm

User Documentation


LGPL.htm
GPL.htm

User Licenses


This file is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.