DFHumanize library for Delphi

DFHumanize library for Delphi

Aug 05, 2026

image

Features

  • Relative dates: 3 hours ago, yesterday, 2 days from now

  • String humanize: OrderStatusCodeOrder status code

  • Numbers to words (English / Turkish)

  • Byte sizes: 15360001.5 MB

  • Lists: A, B and C / A, B ve C

  • Non-visual + visual components on the DF Humanize palette

  • Cultures: hcAuto, hcEnglish, hcTurkish


Install

  1. Open Packages\DFHumanize.groupproj in Delphi.

  2. Build DFHumanize (runtime package).

  3. Build dclDFHumanize (design package).

  4. Component → Install Packages → Add
    select: Lib\Win32\Release\dclDFHumanize.bpl

  5. (Recommended) Add to Library path:
    ...\DelphiHumanizer\Lib\Win32\Release

Components appear under palette group DF Humanize.

Optional demo: Demo\DFHumanizeDemo.dproj


Components

Non-visual

ComponentDescriptionTDFHumanizerCentral culture / helpers / AboutTDFHumanizeDateRelative date as TextTDFHumanizeNumberNumber → words / ordinalTDFHumanizeBytesFile size text

Visual

ComponentDescriptionTDFHumanizeLabelLabel with auto-refresh (dates)TDFHumanizeStatusPanelStatus strip: Last update: 12 minutes ago


Code API examples

uses
  System.SysUtils,
  System.DateUtils,
  DFHumanize,
  DFHumanize.Types;

Dates

// English
ShowMessage(Humanize.DateTime(IncHour(Now, -3), hcEnglish));
// -> 3 hours ago

ShowMessage(Humanize.DateTime(IncDay(Now, 1), hcEnglish));
// -> tomorrow

// Turkish
ShowMessage(Humanize.DateTime(IncHour(Now, -3), hcTurkish));
// -> 3 saat önce

ShowMessage(Humanize.DateTime(IncDay(Now, -1), hcTurkish));
// -> dün

// Auto = OS UI language
ShowMessage(Humanize.DateTime(IncMinute(Now, -12), hcAuto));

Strings

ShowMessage(Humanize.StringValue('OrderStatusCode'));
// -> Order status code

ShowMessage(Humanize.StringValue('dash-separated-name', lcTitleCase));
// -> Dash Separated Name

ShowMessage(Humanize.Dehumanize('order status code'));
// -> OrderStatusCode

ShowMessage(Humanize.Truncate('Long text to truncate', 10));
// -> Long text…

Numbers

ShowMessage(Humanize.Number(1234, hcEnglish));
// -> one thousand two hundred thirty-four

ShowMessage(Humanize.Number(1234, hcTurkish));
// -> bin iki yüz otuz dört

ShowMessage(Humanize.Ordinal(21, hcEnglish));
// -> 21st

ShowMessage(Humanize.Ordinal(21, hcTurkish));
// -> 21.

ShowMessage(Humanize.Quantity(3, 'file', 'files', hcEnglish));
// -> 3 files

ShowMessage(Humanize.Quantity(3, 'dosya', '', hcTurkish));
// -> 3 dosya

Bytes & lists

ShowMessage(Humanize.Bytes(1536000));
// -> 1.5 MB

ShowMessage(Humanize.List(['Ankara', 'Izmir', 'Bursa'], hcEnglish));
// -> Ankara, Izmir and Bursa

ShowMessage(Humanize.List(['Ankara', 'Izmir', 'Bursa'], hcTurkish));
// -> Ankara, Izmir ve Bursa

About

ShowMessage(Humanize.Version);
// -> 1.0.0

ShowMessage(Humanize.AboutText);
// -> DFHumanize 1.0.0 - DelphiFan <[email protected]> - https://delphifan.com


Download link : https://github.com/delphifanforum/DFHumanize

Gefällt dir dieser Beitrag?

Kaufe DelphiFan Forum einen Kaffee

Mehr von DelphiFan Forum