[tin-dev] [PATCH] misc.c: strings moved to lang.c

Dennis Preiser dennis at d--p.de
Mon Nov 13 18:50:50 CET 2023


I've moved strings from misc.c to lang.c.

Dennis
-------------- next part --------------
--- a/include/extern.h
+++ b/include/extern.h
@@ -610,6 +610,38 @@ extern constext txt_confirm_select_on_exit[];
 	extern constext txt_connection_to[];
 #endif /* NNTP_ABLE && !INET6 */
 extern constext txt_connection_info[];
+extern constext txt_conninfo_local_spool[];
+extern constext txt_conninfo_saved_news[];
+#ifndef NNTP_ONLY
+	extern constext txt_conninfo_active_file[];
+	extern constext txt_conninfo_active_times_file[];
+	extern constext txt_conninfo_newsgroups_file[];
+	extern constext txt_conninfo_novrootdir[];
+	extern constext txt_conninfo_overview_file[];
+	extern constext txt_conninfo_overview_fmt[];
+	extern constext txt_conninfo_spool_config[];
+	extern constext txt_conninfo_spooldir[];
+	extern constext txt_conninfo_subscriptions_file[];
+#endif /* !NNTP_ONLY */
+#if defined(NNTP_ABLE)
+	extern constext txt_conninfo_nntp[];
+	extern constext txt_conninfo_ro[];
+	extern constext txt_conninfo_rw[];
+#	if defined(NNTPS_ABLE)
+	extern constext txt_conninfo_nntps[];
+	extern constext txt_conninfo_trusted[];
+	extern constext txt_conninfo_untrusted[];
+#		ifdef HAVE_LIB_GNUTLS
+		extern constext txt_conninfo_gnutls[];
+#		endif /* HAVE_LIB_GNUTLS */
+#		ifdef HAVE_LIB_LIBTLS
+		extern constext txt_conninfo_libressl[];
+#		endif /* HAVE_LIB_LIBTLS */
+#		ifdef HAVE_LIB_OPENSSL
+		extern constext txt_conninfo_openssl[];
+#		endif /* HAVE_LIB_OPENSSL */
+#	endif /* NNTPS_ABLE */
+#endif /* NNTP_ABLE */
 extern constext txt_copyright_notice[];
 extern constext txt_cr[];
 extern constext txt_creating_active[];
--- a/src/lang.c
+++ b/src/lang.c
@@ -169,6 +169,38 @@ constext txt_command_failed[] = N_("Command failed: %s");
 constext txt_copyright_notice[] = "%s (c) Copyright 1991-2024 Iain Lea.";
 constext txt_confirm_select_on_exit[] = N_("Mark not selected articles read?");
 constext txt_connection_info[] = N_("Connection Info");
+constext txt_conninfo_local_spool[] = N_("Reading from local spool.\n");
+constext txt_conninfo_saved_news[] = N_("Reading saved news.\n");
+#ifndef NNTP_ONLY
+	constext txt_conninfo_active_file[] = "ACTIVE_FILE       : %s\n";
+	constext txt_conninfo_active_times_file[] = "ACTIVE_TIMES_FILE : %s\n";
+	constext txt_conninfo_newsgroups_file[] = "NEWSGROUPS_FILE   : %s\n";
+	constext txt_conninfo_novrootdir[] = "NOVROOTDIR        : %s\n";
+	constext txt_conninfo_overview_file[] = "OVERVIEW_FILE     : %s\n";
+	constext txt_conninfo_overview_fmt[] = "OVERVIEW_FMT      : %s\n";
+	constext txt_conninfo_spool_config[] = N_("\nLocal spool config:\n-------------------\n");
+	constext txt_conninfo_spooldir[] = "SPOOLDIR          : %s\n";
+	constext txt_conninfo_subscriptions_file[] = "SUBSCRIPTIONS_FILE: %s\n";
+#endif /* !NNTP_ONLY */
+#if defined(NNTP_ABLE)
+	constext txt_conninfo_nntp[] = N_("Reading via NNTP (%s).\n");
+	constext txt_conninfo_ro[] = N_("read only");
+	constext txt_conninfo_rw[] = N_("read/write");
+#	if defined(NNTPS_ABLE)
+	constext txt_conninfo_nntps[] = N_("Reading %s via NNTPS (%s; ");
+	constext txt_conninfo_trusted[] = N_("trusted");
+	constext txt_conninfo_untrusted[] = N_("untrusted");
+#		ifdef HAVE_LIB_GNUTLS
+		constext txt_conninfo_gnutls[] = "GnuTLS %s).\n";
+#		endif /* HAVE_LIB_GNUTLS */
+#		ifdef HAVE_LIB_LIBTLS
+		constext txt_conninfo_libressl[] = "LibreSSL %d).\n";
+#		endif /* HAVE_LIB_LIBTLS */
+#		ifdef HAVE_LIB_OPENSSL
+		constext txt_conninfo_openssl[] = "%s).\n";
+#		endif /* HAVE_LIB_OPENSSL */
+#	endif /* NNTPS_ABLE */
+#endif /* NNTP_ABLE */
 constext txt_cook_article_failed_exiting[] = N_("Cook article failed, %s is exiting");
 constext txt_cr[] = N_("<CR>");
 constext txt_creating_active[] = N_("Creating active file for saved groups...\n");
