Make use of the gimp_bind_text_domain () util function

This commit is contained in:
Luca Bacci 2023-01-11 15:42:31 +01:00 committed by Jehan
parent cbcb9181d0
commit 005b3a05b8
5 changed files with 14 additions and 25 deletions

View File

@ -1073,12 +1073,12 @@ gimp_init_i18n (void)
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
gimp_bind_text_domain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8");
#endif
bindtextdomain (GETTEXT_PACKAGE, gimp_locale_directory ());
gimp_bind_text_domain (GETTEXT_PACKAGE, gimp_locale_directory ());
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif

View File

@ -374,9 +374,9 @@ iso_codes_parser_init (void)
#ifdef G_OS_WIN32
/* on Win32, assume iso-codes is installed in the same location as GIMP */
bindtextdomain ("iso_639", gimp_locale_directory ());
gimp_bind_text_domain ("iso_639", gimp_locale_directory ());
#else
bindtextdomain ("iso_639", ISO_CODES_LOCALEDIR);
gimp_bind_text_domain ("iso_639", ISO_CODES_LOCALEDIR);
#endif
bind_textdomain_codeset ("iso_639", "UTF-8");

View File

@ -487,7 +487,7 @@ gimp_main (GType plug_in_type,
/* initialize i18n support */
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
gimp_bind_text_domain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8");
#endif

View File

@ -1016,7 +1016,7 @@ _gimp_plug_in_create_procedure (GimpPlugIn *plug_in,
if (_gimp_plug_in_set_i18n (plug_in, procedure_name, &gettext_domain, &catalog_dir))
{
bindtextdomain (gettext_domain, catalog_dir);
gimp_bind_text_domain (gettext_domain, catalog_dir);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (gettext_domain, "UTF-8");
#endif
@ -1346,7 +1346,7 @@ gimp_plug_in_proc_run_internal (GimpPlugIn *plug_in,
if (_gimp_plug_in_set_i18n (plug_in, gimp_procedure_get_name (procedure),
&gettext_domain, &catalog_dir))
{
bindtextdomain (gettext_domain, catalog_dir);
gimp_bind_text_domain (gettext_domain, catalog_dir);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (gettext_domain, "UTF-8");
#endif

View File

@ -514,12 +514,13 @@ gimp_data_directory (void)
* from the executable's full filename is used.
*
* The returned string is owned by GIMP and must not be modified or
* freed. The returned string is in the encoding used for filenames by
* the C library, which isn't necessarily UTF-8. (On Windows, unlike
* the other similar functions here, the return value from this
* function is in the system codepage, never in UTF-8. It can thus be
* passed directly to the bindtextdomain() function from libintl which
* does not handle UTF-8.)
* freed. The returned string encoding depends on the system where GIMP
* is running: on UNIX it's in the encoding used for filenames by
* the C library (which isn't necessarily UTF-8); on Windows it's UTF-8.
*
* On UNIX the returned string can be passed directly to the bindtextdomain()
* function from libintl; on Windows the returned string can be converted to
* UTF-16 and passed to the wbindtextdomain() function from libintl.
*
* Returns: The top directory for GIMP locale files.
*/
@ -536,18 +537,6 @@ gimp_locale_directory (void)
gimp_locale_dir = gimp_env_get_dir ("GIMP3_LOCALEDIR", LOCALEDIR, tmp);
g_free (tmp);
#ifdef G_OS_WIN32
/* FIXME: g_win32_locale_filename_from_utf8() can actually return
* NULL (we had actual cases of this). Not sure exactly what
* gimp_locale_directory() should do when this happens. Anyway
* that's really broken, and something should be done some day
* about this!
*/
tmp = g_win32_locale_filename_from_utf8 (gimp_locale_dir);
g_free (gimp_locale_dir);
gimp_locale_dir = tmp;
#endif
}
return gimp_locale_dir;