Mach Modules Documentation
Lua Module API Documentation
Loading...
Searching...
No Matches
int18n.lua File Reference

Go to the source code of this file.

Functions

int18n Translate (str)
 Translate a string using the wxWidgets translation system.
int18n SetDomain (domain)
 Set the translation domain used for catalog lookups.
int18n SetLanguage (langId)
 Set the active language for translations.
int18n AddCatalog (catalog, langId)
 Add a translation catalog for a specified language.
int18n AddCatalogLookupPathPrefix (_prefix)
 Add a directory path prefix for catalog file lookup.

Function Documentation

◆ AddCatalog()

int18n AddCatalog ( catalog ,
langId  )

Add a translation catalog for a specified language.

Loads a translation catalog file for the given language identifier using the wxTranslations system. If wxTranslations is not available, the function returns immediately without error. If no language ID is provided, defaults to wx.wxLANGUAGE_ENGLISH. The catalog lookup path must be configured via int18n.AddCatalogLookupPathPrefix() before calling this function.

Parameters
catalog(string) The name of the translation catalog to load (typically the application or domain name)
langId(number|nil) The wxWidgets language identifier constant (e.g., wx.wxLANGUAGE_ENGLISH). If nil, defaults to wx.wxLANGUAGE_ENGLISH
Note
Documentation generated by AI on 2026-03-03

◆ AddCatalogLookupPathPrefix()

int18n AddCatalogLookupPathPrefix ( _prefix )

Add a directory path prefix for catalog file lookup.

Registers an additional directory path where wxWidgets will search for translation catalog files. If wxTranslations is not available (e.g., running without a wx environment), the function returns immediately without error. This must be called before loading catalogs with int18n.AddCatalog() to ensure the catalog files can be found.

Parameters
_prefix(string) The directory path prefix to add to the catalog lookup search path
Note
Documentation generated by AI on 2026-03-03

◆ SetDomain()

int18n SetDomain ( domain )

Set the translation domain used for catalog lookups.

Assigns the domain name that will be used when retrieving translations via int18n.Translate(). The domain typically corresponds to the application or module name and is used to scope translation strings to a specific catalog. If no domain is set (nil), wx.wxGetTranslation() will be called without a domain argument.

Parameters
domain(string) The translation domain name to set
Note
Documentation generated by AI on 2026-03-03

◆ SetLanguage()

int18n SetLanguage ( langId )

Set the active language for translations.

Changes the current translation language used by the wxTranslations system. If wxTranslations is not available, the function returns immediately without error. After setting the language, subsequent calls to int18n.Translate() or _() will return strings in the newly configured language, provided the appropriate catalog has been loaded.

Parameters
langId(number) The wxWidgets language identifier constant (e.g., wx.wxLANGUAGE_ENGLISH_US)
Note
Documentation generated by AI on 2026-03-03

◆ Translate()

int18n Translate ( str )

Translate a string using the wxWidgets translation system.

Converts the input to a string and attempts to retrieve its translation using wxTranslations. If wxTranslations is not available, the original string is returned untranslated. If a domain has been set via int18n.SetDomain(), the translation is looked up within that domain; otherwise, wx.wxGetTranslation() is called without a domain argument.

Parameters
str(string) The source string to translate
Returns
(string) The translated string, or the original string if translation is unavailable
See also
int18n.SetDomain() to configure the translation domain
int18n.AddCatalog() to load translation catalogs
Note
Documentation generated by AI on 2026-03-03