added a category parameter to make this function more flexible.

2004-04-13  Sven Neumann  <sven@gimp.org>

	* app/core/gimp-utils.[ch] (gimp_get_default_language): added a
	category parameter to make this function more flexible.

	* app/text/gimptext.c: changed accordingly.

	* app/widgets/gimphelp.c (gimp_help): localize the help pages
	according to the value of LC_MESSAGES. Fixes bug #139917.
This commit is contained in:
Sven Neumann 2004-04-13 15:07:30 +00:00 committed by Sven Neumann
parent 2e61d12ed4
commit 84688d18d8
6 changed files with 55 additions and 24 deletions

View File

@ -1,3 +1,13 @@
2004-04-13 Sven Neumann <sven@gimp.org>
* app/core/gimp-utils.[ch] (gimp_get_default_language): added a
category parameter to make this function more flexible.
* app/text/gimptext.c: changed accordingly.
* app/widgets/gimphelp.c (gimp_help): localize the help pages
according to the value of LC_MESSAGES. Fixes bug #139917.
2004-04-13 Michael Natterer <mitch@gimp.org>
Moved the calls to floating_sel_relax()/rigor() from various

5
NEWS
View File

@ -36,3 +36,8 @@ Bugs fixed in GIMP 2.0.1
- fixed X server authentification problems with gimp-remote (#139158, Sven)
- let Script-Fu PDB marshallers handle NULL strings (#139386, Kevin Cozens)
- fixed rounding error in transformation code (#120490, William Skaggs)
- fixed winclipboard plug-in (Hans Breuer)
- fixed Python Slice script (Yosh)
- fixed configure check for Xmu (#139803, Sven)
- fixed crash when scaling up a floating selection (#138356, Mitch)
- use LC_MESSAGE for help localization (#139917, Sven)

View File

@ -103,12 +103,17 @@ gimp_g_list_get_memsize (GList *list,
* basically copied from gtk_get_default_language()
*/
gchar *
gimp_get_default_language (void)
gimp_get_default_language (const gchar *category)
{
gchar *lang;
gchar *p;
gint cat = LC_CTYPE;
if (! category)
category = "LC_CTYPE";
#ifdef G_OS_WIN32
p = getenv ("LC_ALL");
if (p != NULL)
lang = g_strdup (p);
@ -119,16 +124,27 @@ gimp_get_default_language (void)
lang = g_strdup (p);
else
{
p = getenv ("LC_CTYPE");
p = getenv (category);
if (p != NULL)
lang = g_strdup (p);
else
lang = g_win32_getlocale ();
}
}
#else
lang = g_strdup (setlocale (LC_CTYPE, NULL));
if (strcmp (category, "LC_CTYPE") == 0)
cat = LC_CTYPE;
else if (strcmp (category, "LC_MESSAGES") == 0)
cat = LC_MESSAGES;
else
g_warning ("unsupported category used with gimp_get_default_language()");
lang = g_strdup (setlocale (cat, NULL));
#endif
p = strchr (lang, '.');
if (p)
*p = '\0';

View File

@ -20,27 +20,27 @@
#define __APP_GIMP_UTILS_H__
gboolean gimp_rectangle_intersect (gint x1,
gint y1,
gint width1,
gint height1,
gint x2,
gint y2,
gint width2,
gint height2,
gint *dest_x,
gint *dest_y,
gint *dest_width,
gint *dest_height);
gboolean gimp_rectangle_intersect (gint x1,
gint y1,
gint width1,
gint height1,
gint x2,
gint y2,
gint width2,
gint height2,
gint *dest_x,
gint *dest_y,
gint *dest_width,
gint *dest_height);
gint64 gimp_g_object_get_memsize (GObject *object);
gint64 gimp_g_hash_table_get_memsize (GHashTable *hash);
gint64 gimp_g_slist_get_memsize (GSList *slist,
gint64 data_size);
gint64 gimp_g_list_get_memsize (GList *list,
gint64 data_size);
gint64 gimp_g_object_get_memsize (GObject *object);
gint64 gimp_g_hash_table_get_memsize (GHashTable *hash);
gint64 gimp_g_slist_get_memsize (GSList *slist,
gint64 data_size);
gint64 gimp_g_list_get_memsize (GList *list,
gint64 data_size);
gchar * gimp_get_default_language (void);
gchar * gimp_get_default_language (const gchar *category);
#endif /* __APP_GIMP_UTILS_H__ */

View File

@ -146,7 +146,7 @@ gimp_text_class_init (GimpTextClass *klass)
gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE);
gimp_matrix2_identity (&identity);
language = gimp_get_default_language ();
language = gimp_get_default_language (NULL);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_TEXT,
"text", NULL,

View File

@ -97,7 +97,7 @@ gimp_help (Gimp *gimp,
if (config->help_locales && strlen (config->help_locales))
idle_help->help_locales = g_strdup (config->help_locales);
else
idle_help->help_locales = gimp_get_default_language ();
idle_help->help_locales = gimp_get_default_language ("LC_MESSAGES");
if (help_id && strlen (help_id))
idle_help->help_id = g_strdup (help_id);