Fix untranslated description in archiver plugin
authorRicardo Mones <ricardo@mones.org>
Wed, 24 Apr 2013 23:09:38 +0000 (01:09 +0200)
committerRicardo Mones <ricardo@mones.org>
Wed, 24 Apr 2013 23:09:38 +0000 (01:09 +0200)
gettext cannot evaluate preprocessor conditions affecting translatable
strings and only generates one msgid for the po file. If later the build
doesn't generate the same string as gettext, its msgid is never found
and hence appears untranslated on the UI.

src/plugins/archive/archiver.c

index 15c1cacb9361064c7a611b8d5bf94e3eb66e6ebc..e4dd351a9eaa8ae19328233c3aeb205005f9d87c 100644 (file)
@@ -55,6 +55,7 @@ static GtkActionEntry archiver_main_menu[] = {{
 }};
 
 static gint main_menu_id = 0;
+static char *plugin_description = NULL;
 
 gint plugin_init(gchar** error)
 {
@@ -87,6 +88,11 @@ gboolean plugin_done(void)
        MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "Tools/CreateArchive", main_menu_id);
        main_menu_id = 0;
 
+       if (plugin_description != NULL) {
+               g_free(plugin_description);
+               plugin_description = NULL;
+       }
+
        archiver_prefs_done();
        debug_print("archive plugin unloaded\n");
 
@@ -109,8 +115,15 @@ const gchar* plugin_name(void) {
        return PLUGIN_NAME;
 }
 
+#if NEW_ARCHIVE_API
+#define ARCHIVER_COMPRESS_FORMATS "\tGZIP/ZIP\n\tBZIP2\n\tCOMPRESS\n"
+#else
+#define ARCHIVER_COMPRESS_FORMATS "\tGZIP/ZIP\n\tBZIP2\n"
+#endif
+
 const gchar* plugin_desc(void) {
-       return _("This plugin adds archiving features to Claws Mail.\n"
+       if (plugin_description == NULL) {
+               plugin_description = g_strdup_printf(_("This plugin adds archiving features to Claws Mail.\n"
                        "\n"
                        "It enables you to select a mail folder that you want "
                        "to be archived, and then choose a name, format and "
@@ -121,11 +134,7 @@ const gchar* plugin_desc(void) {
                        "The archive can be stored as:\n"
                        "\tTAR\n\tPAX\n\tSHAR\n\tCPIO\n"
                        "\n"
-                       "The archive can be compressed using:\n"
-                       "\tGZIP/ZIP\n\tBZIP2\n"
-#if NEW_ARCHIVE_API
-                        "\tCOMPRESS\n"
-#endif
+                       "The archive can be compressed using:\n%s"
                        "\n"
                        "The archives can be restored with any standard tool "
                        "that supports the chosen format and compression.\n"
@@ -137,7 +146,9 @@ const gchar* plugin_desc(void) {
                        "\n"
                        "Default options can be set in /Configuration/Preferences/Plugins"
                        "/Mail Archiver"
-                       );
+                       ), ARCHIVER_COMPRESS_FORMATS);
+       }
+       return plugin_description;
 }
 
 struct PluginFeature* plugin_provides(void) {