Gettext

Website:

https://github.com/HROMANO/gettext

Author:
  • H. ROMANO
Maintainer:
  • H. ROMANO <shuihuzhuan@free.fr>
License:

MIT OR Apache-2.0 WITH LLVM-exception

Version:

25.9.3

Alire CI:

Dependencies:

No dependency.

Dependents:

No dependents.

Badge:

A wrapper library for gettext

#i18n #gettext

A simple but hopefully complete Ada wrapper around gettext. It should run on linux and windows. Don’t know for other OSes.

How to use

Before calling the gettext family translation functions:

  • You must set the locale using Gettexts.Locale.Set_Locale (even a call with no arguments is enough but required).
  • You should set the directory and the domain name with Gettexts.Set_Domain_Directory and Gettexts.Set_Domain_Name.
  • You should set the codeset with Gettexts.Set_Domain_Codeset.

Function names

You can choose between:

  • Standard names used in C language: gettext, ngettext, pgettext, dgettext, etc.
  • More readable Ada names: Get_Text, Get_Plural_Text, Get_Text_With_Context, etc.

Limits

There’s no support for Ada in xgettext. But if your code doesn’t have unbalanced tick marks (like in 'Class), you can still use it to produce and update .po files (see update.sh in example directory). As a workaround, you can balance tick marks with comments -- '.