Adding a hint to main_locale_init() to plugin HowTo

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5879 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Frank Lanitz 2011-07-31 17:37:12 +00:00
parent 3ee49c6e93
commit 9aaeea1fd6
2 changed files with 27 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* doc/plugins.dox:
Adding some content about PLUGIN_SET_TRANSLATABLE_INFO() into plugin
HowTo.
HowTo as well as a hint to make usage of main_locale_init().

View File

@ -425,4 +425,30 @@ PLUGIN_SET_TRANSLATABLE_INFO(
* been agreed to use if possible latin version of author's name
* followed by in case of its apply able nativ spelling inside braces.
*
* @subsection plugin_i18n Using i18n/l10n inside Plugin
*
* Not only the meta information of a plugin shall be translateable,
* but also the text like menu entries, information boxes or strings
* inside configuration dialog should be translateable too. Geany is
* offering a way to enable this from code point of view by using a
* function provided by the Geany API -- main_locale_init().
* The function is taking over two parameters LOCALEDIR and
* GETTEXT_PACKAGE which we already know from previous sesction.
* As the function is called best on plugin initialization, it should be
* placed into plugin_init() so the hello world example could look like:
* @code
void plugin_init(GeanyData *data)
{
main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
main_menu_item = gtk_menu_item_new_with_mnemonic("Hello World");
gtk_widget_show(main_menu_item);
gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu),
main_menu_item);
g_signal_connect(main_menu_item, "activate",
G_CALLBACK(item_activate_cb), NULL);
}
* @endcode
**/