--- a/src/misc.c
+++ b/src/misc.c
@@ -4385,31 +4385,30 @@ show_connection_page(
  * TODO:
  * - detected NNTP features
  * - connection type (IPv4 vs IPv6), remote IP, ...
- * - strings to lang.c
  */
 static void
 make_connection_page(
 	FILE *fp)
 {
 	if (!read_news_via_nntp)
-		fprintf(fp, "Reading from local spool.\n");
+		fprintf(fp, "%s", _(txt_conninfo_local_spool));
 	else {
 		if (read_saved_news)
-			fprintf(fp, "Reading saved news.\n");
+			fprintf(fp, "%s", _(txt_conninfo_saved_news));
 #if defined(NNTP_ABLE)
 #	if defined(NNTPS_ABLE)
 		else {
 			if (use_nntps) {
-				fprintf(fp, "Reading %s via NNTPS (%s; ", insecure_nntps ? "untrusted" : "trusted", can_post ? "read/write" : "read only");
+				fprintf(fp, _(txt_conninfo_nntps), insecure_nntps ? _(txt_conninfo_untrusted) : _(txt_conninfo_trusted), can_post ? _(txt_conninfo_rw) : _(txt_conninfo_ro));
 
 #		ifdef HAVE_LIB_LIBTLS
-			fprintf(fp, "LibreSSL %d).\n", TLS_API);
+				fprintf(fp, txt_conninfo_libressl, TLS_API);
 #		else
 #			ifdef HAVE_LIB_OPENSSL
-			fprintf(fp, "%s).\n", OpenSSL_version(OPENSSL_VERSION));
+				fprintf(fp, txt_conninfo_openssl, OpenSSL_version(OPENSSL_VERSION));
 #			else
 #				ifdef HAVE_LIB_GNUTLS
-			fprintf(fp, "GnuTLS %s).\n", gnutls_check_version(NULL));
+				fprintf(fp, txt_conninfo_gnutls, gnutls_check_version(NULL));
 #				endif /* HAVE_LIB_GNUTLS */
 #			endif /* HAVE_LIB_OPENSSL */
 #		endif /* HAVE_LIB_LIBTLS */
@@ -4418,7 +4417,7 @@ make_connection_page(
 			{
 #	endif /* NNTPS_ABLE */
 			{
-				fprintf(fp, "Reading via NNTP (%s).\n", can_post ? "read/write" : "read only");
+				fprintf(fp, _(txt_conninfo_nntp), can_post ? _(txt_conninfo_rw) : _(txt_conninfo_ro));
 			}
 
 			(void) nntp_conninfo(fp);
@@ -4427,16 +4426,15 @@ make_connection_page(
 	}
 #ifndef NNTP_ONLY
 	if (!read_news_via_nntp && !read_saved_news) {
-		fprintf(fp, "\nLocal spool config:\n");
-		fprintf(fp, "-------------------\n");
-		fprintf(fp, "SPOOLDIR          : %s\n", spooldir);
-		fprintf(fp, "NOVROOTDIR        : %s\n", novrootdir);
-		fprintf(fp, "OVERVIEW_FILE     : %s\n", novfilename);
-		fprintf(fp, "OVERVIEW_FMT      : %s\n", overviewfmt_file);
-		fprintf(fp, "NEWSGROUPS_FILE   : %s\n", newsgroups_file);
-		fprintf(fp, "ACTIVE_FILE       : %s\n", news_active_file);
-		fprintf(fp, "ACTIVE_TIMES_FILE : %s\n", active_times_file);
-		fprintf(fp, "SUBSCRIPTIONS_FILE: %s\n", subscriptions_file);
+		fprintf(fp, "%s", txt_conninfo_spool_config);
+		fprintf(fp, txt_conninfo_spooldir, spooldir);
+		fprintf(fp, txt_conninfo_novrootdir, novrootdir);
+		fprintf(fp, txt_conninfo_overview_file, novfilename);
+		fprintf(fp, txt_conninfo_overview_fmt, overviewfmt_file);
+		fprintf(fp, txt_conninfo_newsgroups_file, newsgroups_file);
+		fprintf(fp, txt_conninfo_active_file, news_active_file);
+		fprintf(fp, txt_conninfo_active_times_file, active_times_file);
+		fprintf(fp, txt_conninfo_subscriptions_file, subscriptions_file);
 	}
 #endif /* !NNTP_ONLY */
 }


More information about the tin-dev mailing list