mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
Add gimp_bind_text_domain () utility function
On UNIX it's just a stub calling bindtextdomain () directly; on Windows it converts the path to UTF-16 and calls wbindtextdomain ().
This commit is contained in:
parent
48c27770b6
commit
cbcb9181d0
3 changed files with 35 additions and 0 deletions
|
@ -7,6 +7,7 @@ EXPORTS
|
||||||
gimp_array_new
|
gimp_array_new
|
||||||
gimp_base_compat_enums_init
|
gimp_base_compat_enums_init
|
||||||
gimp_base_init
|
gimp_base_init
|
||||||
|
gimp_bind_text_domain
|
||||||
gimp_brush_generated_shape_get_type
|
gimp_brush_generated_shape_get_type
|
||||||
gimp_cache_directory
|
gimp_cache_directory
|
||||||
gimp_canonicalize_identifier
|
gimp_canonicalize_identifier
|
||||||
|
|
|
@ -1623,6 +1623,38 @@ gimp_range_estimate_settings (gdouble lower,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_bind_text_domain:
|
||||||
|
* @domain_name: a gettext domain name
|
||||||
|
* @dir_name: path of the catalog directory
|
||||||
|
*
|
||||||
|
* This function wraps bindtextdomain on UNIX and wbintextdomain on Windows.
|
||||||
|
* @dir_name is expected to be in the encoding used by the C library on UNIX
|
||||||
|
* and UTF-8 on Windows.
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_bind_text_domain (const gchar *domain_name,
|
||||||
|
const gchar *dir_name)
|
||||||
|
{
|
||||||
|
#if defined (_WIN32) && !defined (__CYGWIN__)
|
||||||
|
wchar_t *dir_name_utf16 = g_utf8_to_utf16 (dir_name, -1, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
if G_UNLIKELY (!dir_name_utf16)
|
||||||
|
{
|
||||||
|
g_printerr ("[%s] Cannot translate the catalog directory to UTF-16\n", __func__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wbindtextdomain (domain_name, dir_name_utf16);
|
||||||
|
g_free (dir_name_utf16);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
bindtextdomain (domain_name, dir_name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Private functions. */
|
/* Private functions. */
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,8 @@ void gimp_range_estimate_settings (gdouble lower,
|
||||||
gdouble *page,
|
gdouble *page,
|
||||||
gint *digits);
|
gint *digits);
|
||||||
|
|
||||||
|
void gimp_bind_text_domain (const gchar *domain_name,
|
||||||
|
const gchar *dir_name);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue