|
Mach Modules Documentation
Lua Module API Documentation
|
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. | |
| 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.
| 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 |
| 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.
| _prefix | (string) The directory path prefix to add to the catalog lookup search path |
| 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.
| domain | (string) The translation domain name to set |
| 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.
| langId | (number) The wxWidgets language identifier constant (e.g., wx.wxLANGUAGE_ENGLISH_US) |
| 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.
| str | (string) The source string to translate |