i18n Package
1.10
January 25, 2014
The i18n package is a library of Delphi components, classes, and procedures for assisting developers to fully and easily internationalize Delphi applications and change the locale of the applications on the fly.
There are many software tools for localizing a Delphi application, but they mostly just provide support for the translation of the user interface strings. However, the i18n package not only enables developers to select translatable properties and string constants/literals within the IDE but also takes care of plural forms, reading layout, formatting preferences, and the calendar system of the target language.
You want your application to be ready for right-to-left languages, but you do not know which language is right-to-left and even how it works. Don’t worry, the i18n package knows how to handle right-to-left languages. When the application’s locale changes, and whenever needed, the i18n package automatically mirrors the layout of the application’s forms according to the reading layout of the selected language. You do not need to write a single line of code or even modify it.
Delphi missed supporting bi-directional layout for most common controls. The i18n package workarounds this limitation and mirrors the layout of page and tab controls, tree views, list views, header controls, and status bars whenever needed.
Although the Gregorian calendar is the most used calendar in the world, if your application only supports this calendar, it cannot be truly localized for all countries/regions. The i18n package knows which calendar system is used by which country/region, and automatically displays and requests date-time values in the appropriate calendar. You do not need to have knowledge about different calendars, because your code still sees a standard TDateTime value. The following major calendars are implemented in the i18n package:
- The Gregorian Calendar
- The Hebrew or Jewish Calendar (הלוח העברי)
- The Hijri or Islamic Calendar (التقويم الهجري)
- The Jalali or Persian Calendar (گاهشمار جلالی)
- The Japanese Emperor Era Calendar
- The Julian Calendar
- The Korean Tangun Era Calendar
- The Taiwan calendar
- The Thai Buddhist Calendar
The i18n comes with some components to make the locale-dependent tasks easier. Here is the list of components/controls that you will have after installation of the package:
- TLocalizer
Provides the core functionality for localizing an application. - TTranslator
Maintains a list of translatable strings for a form, frame, data module, and so on. This component also translates the user interface strings and handles bi-directional mirroring of the controls. - TGoogleTranslator
This is an interface to the online Google translation service for automatic text translation. - TMessageDialog
Displays a localizable and customizable message dialog. - TInputQueryDialog
Displays a localizable input dialog box that lets the user enter a string, double, or integer. - TIntlDateTimeLabel
A label control that displays a fully localizable TDateTime value on a form. - TIntlMonthCalendar
A month calendar control to display a fully localizable calendar on a form. - TIntlDatePicker
A control that is designed specifically for entering localized dates. - TFlagImageList
A special image list component that provides country flag icons. - TImageLabel
A label control that can include an image on its face. - TCultureLabel
A label control to display the name and country flag of a culture (locale) on a form. - TCultureBox
A combo box control that represents a list of cultures (locales). - TCultureListBox
A list box control that represents a list of cultures (locales). - TCultureCheckListBox
A checklist box control that represents a list of cultures (locales). - TTerritoryLabel
A label control that displays the name and flag of a country/region on a form. - TTerritoryBox
A combo box control that represents a list of countries/regions. - TTerritoryListBox
A list box control that represents a list of countries/regions. - TTerritoryCheckListBox
A checklist box control that represents a list of countries/regions. - TCurrencyLabel
A label control that displays the name and country flag of a currency on a form. - TCurrencyBox
A combo box control that represents a list of currencies. - TCurrencyListBox
A list box control represents a list of currencies. - TCurrencyCheckListBox
A checklist box control that represents a list of currencies. - TDBImageLabel
A data-aware label control that displays the value of a field plus a custom icon on a form. - TDBCultureLabel
A data-aware label control that displays the value of a locale field. - TDBCultureBox
A data-aware combo box control that enables users to select the value of a locale field from a list of cultures (locales). - TDBCultureListBox
A data-aware list box control that enables users to select the value of a locale field from a list of cultures (locales). - TDBTerritoryLabel
A data-aware label control that displays the value of a country/region field. - TDBTerritoryBox
A data-aware combo box control that enables users to select the value of a country/region field from a list of territories. - TDBTerritoryListBox
A data-aware list box control that enables users to select the value of a country/region field from a list of territories. - TDBCurrencyLabel
A data-aware label control that displays the value of a currency symbol field. - TDBCurrencyBox
A data-aware combo box control that enables users to select the value of a currency symbol field from a list of currencies. - TDBCurrencyListBox
A data-aware list box control that enables users to select the value of a currency symbol field from a list of currencies. - TDBIntlDateTimeLabel
A data-aware label control to display the localized value of a date-time field. - TDBIntlDatePicker
A data-aware control that enables the user to enter a localized date for a date field.
In addition to the components and classes that are implemented just for localization purposes, the i18n package has some other classes:
- Decode/encode JSON formatted strings.
- Set formatted content of rich edit controls using BBCode styled tags.
- Parse and evaluate expressions in C language syntax.
- Parse Pascal codes to extract string literals and string constants.
The interface part of the i18n package is fully documented using XML comments. Besides the help file that is shipped with the package, you can hover the mouse pointer over any data type, class, or member of a class to see its description.
The i18n package is tested on Delphi 2009 and 2010 only. But it ought to work on Delphi XE as well.
Known Problems
In Delphi 2009, because of a few bugs in Controls standard unit, mirroring page and tab controls for right-to-left languages cause child controls of these controls to go off the screen. Also, other common controls may show odd behavior when toggling the layout’s direction.
In Delphi 2010, changing BiDiMode of a common control may cause an AV exception in comctl32.dll
. This exception is not because of the i18n package. Even without the i18n package, this exception is probable to raise.
Download
Please get the latest version from the GitHub Repository.
i18n Package (6.5 MiB, Last updated on January 25, 2014)Source code of the i18n package and its translation editor. The zip archive also contains the binary of the translation editor, the reference manual of the package, and various sample programs.
Operational In
Small Editor
If you are looking for a NotePad replacement and more, try Small Editor. Designed to be use as a daily editor for text plain files (TXT) Small Editor can recognize dozens of well know programming language syntax and offer to you a minimalist interface plenty of small big details and lot of useful characteristics.
Img Converter
Image Converter is a small Windows program which allows you to convert images in a very easy way; just by drag and drop image files to the program main window. Image Converter recognizes up to 20 different input formats and can convert images to 16 different output formats.
Screen GIF
Screen GIF allows you to grab an arbitrary screen area and save it directly as a GIF image. This is really useful for various purposes, since GIF images can be easily shared via the web.
HTML Compiler
HTML Compiler is a program for Microsoft Windows that enables you to put an entire HTML application (including HTML, CSS, JavaScript, Images, etc.) into a standalone Windows application, which can be executed like any other Windows application.
Using HTML Compiler and taking advantage of web technologies, you can create applications like Help and Tutorials, Interactive e-books, Presentations, Kiosks, Computer-based training (CBT), CD interfaces, Educational games, Sales/promotional materials, Tests and quizzes and more.
App Builder
Using this program you can create HTML5 apps without having any programming knowledge. You can design the look and define the behavior of your apps in a visual way. App Builder makes creating of HTML5 apps possible for everyone!
Photo Compiler
Photo Compiler allows to create attractive, practices and useful galleries with your photos and images and then convert it into executable programs ready to be viewed without any dependency.
If you have software using the i18n package, and you would like your product to be listed here, please post the link to your software’s homepage and a brief description about it on the miscellaneous section of the forum.