Message Handling with gettext

'gettext()' is not a standard C language functionality but a widely-used message extracting mechanism. The basic idea is the same as the standard C language's message catalog but 'gettext()' uses the English message itself (or its transformed value) as the message id.

The following are the functions related to 'gettext()':

-------------------------------------------------------------------------
Function		    Description
-------------------------------------------------------------------------
gettext			    Gets a message
dgettext		    Gets a message
dcgettext		    Gets a message
ngettext		    Gets a message
dngettext		    Gets a message
dcngettext		    Gets a message
bindtextdomain		    Binds a message file with a domain
textdomain		    Selects a domain
bind_textdomain_codeset	    Sets a codeset of message
_			    Gets a message (macro)
N_			    Directs message extraction to a tool (macro)
gettext_noop		    Directs message extraction to a tool (macro)
-------------------------------------------------------------------------
The last three are macros. Their definitions are as follows:
#define _(String)   gettext(String)
#define N_(String)  gettext_noop(String)
#define gettext_noop(String) (String)
A text extracting tool searches for and extracts messages in these macro calls.

*** Gettext Steps ***

The basic concept is the same as the message catalog.
Please refer to message catalogs.  
Below is an explanation of its differences from message catalogs.
  1. Message File

  2. Compile Message Files.

  3. Describe message loading.

  4. Locations of the .mo files.

This process can be checked with 'gettext' externalization of the sample 'linux_gettext' in World Wide Navi.

Go to Internationalization Programming Top


Copyright (C) 2012 Kokusaika JP, Inc.
All rights reserved. No reproduction or republication without written permission.