Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
e477d76b
Commit
e477d76b
authored
Feb 26, 2000
by
Sven Neumann
Browse files
translate branches on the fly, get rid of dummy_entries
--Sven
parent
8769bbb4
Changes
9
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
e477d76b
Sat Feb 26 19:56:35 CET 2000 Sven Neumann <sven@gimp.org>
Daniel Egger <Daniel.Egger@suse.de>
* app/menus.c: Branches are now translated on the fly by using
the translation of the menu_entry that causes the menu to be
created. This has the drawback that this menu needs to have a
proper translation or the branch won't be translated, but we
don't need the dummy_entries any more and plugins can provide
deeply nested menus that are translated from one string.
* plug-ins/gap/gap_frontends_main.c
* plug-ins/script-fu/script-fu.c
* plug-ins/webbrowser/webbrowser.c: removed the dummy entries
The translation of Script-Fu is the remaining problem. IMHO we
should solve this properly by writing a xgettext-like script
that parses the Script-Fus and add a gimp-script-fu domain.
With trivial changes to script-fu-scripts.c we will get a
completely internationalized Script-Fu UI.
2000-02-26 Garry R. Osgood <gosgood@idt.net>
* app/commands.c
* app/commands.c
* app/gimpimage.c
* app/layer.c
* app/layer.h
...
...
app/gui/menus.c
View file @
e477d76b
...
...
@@ -71,29 +71,6 @@ static void help_debug_cmd_callback (GtkWidget *widget,
gpointer
callback_data
,
guint
callback_action
);
#ifdef ENABLE_NLS
/* from main.c */
extern
gchar
*
plugin_domains
[];
extern
gint
n_plugin_domains
;
/* for i18n */
static
gchar
G_GNUC_UNUSED
*
dummy_entries
[]
=
{
/* <Image> */
N_
(
"/Filters/Colors/Map"
),
N_
(
"/Filters/Render/Clouds"
),
N_
(
"/Filters/Render/Nature"
),
N_
(
"/Filters/Render/Pattern"
),
N_
(
"/Filters/Misc"
),
/* Perl-Fu */
N_
(
"/Xtns/Animation"
),
N_
(
"/Guides"
),
};
#endif
/* ENABLE_NLS */
static
GSList
*
last_opened_raw_filenames
=
NULL
;
/***** <Toolbox> *****/
...
...
@@ -942,10 +919,8 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
while
(
p
)
{
g_string_assign
(
tearoff_path
,
entry
->
entry
.
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
entry
->
entry
.
path
+
1
-
factory_length
);
g_string_append
(
tearoff_path
,
"tearoff1"
);
g_string_assign
(
tearoff_path
,
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
path
-
factory_length
);
if
(
!
gtk_item_factory_get_widget
(
item_factory
,
tearoff_path
->
str
))
...
...
@@ -956,7 +931,19 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
NULL
,
NULL
};
GimpItemFactoryEntry
branch_entry
=
{
{
NULL
,
NULL
,
NULL
,
0
,
"<Branch>"
},
NULL
,
NULL
};
branch_entry
.
entry
.
path
=
tearoff_path
->
str
;
gtk_object_set_data
(
GTK_OBJECT
(
item_factory
),
"complete"
,
path
);
menus_create_item
(
item_factory
,
&
branch_entry
,
NULL
,
2
);
gtk_object_remove_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
g_string_append
(
tearoff_path
,
"/tearoff1"
);
tearoff_entry
.
entry
.
path
=
tearoff_path
->
str
;
menus_create_item
(
item_factory
,
&
tearoff_entry
,
NULL
,
2
);
}
...
...
@@ -1761,6 +1748,8 @@ menu_translate (const gchar *path,
gchar
*
factory
;
gchar
*
translation
;
gchar
*
domain
=
NULL
;
gchar
*
complete
=
NULL
;
gchar
*
p
,
*
t
;
factory
=
(
gchar
*
)
data
;
...
...
@@ -1779,20 +1768,59 @@ menu_translate (const gchar *path,
if
(
item_factory
)
domain
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"textdomain"
);
if
(
domain
)
/* use the plugin
s
textdomain */
if
(
domain
)
/* use the plugin textdomain */
{
g_free
(
menupath
);
menupath
=
g_strconcat
(
factory
,
path
,
NULL
);
translation
=
dgettext
(
domain
,
menupath
);
complete
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
if
(
complete
)
{
/*
* This is a branch, use the complete path for translation,
* then strip off entries from the end until it matches.
*/
translation
=
g_strdup
(
dgettext
(
domain
,
complete
));
complete
=
g_strdup
(
complete
);
while
(
*
complete
&&
*
translation
&&
strcmp
(
complete
,
menupath
))
{
p
=
strrchr
(
complete
,
'/'
);
t
=
strrchr
(
translation
,
'/'
);
if
(
p
&&
t
)
{
*
p
=
'\0'
;
*
t
=
'\0'
;
}
else
break
;
}
g_free
(
complete
);
}
else
{
translation
=
dgettext
(
domain
,
menupath
);
}
/*
* Work around a bug in GTK+ prior to 1.2.7 (similar workaround below)
*/
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
retval
=
translation
+
strlen
(
factory
);
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
{
retval
=
translation
+
strlen
(
factory
);
if
(
complete
)
{
/* assign the result to menu_path, so it gets freed on next call */
g_free
(
menupath
);
menupath
=
translation
;
}
}
else
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
{
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
if
(
complete
)
g_free
(
translation
);
}
}
else
{
...
...
app/menus.c
View file @
e477d76b
...
...
@@ -71,29 +71,6 @@ static void help_debug_cmd_callback (GtkWidget *widget,
gpointer
callback_data
,
guint
callback_action
);
#ifdef ENABLE_NLS
/* from main.c */
extern
gchar
*
plugin_domains
[];
extern
gint
n_plugin_domains
;
/* for i18n */
static
gchar
G_GNUC_UNUSED
*
dummy_entries
[]
=
{
/* <Image> */
N_
(
"/Filters/Colors/Map"
),
N_
(
"/Filters/Render/Clouds"
),
N_
(
"/Filters/Render/Nature"
),
N_
(
"/Filters/Render/Pattern"
),
N_
(
"/Filters/Misc"
),
/* Perl-Fu */
N_
(
"/Xtns/Animation"
),
N_
(
"/Guides"
),
};
#endif
/* ENABLE_NLS */
static
GSList
*
last_opened_raw_filenames
=
NULL
;
/***** <Toolbox> *****/
...
...
@@ -942,10 +919,8 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
while
(
p
)
{
g_string_assign
(
tearoff_path
,
entry
->
entry
.
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
entry
->
entry
.
path
+
1
-
factory_length
);
g_string_append
(
tearoff_path
,
"tearoff1"
);
g_string_assign
(
tearoff_path
,
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
path
-
factory_length
);
if
(
!
gtk_item_factory_get_widget
(
item_factory
,
tearoff_path
->
str
))
...
...
@@ -956,7 +931,19 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
NULL
,
NULL
};
GimpItemFactoryEntry
branch_entry
=
{
{
NULL
,
NULL
,
NULL
,
0
,
"<Branch>"
},
NULL
,
NULL
};
branch_entry
.
entry
.
path
=
tearoff_path
->
str
;
gtk_object_set_data
(
GTK_OBJECT
(
item_factory
),
"complete"
,
path
);
menus_create_item
(
item_factory
,
&
branch_entry
,
NULL
,
2
);
gtk_object_remove_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
g_string_append
(
tearoff_path
,
"/tearoff1"
);
tearoff_entry
.
entry
.
path
=
tearoff_path
->
str
;
menus_create_item
(
item_factory
,
&
tearoff_entry
,
NULL
,
2
);
}
...
...
@@ -1761,6 +1748,8 @@ menu_translate (const gchar *path,
gchar
*
factory
;
gchar
*
translation
;
gchar
*
domain
=
NULL
;
gchar
*
complete
=
NULL
;
gchar
*
p
,
*
t
;
factory
=
(
gchar
*
)
data
;
...
...
@@ -1779,20 +1768,59 @@ menu_translate (const gchar *path,
if
(
item_factory
)
domain
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"textdomain"
);
if
(
domain
)
/* use the plugin
s
textdomain */
if
(
domain
)
/* use the plugin textdomain */
{
g_free
(
menupath
);
menupath
=
g_strconcat
(
factory
,
path
,
NULL
);
translation
=
dgettext
(
domain
,
menupath
);
complete
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
if
(
complete
)
{
/*
* This is a branch, use the complete path for translation,
* then strip off entries from the end until it matches.
*/
translation
=
g_strdup
(
dgettext
(
domain
,
complete
));
complete
=
g_strdup
(
complete
);
while
(
*
complete
&&
*
translation
&&
strcmp
(
complete
,
menupath
))
{
p
=
strrchr
(
complete
,
'/'
);
t
=
strrchr
(
translation
,
'/'
);
if
(
p
&&
t
)
{
*
p
=
'\0'
;
*
t
=
'\0'
;
}
else
break
;
}
g_free
(
complete
);
}
else
{
translation
=
dgettext
(
domain
,
menupath
);
}
/*
* Work around a bug in GTK+ prior to 1.2.7 (similar workaround below)
*/
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
retval
=
translation
+
strlen
(
factory
);
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
{
retval
=
translation
+
strlen
(
factory
);
if
(
complete
)
{
/* assign the result to menu_path, so it gets freed on next call */
g_free
(
menupath
);
menupath
=
translation
;
}
}
else
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
{
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
if
(
complete
)
g_free
(
translation
);
}
}
else
{
...
...
app/menus/menus.c
View file @
e477d76b
...
...
@@ -71,29 +71,6 @@ static void help_debug_cmd_callback (GtkWidget *widget,
gpointer
callback_data
,
guint
callback_action
);
#ifdef ENABLE_NLS
/* from main.c */
extern
gchar
*
plugin_domains
[];
extern
gint
n_plugin_domains
;
/* for i18n */
static
gchar
G_GNUC_UNUSED
*
dummy_entries
[]
=
{
/* <Image> */
N_
(
"/Filters/Colors/Map"
),
N_
(
"/Filters/Render/Clouds"
),
N_
(
"/Filters/Render/Nature"
),
N_
(
"/Filters/Render/Pattern"
),
N_
(
"/Filters/Misc"
),
/* Perl-Fu */
N_
(
"/Xtns/Animation"
),
N_
(
"/Guides"
),
};
#endif
/* ENABLE_NLS */
static
GSList
*
last_opened_raw_filenames
=
NULL
;
/***** <Toolbox> *****/
...
...
@@ -942,10 +919,8 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
while
(
p
)
{
g_string_assign
(
tearoff_path
,
entry
->
entry
.
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
entry
->
entry
.
path
+
1
-
factory_length
);
g_string_append
(
tearoff_path
,
"tearoff1"
);
g_string_assign
(
tearoff_path
,
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
path
-
factory_length
);
if
(
!
gtk_item_factory_get_widget
(
item_factory
,
tearoff_path
->
str
))
...
...
@@ -956,7 +931,19 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
NULL
,
NULL
};
GimpItemFactoryEntry
branch_entry
=
{
{
NULL
,
NULL
,
NULL
,
0
,
"<Branch>"
},
NULL
,
NULL
};
branch_entry
.
entry
.
path
=
tearoff_path
->
str
;
gtk_object_set_data
(
GTK_OBJECT
(
item_factory
),
"complete"
,
path
);
menus_create_item
(
item_factory
,
&
branch_entry
,
NULL
,
2
);
gtk_object_remove_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
g_string_append
(
tearoff_path
,
"/tearoff1"
);
tearoff_entry
.
entry
.
path
=
tearoff_path
->
str
;
menus_create_item
(
item_factory
,
&
tearoff_entry
,
NULL
,
2
);
}
...
...
@@ -1761,6 +1748,8 @@ menu_translate (const gchar *path,
gchar
*
factory
;
gchar
*
translation
;
gchar
*
domain
=
NULL
;
gchar
*
complete
=
NULL
;
gchar
*
p
,
*
t
;
factory
=
(
gchar
*
)
data
;
...
...
@@ -1779,20 +1768,59 @@ menu_translate (const gchar *path,
if
(
item_factory
)
domain
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"textdomain"
);
if
(
domain
)
/* use the plugin
s
textdomain */
if
(
domain
)
/* use the plugin textdomain */
{
g_free
(
menupath
);
menupath
=
g_strconcat
(
factory
,
path
,
NULL
);
translation
=
dgettext
(
domain
,
menupath
);
complete
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
if
(
complete
)
{
/*
* This is a branch, use the complete path for translation,
* then strip off entries from the end until it matches.
*/
translation
=
g_strdup
(
dgettext
(
domain
,
complete
));
complete
=
g_strdup
(
complete
);
while
(
*
complete
&&
*
translation
&&
strcmp
(
complete
,
menupath
))
{
p
=
strrchr
(
complete
,
'/'
);
t
=
strrchr
(
translation
,
'/'
);
if
(
p
&&
t
)
{
*
p
=
'\0'
;
*
t
=
'\0'
;
}
else
break
;
}
g_free
(
complete
);
}
else
{
translation
=
dgettext
(
domain
,
menupath
);
}
/*
* Work around a bug in GTK+ prior to 1.2.7 (similar workaround below)
*/
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
retval
=
translation
+
strlen
(
factory
);
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
{
retval
=
translation
+
strlen
(
factory
);
if
(
complete
)
{
/* assign the result to menu_path, so it gets freed on next call */
g_free
(
menupath
);
menupath
=
translation
;
}
}
else
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
{
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
if
(
complete
)
g_free
(
translation
);
}
}
else
{
...
...
app/widgets/gimpitemfactory.c
View file @
e477d76b
...
...
@@ -71,29 +71,6 @@ static void help_debug_cmd_callback (GtkWidget *widget,
gpointer
callback_data
,
guint
callback_action
);
#ifdef ENABLE_NLS
/* from main.c */
extern
gchar
*
plugin_domains
[];
extern
gint
n_plugin_domains
;
/* for i18n */
static
gchar
G_GNUC_UNUSED
*
dummy_entries
[]
=
{
/* <Image> */
N_
(
"/Filters/Colors/Map"
),
N_
(
"/Filters/Render/Clouds"
),
N_
(
"/Filters/Render/Nature"
),
N_
(
"/Filters/Render/Pattern"
),
N_
(
"/Filters/Misc"
),
/* Perl-Fu */
N_
(
"/Xtns/Animation"
),
N_
(
"/Guides"
),
};
#endif
/* ENABLE_NLS */
static
GSList
*
last_opened_raw_filenames
=
NULL
;
/***** <Toolbox> *****/
...
...
@@ -942,10 +919,8 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
while
(
p
)
{
g_string_assign
(
tearoff_path
,
entry
->
entry
.
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
entry
->
entry
.
path
+
1
-
factory_length
);
g_string_append
(
tearoff_path
,
"tearoff1"
);
g_string_assign
(
tearoff_path
,
path
+
factory_length
);
g_string_truncate
(
tearoff_path
,
p
-
path
-
factory_length
);
if
(
!
gtk_item_factory_get_widget
(
item_factory
,
tearoff_path
->
str
))
...
...
@@ -956,7 +931,19 @@ menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
NULL
,
NULL
};
GimpItemFactoryEntry
branch_entry
=
{
{
NULL
,
NULL
,
NULL
,
0
,
"<Branch>"
},
NULL
,
NULL
};
branch_entry
.
entry
.
path
=
tearoff_path
->
str
;
gtk_object_set_data
(
GTK_OBJECT
(
item_factory
),
"complete"
,
path
);
menus_create_item
(
item_factory
,
&
branch_entry
,
NULL
,
2
);
gtk_object_remove_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
g_string_append
(
tearoff_path
,
"/tearoff1"
);
tearoff_entry
.
entry
.
path
=
tearoff_path
->
str
;
menus_create_item
(
item_factory
,
&
tearoff_entry
,
NULL
,
2
);
}
...
...
@@ -1761,6 +1748,8 @@ menu_translate (const gchar *path,
gchar
*
factory
;
gchar
*
translation
;
gchar
*
domain
=
NULL
;
gchar
*
complete
=
NULL
;
gchar
*
p
,
*
t
;
factory
=
(
gchar
*
)
data
;
...
...
@@ -1779,20 +1768,59 @@ menu_translate (const gchar *path,
if
(
item_factory
)
domain
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"textdomain"
);
if
(
domain
)
/* use the plugin
s
textdomain */
if
(
domain
)
/* use the plugin textdomain */
{
g_free
(
menupath
);
menupath
=
g_strconcat
(
factory
,
path
,
NULL
);
translation
=
dgettext
(
domain
,
menupath
);
complete
=
gtk_object_get_data
(
GTK_OBJECT
(
item_factory
),
"complete"
);
if
(
complete
)
{
/*
* This is a branch, use the complete path for translation,
* then strip off entries from the end until it matches.
*/
translation
=
g_strdup
(
dgettext
(
domain
,
complete
));
complete
=
g_strdup
(
complete
);
while
(
*
complete
&&
*
translation
&&
strcmp
(
complete
,
menupath
))
{
p
=
strrchr
(
complete
,
'/'
);
t
=
strrchr
(
translation
,
'/'
);
if
(
p
&&
t
)
{
*
p
=
'\0'
;
*
t
=
'\0'
;
}
else
break
;
}
g_free
(
complete
);
}
else
{
translation
=
dgettext
(
domain
,
menupath
);
}
/*
* Work around a bug in GTK+ prior to 1.2.7 (similar workaround below)
*/
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
retval
=
translation
+
strlen
(
factory
);
if
(
strncmp
(
factory
,
translation
,
strlen
(
factory
))
==
0
)
{
retval
=
translation
+
strlen
(
factory
);
if
(
complete
)
{
/* assign the result to menu_path, so it gets freed on next call */
g_free
(
menupath
);
menupath
=
translation
;
}
}
else
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
{
g_warning
(
"bad translation for menupath: %s"
,
menupath
);
if
(
complete
)
g_free
(
translation
);
}
}
else
{
...
...
plug-ins/gap/gap_frontends_main.c
View file @
e477d76b
...
...
@@ -75,14 +75,6 @@ static char *gap_main_version = "1.1.11b; 1999/11/20";
int
gap_debug
=
0
;
/* for i18n */
static
gchar
G_GNUC_UNUSED
*
dummy_entries
[]
=
{
N_
(
"<Image>/Video"
),
N_
(
"<Image>/Video/Encode"
)
};
static
void
query
(
void
);
static
void
run
(
char
*
name
,
int
nparam
,
GParam
*
param
,
int
*
nretvals
,
GParam
**
retvals
);
...
...
plug-ins/perl/po/de.po
View file @
e477d76b
...
...
@@ -663,7 +663,7 @@ msgid "TYPE"
msgstr "TYP"
msgid "<Image>/Guides/To Selection"
msgstr "<Image>/
Guides
/Als Auswahl"
msgstr "<Image>/
Hilfslinien
/Als Auswahl"
msgid "<Image>/Filters/Noise/Feedback"
msgstr "<Image>/Filter/Noise/Feedback"
...
...
@@ -758,7 +758,7 @@ msgid "only blessed scalars accepted here"
msgstr "Objekt (nicht Referenz oder Skalar) bentigt"
msgid "<Image>/Guides/Center Guide"
msgstr ""
msgstr "
<Image>/Hilfslinien/Zentriert
"
msgid "illegal parasite specification, arrayref expected"
msgstr "Illegaler Typ fr 'parasite', erwarte Referenz auf Array"
...
...
plug-ins/script-fu/script-fu.c
View file @
e477d76b
...
...
@@ -121,26 +121,6 @@ sfquit (void)
static
void
query
(
void
)
{
static
gchar
G_GNUC_UNUSED
*
dummy_entries
[]
=
{
N_
(
"<Toolbox>/Xtns/Script-Fu"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Logos"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Patterns"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Web Page Themes"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Utils"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Buttons"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Make Brush"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Misc"
),
N_
(
"<Toolbox>/Xtns/Script-Fu/Test"
),
N_
(
"<Image>/Script-Fu/Decor"
),
N_
(
"<Image>/Script-Fu/Utils"
),
N_
(
"<Image>/Script-Fu/Animators"
),
N_
(
"<Image>/Script-Fu/Stencil Ops"
),
N_
(
"<Image>/Script-Fu/Alchemy"
),