1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* The GIMP Help plug-in
5
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
6
* Michael Natterer <mitch@gimp.org>
7
* Henrik Brix Andersen <brix@gimp.org>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35
locales_parse (const gchar *help_locales)
37
GList *locales = NULL;
42
g_return_val_if_fail (help_locales != NULL, NULL);
44
/* split the string at colons, building a list */
46
for (p = strchr (s, ':'); p; p = strchr (s, ':'))
48
gchar *new = g_strndup (s, p - s);
50
locales = g_list_append (locales, new);
55
locales = g_list_append (locales, g_strdup (s));
57
/* add locales w/o variants unless they exist already */
58
for (list = locales; list; list = list->next)
60
s = (const gchar *) list->data;
66
gchar *new = g_strndup (s, p - s);
68
for (iter = locales; iter; iter = iter->next)
69
if (strcmp ((const gchar *) iter->data, new) == 0)
75
locales = g_list_append (locales, new);
79
/* if the list doesn't contain the default domain yet, append it */
80
for (list = locales; list; list = list->next)
81
if (strcmp ((const gchar *) list->data, GIMP_HELP_DEFAULT_LOCALE) == 0)
85
locales = g_list_append (locales, g_strdup (GIMP_HELP_DEFAULT_LOCALE));
87
#ifdef GIMP_HELP_DEBUG
88
g_printerr ("help: locales: ");
89
for (list = locales; list; list = list->next)
90
g_printerr ("%s ", (const gchar *) list->data);