The i18n package is a library of Delphi components, classes and procedures in purpose of assisting developers to fully internationalize Delphi applications in an easy manner, and to 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 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 calendar system of the target language.
You want your application 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 to support 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 it is needed.
Although the Gregorian calendar is most used calendar in the world, but 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 are 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 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 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 check list box control that represents a list of cultures (locales). - TTerritoryLabel
A label control that displays 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 check list box control that represents a list of countries/regions. - TCurrencyLabel
A label control that displays 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 that represents a list of currencies. - TCurrencyCheckListBox
A check list box control that represents a list of currencies. - TDBImageLabel
A data-aware label control that displays value of a field plus a custom icon on a form. - TDBCultureLabel
A data-aware label control that displays value of a locale field. - TDBCultureBox
A data-aware combo box control that enable users to select value of a locale field from a list of cultures (locales). - TDBCultureListBox
A data-aware list box control that enable users to select value of a locale field from a list of cultures (locales). - TDBTerritoryLabel
A data-aware label control that displays value of a country/region field. - TDBTerritoryBox
A data-aware combo box control that enable users to select value of a country/region field from a list of territories. - TDBTerritoryListBox
A data-aware list box control that enable users to select value of a country/region field from a list of territories. - TDBCurrencyLabel
A data-aware label control that displays value of a currency symbol field. - TDBCurrencyBox
A data-aware combo box control that enable users to select value of a currency symbol field from a list of currencies. - TDBCurrencyListBox
A data-aware list box control that enable users to select value of a currency symbol field from a list of currencies. - TDBIntlDateTimeLabel
A data-aware label control to display 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 to:
- 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 by XML comments. Besides the help file that is shipped with the package, you can hover 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 causes child controls of these controls go off the screen. Also, other common controls may show odd behavior when toggle 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
i18n Package (6.1 MiB, Last updated on August 19, 2012)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
If you have a 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.
0 comments: