[geany/geany-plugins] c70326: GeanyMiniScript: Fix I18N setup

Colomban Wendling git-noreply at xxxxx
Mon Feb 25 14:59:41 UTC 2013


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 25 Feb 2013 14:59:41 UTC
Commit:      c70326ee205038685d8b707e03b8ec209f401c28
             https://github.com/geany/geany-plugins/commit/c70326ee205038685d8b707e03b8ec209f401c28

Log Message:
-----------
GeanyMiniScript: Fix I18N setup


Modified Paths:
--------------
    geanyminiscript/src/gms.c
    geanyminiscript/src/gms_gui.c

Modified: geanyminiscript/src/gms.c
43 files changed, 7 insertions(+), 36 deletions(-)
===================================================================
@@ -28,6 +28,8 @@
  * note: the script filter could be : Unix shell, perl , python , sed ,awk ...
  */
 
+#include    "config.h"
+
 #include    <geanyplugin.h>
 
 /* headers */
@@ -35,10 +37,6 @@
 #include    <glib.h>
 #include    <glib/gstdio.h>
 
-#ifdef HAVE_LOCALE_H
-#include    <locale.h>
-#endif
-
 /* user header */
 #include    "gms.h"
 #include    "gms_gui.h"
@@ -55,8 +53,11 @@
 PLUGIN_VERSION_CHECK(100)
 
 /* All plugins must set name, description, version and author. */
-PLUGIN_SET_INFO(_("Mini Script"), _("A tool to apply a script filter on a text selection or current document(s)"),
-                    "0.1" , _("Pascal BURLOT, a Geany user"))
+PLUGIN_SET_TRANSLATABLE_INFO(
+    LOCALEDIR, GETTEXT_PACKAGE,
+    _("Mini Script"),
+    _("A tool to apply a script filter on a text selection or current document(s)"),
+    "0.1" , _("Pascal BURLOT, a Geany user"))
 
 static GtkWidget     *gms_item   = NULL ;
 static gms_handle_t gms_hnd     = NULL ;
@@ -231,34 +232,6 @@ static void item_activate(GtkMenuItem *menuitem, gpointer gdata)
 
 }
 
- /**
- * \brief the function initializes the localization for the gms plugin
- */
-static void locale_init(void)
-{
-#ifdef ENABLE_NLS
-	gchar *locale_dir = NULL;
-
-#ifdef HAVE_LOCALE_H
-	setlocale(LC_ALL, "");
-#endif
-
-#ifdef G_OS_WIN32
-	gchar *install_dir = g_win32_get_package_installation_directory("geany", NULL);
-	/* e.g. C:\Program Files\geany\lib\locale */
-	locale_dir = g_strconcat(install_dir, "\\share\\locale", NULL);
-	g_free(install_dir);
-#else
-	locale_dir = g_strdup(LOCALEDIR);
-#endif
-
-	bindtextdomain(GETTEXT_PACKAGE, locale_dir);
-	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-	textdomain(GETTEXT_PACKAGE);
-	g_free(locale_dir);
-#endif
-}
-
 
 /**
  * \brief Called by Geany to initialize the plugin.
@@ -266,8 +239,6 @@ static void locale_init(void)
  */
 void plugin_init(GeanyData *data)
 {
-    locale_init();
-
     gms_hnd = gms_new(geany->main_widgets->window,
                     data->interface_prefs->editor_font ,
                     data->editor_prefs->indentation->width,


Modified: geanyminiscript/src/gms_gui.c
5 files changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -25,6 +25,7 @@
  * \file  gms_gui.c
  * \brief it is the graphical user interface of the geany miniscript plugin
  */
+#include    "config.h"
 #include    "geany.h"
 
 #include    <glib/gstdio.h>
@@ -126,7 +127,7 @@
     "Shell", "Perl", "Python", "Sed", "Awk", "User" };
 
 /**< \brief It's the information message about geany mini script */
-const char *geany_info = "<b>GMS : Geany Mini-Script filter Plugin</b>\n"
+const char *geany_info = N_("<b>GMS : Geany Mini-Script filter Plugin</b>\n"
 "This plugin is a tool to apply a script filter on :\n"
 "   o the text selection,\n"
 "   o the current document,\n"
@@ -147,7 +148,7 @@
 "it and/or modify it under the terms of the GNU \n"
 "General Public License as published by the Free\n"
 "Software Foundation; either version 2 of the License,\n"
-"or (at your option) any later version." ;
+"or (at your option) any later version.");
 
 /*
  * *****************************************************************************



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list