Localization
Kittox default language is English. Applications can be localized to any language using the GNU gettext system via dxgettext for Delphi.
Localization covers two layers:
- Framework interface — buttons (Save, Cancel, Edit, Confirm, Close, etc.), error messages, dialog text
- Application metadata — field labels, allowed values, view titles, hints defined in YAML
File Structure
Home/
Locale/
it/
LC_MESSAGES/
Kitto.po # Translatable strings (source, editable)
Kitto.mo # Compiled binary (used at runtime)
Kitto.ini # dxgettext configuration
de/
LC_MESSAGES/
Kitto.po
Kitto.mo
fr/
...The framework locale folder is in KittoX/Home/Locale/. The application locale folder is in {App}/Home/Locale/. At runtime, KittoX searches the application folder first, then the framework folder (same fallback pattern as resources).
.po file (source)
The .po file contains translatable strings in standard GNU gettext format:
#: Kitto.Html.Form.pas
msgid "Save All"
msgstr "Salva tutto"
#: Kitto.Web.Application.pas
msgid "Session lost or expired, please restart!"
msgstr "Sessione persa o scaduta, riavviare!"Edit .po files with Poedit (free), which compiles the .mo automatically on save.
.mo file (compiled)
The .mo file is the binary format read by dxgettext at runtime. It is generated from the .po file by Poedit or the msgfmt command-line tool. Always regenerate the .mo after editing the .po.
Framework Strings
The framework .po file (KittoX/Home/Locale/it/LC_MESSAGES/Kitto.po) includes translations for:
| Category | Examples |
|---|---|
| Form buttons | Save, Confirm, Save All, Cancel, Close, Edit, Delete, Add, Save & Clone |
| Form titles | Add %s, Edit %s, View %s, Duplicate %s |
| List/Grid | Filters, Apply, Refresh, Search, Select, No records found, Showing %d-%d of %d |
| Confirmation dialogs | Selected %s will be deleted. Are you sure?, Yes, No |
| Login | User Name, Password, Language, Login, Logging in..., Invalid login., Logout |
| Password | Change Password, Old Password, New Password, Reset Password |
| Error handling | Error, Server is not responding, Retry, Reset, Server error, Resource not found |
| Session | Session lost or expired, please restart!, Data saved, Data deleted |
| File operations | Upload, Download, Clear, Preview |
Italian translation is included out of the box. To add a new language, copy the it/ folder, rename it (e.g. de/, fr/, es/), and translate the .po file.
Client-Side Strings
Some strings are used in JavaScript (error dialogs, toast notifications). These are injected from the server into the _Page.html template via the window.KX_STRINGS object:
window.KX_STRINGS = {
appTitle: '...',
errorTitle: '...', // _('Error')
serverNotResponding: '...', // _('Server is not responding')
retry: '...', // _('Retry')
reset: '...', // _('Reset')
dataSaved: '...', // _('Data saved')
dataDeleted: '...', // _('Data deleted')
serverError: '...', // _('Server error')
serverNotFound: '...', // _('Resource not found')
serverInternalError: '...' // _('Internal server error')
};These values come from the Delphi _() function, so they are automatically translated when a .po/.mo file is available for the user's language.
Application Metadata Localization
In YAML metadata files, wrap translatable strings with _():
Field labels and hints
Fields:
Doll_Name: String(40) not null
DisplayLabel: _(Name)
Date_Bought: Date
DisplayLabel: _(Birth Date)
Picture: Blob
DisplayLabel: _(Photo)
Hint: _(Select a picture)Allowed values
Fields:
Dress_Size: String(4)
AllowedValues:
XS: _(Extra Small)
S: _(Small)
M: _(Medium)
L: _(Large)
XL: _(Extra Large)View titles and button labels
Views:
MyView:
DisplayLabel: _(Customer List)
Controller: ListDelphi Code
In custom controllers and rules, use _() for user-facing strings:
uses
EF.Localization;
procedure TMyRule.BeforeAdd(const ARecord: TKRecord);
begin
if SomethingWrong then
RaiseError(_('Cannot invite the same girl twice.'));
end;Multi-Language Applications
To let users choose their language at login, add to Config.yaml:
LanguageId: en
LanguagePerSession: TrueLanguageIdsets the default language for the login pageLanguagePerSession: Trueshows a language selector on the login dialog
The language selector lists all locale subfolders found in Home/Locale/.
Adding a New Language
- Copy an existing locale folder (e.g.
Home/Locale/it/) to a new folder (e.g.Home/Locale/de/) - Open
Kitto.powith Poedit - Translate all
msgstrentries - Save — Poedit generates the
.mofile automatically - For application-specific strings, create the same structure in
{App}/Home/Locale/de/LC_MESSAGES/
See also
- How To: Localize an Application — step-by-step guide
- Config Reference —
LanguageIdandLanguagePerSessionsettings - Login — language selector on the login page
