I18n in plugin



Hi all,

There are many applications use plugin based architecture to expand it's
function, such as Evolution (EPlugin), Anjuta 2.x, Gedit, Gaim,
Xchat-gnome, etc. The problem is that if the plugins was released
outside of the main app, the user interface of the plugin is NOT I18n
able. even I added bindtextdomain(...) and bind_textdomain_codeset (...)
in the initialize code of the plugin.

In my anjuta-foobar-plugin [1]:

static void
anjuta_plugin_foobar_instance_init (GObject *obj)
{
	AnjutaFoobarPlugin *plugin = (AnjutaFoobarPlugin*)obj;

	bindtextdomain (GETTEXT_PACKAGE,  PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	/* textdomain (GETTEXT_PACKAGE); */
	
	plugin->uiid = 0;
	plugin->widget = NULL;

}

You cann't use textdomain (...) in a plugin, or you'll get all NEW
interface in english (un i18ned).

Yestoday, I got a remove-duplicates plugin for evolution 2.4 from
#342378 [2], after some hack it for evolution 2.6, added LINGUAS suport,
added zh_CN translate [3], intalled it and got a untranslate menu item
"Remove duplicates". and then I found that there is even not point to
add the bindtextdomain for it, there's only one entrance for this
plugin's functional. how can it could be i18ned?

void
org_gnome_duplicates_remove (EPlugin *ep, EMPopupTargetSelect *target)
{
  handle_messages (target->folder, target->uids);
}

[1]
http://www.gnome-cn.org/software/anjuta-plugin-foobar/releases/0.1/anjuta-plugin-foobar-0-1-tar.gz
[2] http://bugzilla.gnome.org/show_bug.cgi?id=342378
[3]
http://www.gnome-cn.org/software/remove-duplicates-plugin/releases/0.0.3/remove-duplicates-plugin-0-0-3-tar.gz

any comments?

Yang Hong




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]