Re: I18n in plugin



Le lundi 22 mai 2006 �4:06 +0800, Yang Hong a �it :
> 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).

I don't see why. I do that quite often and it work. The trick is to
include gi18n-lib.h instead of gi18n.h

> 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
> 
> _______________________________________________
> desktop-devel-list mailing list
> desktop-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/desktop-devel-list
> 




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