Top |
void | xfce_textdomain () |
gchar * | xfce_get_file_localized () |
gchar * | xfce_get_file_localized_r () |
gchar * | xfce_get_dir_localized () |
gchar * | xfce_get_dir_localized_r () |
gchar * | xfce_get_path_localized () |
guint | xfce_locale_match () |
Provides functions to aid application developers making their software localizable. It extends the basic internationalization support provided by GLib 2.4 (and newer).
void xfce_textdomain (const gchar *package
,const gchar *localedir
,const gchar *encoding
);
Sets up the translations for package
.
gchar *
xfce_get_file_localized (const gchar *filename
);
Checks if theres a version of filename
which is localized to the current
locale. This is done by appending the full locale name to filename
, separated
by a '.'. If theres no file of that name, it retries using the full locale
name without the encoding (if any), then without the qualifier (if any) and
at last the base locale is tried. If all of those fails, a copy of filename
is returned.
gchar * xfce_get_file_localized_r (gchar *buffer
,gsize length
,const gchar *filename
);
Similar in functionality to xfce_get_file_localized()
, but stores the
result in buffer
instead of allocating a new buffer.
gchar *
xfce_get_dir_localized (const gchar *directory
);
Similar to xfce_get_file_localized()
, but works on directory instead of
a file.
gchar * xfce_get_dir_localized_r (gchar *buffer
,gsize length
,const gchar *directory
);
Similar to xfce_get_file_localized_r, but works on directory instead of regular file.
gchar * xfce_get_path_localized (gchar *dst
,gsize size
,const gchar *paths
,const gchar *filename
,GFileTest test
);
paths
is a ':'-separated list of pathnames, with:
%F
: the filename
%L
: the language string, as returned by setlocale(LC_MESSAGES, NULL)
%l
: the language component of the language string
%N
: application name
Example paths: /usr/local/lib/%L/%F:/usr/local/share/%N/%l/%F
guint xfce_locale_match (const gchar *locale1
,const gchar *locale2
);
The locale is of the general form LANG_COUNTRY.ENCODING @ MODIFIER, where each of COUNTRY, ENCODING and MODIFIER can be absent.
The match is done by actually removing the rightmost element one by one. This is not entirely according to the freedesktop.org specification, but much easier. Will probably be fixed in the future.
locale1 |
the current locale value as returned by setlocale(LC_MESSAGES, |
|
locale2 |
the locale value to match against. |
an integer value indicating the level of matching, where the constant XFCE_LOCALE_FULL_MATCH indicates a full match and XFCE_LOCALE_NO_MATCH means no match. Every other value indicates a partial match, the higher the value, the better the match. You should not rely on any specific value besides the constants XFCE_LOCALE_FULL_MATCH and XFCE_LOCALE_NO_MATCH, since the range of returned values may change in the future.
Since: 4.2