Commit cbcb9181 authored by Luca Bacci's avatar Luca Bacci Committed by Jehan
Browse files

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 ().
parent 48c27770
......@@ -7,6 +7,7 @@ EXPORTS
gimp_array_new
gimp_base_compat_enums_init
gimp_base_init
gimp_bind_text_domain
gimp_brush_generated_shape_get_type
gimp_cache_directory
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. */
......
......@@ -88,6 +88,8 @@ void gimp_range_estimate_settings (gdouble lower,
gdouble *page,
gint *digits);
void gimp_bind_text_domain (const gchar *domain_name,
const gchar *dir_name);
G_END_DECLS
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment