Module src/gnome/lang.c

Functions

local _load_translation_file (L, modname) Load the translation file for the given module, and store the resulting table into the module's table.
lg_argerror (L, narg, modname, id, fmt, ...) This is the same as luaL_argerror, but accepts a printf style argument list.
lg_error (L, modname, id, fmt, ...) Do whatever luaL_error would do, but translate the message and prepend the message identifier.
lg_message (L, modname, id, fmt, ...) Push a message onto the Lua stack after translation and prefixing with the message id.
local lg_translate (L, modname, id, msg) Try to translate the given message similar to what gettext does.


Functions

local _load_translation_file (L, modname)
Load the translation file for the given module, and store the resulting table into the module's table. In case of error, store an empty table. The translation file is a simple Lua file with one table per language, each containing id/text pairs. Lua stack in: MOD Lua stack out: MOD catalog

Parameters

  • L:
  • modname:
In file: src/gnome/lang.c line 14
lg_argerror (L, narg, modname, id, fmt, ...)
This is the same as luaL_argerror, but accepts a printf style argument list. Note: neither g_vasprintf nor g_strdup_printf are used, as the former is only available since GLib 2.4, and both leave a memory leak as luaL_argerror doesn't return (to free the allocated buffer). This could be mitigated by having a static char* buffer, and freeing it on subsequent calls. This function is usually called from the LG_ARGERROR macro.

Parameters

  • L:
  • narg:
  • modname:
  • id:
  • fmt:
  • ...:
In file: src/gnome/lang.c line 93
lg_error (L, modname, id, fmt, ...)
Do whatever luaL_error would do, but translate the message and prepend the message identifier. This should closely match luaL_error in lua/src/lauxlib.c.

Parameters

  • L:
  • modname:
  • id:
  • fmt:
  • ...:
In file: src/gnome/lang.c line 123
lg_message (L, modname, id, fmt, ...)
Push a message onto the Lua stack after translation and prefixing with the message id.

Parameters

  • L:
  • modname:
  • id:
  • fmt:
  • ...:
In file: src/gnome/lang.c line 146
local lg_translate (L, modname, id, msg)
Try to translate the given message similar to what gettext does.

Parameters

  • L: Lua State
  • modname: The module that contains the message
  • id: The message ID
  • msg: The English message
In file: src/gnome/lang.c line 50

Valid XHTML 1.0!