summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-10-10 14:08:47 -0400
committerPatrick Griffis <tingping@tingping.se>2016-10-10 14:11:08 -0400
commit2a81b98e7bcad05bf54d9c423f68df6492ae4326 (patch)
treeb41934d68f88263338d08c9c0e83ba0c8070c833
parentbb8f0beabe25823fb2ea6190af58de98b4a4b05a (diff)
Don't abort if translated text event fails
At least try the untranslated one...

Also while at it don't present a ton of dialogs to the user
about this failure, they wouldn't even know what to do with
that information.
-rw-r--r--src/common/text.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/common/text.c b/src/common/text.c
index 1e9b3132..e491b512 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -1517,27 +1517,38 @@ void
 pevent_make_pntevts (void)
 {
 	int i, m;
-	char out[1024];
 
 	for (i = 0; i < NUM_XP; i++)
 	{
 		g_free (pntevts[i]);
 		if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0)
 		{
-			g_snprintf (out, sizeof (out),
-						 _("Error parsing event %s.\nLoading default."), te[i].name);
-			fe_message (out, FE_MSG_WARN);
-			g_free (pntevts_text[i]);
 			/* make-te.c sets this 128 flag (DON'T call gettext() flag) */
-			if (te[i].num_args & 128)
+			const gboolean translate = !(te[i].num_args & 128);
+
+			g_warning ("Error parsing event %s\nLoading default.", te[i].name);
+			g_free (pntevts_text[i]);
+
+			if (translate)
+				pntevts_text[i] = g_strdup (_(te[i].def));
+			else
 				pntevts_text[i] = g_strdup (te[i].def);
+
+			if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0 && !translate)
+			{
+				g_error ("HexChat CRITICAL *** default event text failed to build!");
+			}
 			else
-				pntevts_text[i] = g_strdup (_(te[i].def));
-			if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0)
 			{
-				fprintf (stderr,
-							"HexChat CRITICAL *** default event text failed to build!\n");
-				abort ();
+				g_warning ("Error parsing translated event %s\nLoading untranslated.", te[i].name);
+				g_free (pntevts_text[i]);
+
+				pntevts_text[i] = g_strdup (te[i].def);
+
+				if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0)
+				{
+					g_error ("HexChat CRITICAL *** default event text failed to build!");
+				}
 			}
 		}
 	}