libxfce4util Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <libxfce4util/libxfce4util.h> void xfce_textdomain (const gchar *package
,const gchar *localedir
,const gchar *encoding
); gchar * xfce_get_file_localized (const gchar *filename
); gchar * xfce_get_file_localized_r (gchar *buffer
,gsize length
,const gchar *filename
); gchar * xfce_get_dir_localized (const gchar *directory
); gchar * xfce_get_dir_localized_r (gchar *buffer
,gsize length
,const gchar *directory
); gchar * xfce_get_path_localized (gchar *dst
,gsize size
,const gchar *paths
,const gchar *filename
,GFileTest test
); #define XFCE_LOCALE_FULL_MATCH #define XFCE_LOCALE_NO_MATCH guint xfce_locale_match (const gchar *locale1
,const gchar *locale2
);
Provides functions to aid application developers making their software localizable. It extends the basic internationalization support provided by GLib 2.4 (and newer). See the GLib Internationalization documentation for the information about the basic functions and macros.
void xfce_textdomain (const gchar *package
,const gchar *localedir
,const gchar *encoding
);
Sets up the translations for package
.
|
the package name. |
|
the package s locale directory. |
|
the encoding to use the package s translations
or NULL to use "UTF-8". |
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.
|
name of a file to look for a localized version. |
Returns : |
path of the localized file or copy of filename if no such
file exists. Returned string should be freed using g_free() . |
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.
|
destination buffer to store the localized filename to. |
|
size of buffer in bytes. |
|
name of a file to look for a localized version. |
Returns : |
pointer to buffer or NULL on error. |
gchar * xfce_get_dir_localized (const gchar *directory
);
Similar to xfce_get_file_localized()
, but works on directory instead of
a file.
|
directory name to check for a localized variant. |
Returns : |
path of the localized directory name or copy of directory if
no such directory exists. Returned string should be freed using
g_free() . |
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.
|
destination buffer to store the localized filename to. |
|
size of buffer in bytes. |
|
name of directory to check for localized variant of. |
Returns : |
pointer to buffer or NULL on error. |
gchar * xfce_get_path_localized (gchar *dst
,gsize size
,const gchar *paths
,const gchar *filename
,GFileTest test
);
paths
is a ':'-separated list of pathnames.
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
|
destination buffer. |
|
size of dst in bytes. |
#define XFCE_LOCALE_FULL_MATCH 50
Returned by xfce_locale_match in case of a full match.
#define XFCE_LOCALE_NO_MATCH 0
Returned by xfce_locale_match if no match could be detected.
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.
|
the current locale value as returned by setlocale(LC_MESSAGES,NULL ). |
|
the locale value to match against. |
Returns : |
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