gnome-i18n

Name

gnome-i18n -- Support for localization and internationalization.

Synopsis


#include <libgnome/libgnome.h>


const GList* gnome_i18n_get_language_list   (const gchar *category_name);
void        gnome_i18n_push_c_numeric_locale
                                            (void);
void        gnome_i18n_pop_c_numeric_locale (void);

Description

This module allows the programmer to internationalize his application by providing functions to retrieve the preferred languages of the user as well as temporarily move back to the C locale for performing locale independent operations.

Note: A lot of the internationalization functions which were in this module in GNOME 1 have now moved to libbonobo for GNOME 2 (_(), textdomain(), gettext(), etc).

Details

gnome_i18n_get_language_list ()

const GList* gnome_i18n_get_language_list   (const gchar *category_name);

This computes a list of language strings that the user wants. It searches in the standard environment variables to find the list, which is sorted in order from most desirable to least desirable. The `C' locale is appended to the list if it does not already appear (other routines depend on this behaviour). If category_name is NULL, then LC_ALL is assumed.

category_name :

Name of category to look up, e.g. %"LC_MESSAGES".

Returns :

the list of languages, this list should not be freed as it is owned by gnome-i18n.


gnome_i18n_push_c_numeric_locale ()

void        gnome_i18n_push_c_numeric_locale
                                            (void);

Saves the current LC_NUMERIC locale and sets it to "C" This way you can safely read write floating point numbers all in the same format. You should make sure that code between gnome_i18n_push_c_numeric_locale() and gnome_i18n_pop_c_numeric_locale() doesn't do any setlocale calls or locale may end up in a strange setting. Also make sure to always pop the c numeric locale after you've pushed it. The calls can be nested.


gnome_i18n_pop_c_numeric_locale ()

void        gnome_i18n_pop_c_numeric_locale (void);

Restores the LC_NUMERIC locale to what it was before the matching gnome_i18n_push_c_numeric_locale(). If these calls were nested, then this is a no-op until we get to the most outermost layer. Code in between these should not do any setlocale calls to change the LC_NUMERIC locale or things may come out very strange.