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

Dennis Preiser dennis at d--p.de
Wed Nov 15 12:56:13 CET 2023


I've moved some strings to lang.c.

Dennis
-------------- next part --------------
--- a/include/extern.h
+++ b/include/extern.h
@@ -466,6 +466,9 @@ extern constext *txt_wildcard_type[];
 extern constext txt_1_resp[];
 extern constext txt_7bit[];
 extern constext txt_8bit[];
+#if defined(NNTP_ABLE) && defined(HAVE_SELECT)
+	extern constext txt_abort_reading[];
+#endif /* defined(NNTP_ABLE) && defined(HAVE_SELECT) */
 extern constext txt_active_file_is_empty[];
 extern constext txt_all[];
 extern constext txt_all_groups[];
@@ -552,6 +555,9 @@ extern constext txt_base_article_range[];
 extern constext txt_batch_update_unavail[];
 extern constext txt_begin_of_art[];
 extern constext txt_begin_of_page[];
+#if !defined(HAVE_LIBUU) && defined(HAVE_SUM) && !defined(DONT_HAVE_PIPING)
+	extern constext txt_bytes[];
+#endif /* !defined(HAVE_LIBUU) && defined(HAVE_SUM) && !defined(DONT_HAVE_PIPING) */
 #ifdef NNTP_ABLE
 	extern constext txt_caching_off[];
 	extern constext txt_caching_on[];
@@ -1226,6 +1232,7 @@ extern constext txt_not_in_active_file[];
 extern constext txt_nrctbl_create[];
 extern constext txt_nrctbl_default[];
 extern constext txt_nrctbl_info[];
+extern constext txt_null[];
 extern constext txt_only[];
 extern constext txt_option_not_enabled[];
 extern constext txt_options_menu[];
@@ -1372,6 +1379,9 @@ extern constext txt_select_subj[];
 extern constext txt_select_text[];
 extern constext txt_select_thread[];
 extern constext txt_select_time[];
+extern constext txt_selection_flag_insecure[];
+extern constext txt_selection_flag_secure[];
+extern constext txt_selection_flag_only_unread[];
 extern constext txt_send_bugreport[];
 #ifdef NNTP_ABLE
 	extern constext txt_server_name_in_file_env_var[];
@@ -1406,6 +1416,7 @@ extern constext txt_thread_x_of_n[];
 extern constext txt_threading_arts[];
 extern constext txt_threading_by_multipart[];
 extern constext txt_time_default_days[];
+extern constext txt_tin_version[];
 extern constext txt_tinrc_defaults[];
 extern constext txt_tinrc_filter[];
 extern constext txt_tinrc_header[];
@@ -1541,6 +1552,9 @@ extern constext txt_writing_attributes_file[];
 extern constext txt_writing_group[];
 extern constext txt_writing_overview[];
 extern constext txt_x_resp[];
+#if defined(NNTP_ABLE) && defined(XHDR_XREF)
+	extern constext txt_xref_loop[];
+#endif /* NNTP_ABLE && XHDR_XREF */
 extern constext txt_yanked_groups[];
 extern constext txt_yanked_none[];
 extern constext txt_yanked_sub_groups[];
--- a/src/art.c
+++ b/src/art.c
@@ -2375,7 +2375,7 @@ read_overview(
 
 		if (found) {
 			snprintf(cbuf, sizeof(cbuf), "%s XREF %"T_ARTNUM_PFMT"-%"T_ARTNUM_PFMT, nntp_caps.hdr_cmd, min, MAX(min, max));
-			group_msg = fmt_string("%s XREF loop", nntp_caps.hdr_cmd); /* TODO: find a better message, move to lang.c */
+			group_msg = fmt_string(txt_xref_loop, nntp_caps.hdr_cmd); /* TODO: find a better message */
 			if ((fp = nntp_command(cbuf, nntp_caps.hdr ? OK_HDR : OK_HEAD, NULL, 0)) != NULL) { /* RFC 2980 (XHDR) uses 221; RFC 3977 (HDR) uses 225 */
 				while ((ptr = tin_fgets(fp, FALSE)) != NULL) {
 #	ifdef DEBUG
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -279,7 +279,7 @@ printascii(
 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
 {
 	if (ch == 0)
-		snprintf(buf, MAXKEYLEN, "%s", _("NULL")); /* TODO: -> lang.c */
+		snprintf(buf, MAXKEYLEN, "%s", _(txt_null));
 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
 	else if (iswgraph(ch)) {	/* Regular printables */
 		int i = wctomb(buf, (wchar_t) ch);
--- a/src/lang.c
+++ b/src/lang.c
@@ -47,6 +47,9 @@ constext txt_7bit[] = "7bit";
 constext txt_8bit[] = "8bit";
 
 constext txt_active_file_is_empty[] = N_("\n%s contains no newsgroups. Exiting.");
+#if defined(NNTP_ABLE) && defined(HAVE_SELECT)
+	constext txt_abort_reading[] = N_("Aborting read, please wait...");
+#endif /* defined(NNTP_ABLE) && defined(HAVE_SELECT) */
 constext txt_all[] = N_("all");
 constext txt_all_groups[] = N_("All groups");
 constext txt_append_overwrite_quit[] = N_("File %s exists. %s=append, %s=overwrite, %s=quit: ");
@@ -133,6 +136,9 @@ constext txt_base_article_range[] = N_("Base article range");
 constext txt_batch_update_unavail[] = N_("%s: Updating of index files not supported: cache_overview_files=%s");
 constext txt_begin_of_art[] = N_("*** Beginning of article ***");
 constext txt_begin_of_page[] = N_("*** Beginning of page ***");
+#if !defined(HAVE_LIBUU) && defined(HAVE_SUM) && !defined(DONT_HAVE_PIPING)
+	constext txt_bytes[] = N_("bytes");
+#endif /* !defined(HAVE_LIBUU) && defined(HAVE_SUM) && !defined(DONT_HAVE_PIPING) */
 
 constext txt_cancel_article[] = N_("Cancel (delete) or supersede (overwrite) article [%%s]? (%s/%s/%s): ");
 constext txt_cancelling_art[] = N_("Cancelling article...");
@@ -824,6 +830,7 @@ constext txt_nrctbl_info[] = N_("# NNTP-server -> newsrc translation table and N
 # if <newsrc file> is given without path, $HOME is assumed as its location\n\
 #\n# examples:\n#   news.tin.org      .newsrc-tin.org  tinorg\n\
 #   news.example.org  /tmp/nrc-ex      example    ex\n#\n");
+constext txt_null[] = N_("NULL");
 
 constext txt_only[] = N_("Only");
 constext txt_option_not_enabled[] = N_("Option not enabled. Recompile with %s.");
@@ -928,6 +935,9 @@ constext txt_select_scope[] = N_("Select pattern scope: ");
 constext txt_select_subj[] = N_("Select Subject [%s] (y/n): ");
 constext txt_select_text[] = N_("Select text pattern : ");
 constext txt_select_time[] = N_("Select time in days   : ");
+constext txt_selection_flag_insecure[] = N_("[k]");
+constext txt_selection_flag_secure[] = N_("[T]");
+constext txt_selection_flag_only_unread[] = N_(" R");
 constext txt_serverconfig_header[] = N_("# %s server configuration file\n\
 # This file was automatically saved by %s %s %s (\"%s\")\n#\n\
 # Do not edit while %s is running, since all your changes to this file\n\
@@ -993,6 +1003,11 @@ constext txt_suspended_message[] = N_("\nStopped. Type 'fg' to restart %s\n");
 constext txt_time_default_days[] = N_("%d days");
 constext txt_tab[] = N_("<TAB>");
 constext txt_tex[] = N_("TeX ");
+#if defined(__DATE__) && defined(__TIME__)
+	constext txt_tin_version[] = N_("Version: %s %s release %s (\"%s\") %s %s\n");
+#else
+	constext txt_tin_version[] = N_("Version: %s %s release %s (\"%s\")\n");
+#endif /* __DATE__ && __TIME__ */
 constext txt_tinrc_defaults[] = N_("# Default action/prompt strings\n");
 constext txt_tinrc_filter[] = N_("# Defaults for quick (1 key) kill & auto-selection filters\n\
 # header=NUM  0,1=Subject: 2,3=From: 4=Message-ID: & full References: line\n\
@@ -1140,6 +1155,9 @@ constext txt_writing_group[] = N_("Writing %s\n");
 constext txt_writing_overview[] = N_("Writing overview cache...");
 
 constext txt_x_resp[] = N_("%4d Responses");
+#if defined(NNTP_ABLE) && defined(XHDR_XREF)
+	constext txt_xref_loop[] = "%s XREF loop";
+#endif /* NNTP_ABLE && XHDR_XREF */
 
 constext txt_yanked_groups[] = N_("Added %d %s");
 constext txt_yanked_none[] = N_("No unsubscribed groups to show");
--- a/src/misc.c
+++ b/src/misc.c
@@ -3975,14 +3975,11 @@ tin_version_info(
 	int pcre2_version_length;
 #endif /* HAVE_LIB_PCRE2 */
 
+	fprintf(fp, _(txt_tin_version), PRODUCT, VERSION, RELEASEDATE, RELEASENAME
 #if defined(__DATE__) && defined(__TIME__)
-	/*TODO: -> lang.c */
-	fprintf(fp, _("Version: %s %s release %s (\"%s\") %s %s\n"),
-		PRODUCT, VERSION, RELEASEDATE, RELEASENAME, __DATE__, __TIME__);
-#else
-	fprintf(fp, _("Version: %s %s release %s (\"%s\")\n"),
-		PRODUCT, VERSION, RELEASEDATE, RELEASENAME);
+		, __DATE__, __TIME__
 #endif /* __DATE__ && __TIME__ */
+		);
 	wlines++;
 
 #ifdef SYSTEM_NAME
--- a/src/read.c
+++ b/src/read.c
@@ -201,7 +201,7 @@ tin_read(
 #ifdef NNTP_ABLE
 #	ifdef HAVE_SELECT
 	if (wait_for_input()) {			/* Check if okay to read */
-		info_message(_("Aborting read, please wait...")); /* TODO: -> lang.c */
+		info_message(_(txt_abort_reading));
 		drain_buffer(fp);
 		clear_message();
 		tin_errno = TIN_ABORT;
--- a/src/save.c
+++ b/src/save.c
@@ -1046,7 +1046,7 @@ sum_file(
 		fflush(fp_in);
 		pclose(fp_in);
 
-		my_printf(_(txt_checksum_of_file), file, file_size(path), _("bytes")); /* TODO: -> lang.c */
+		my_printf(_(txt_checksum_of_file), file, file_size(path), _(txt_bytes));
 		my_printf(cCRLF);
 		my_printf("\t%s%s", buf, cCRLF);
 	} else {
--- a/src/select.c
+++ b/src/select.c
@@ -616,15 +616,15 @@ show_selection_page(
 
 	if (use_nntps) {
 		if (insecure_nntps)
-			secflag=_("[k]"); /* TODO: -> lang.c */
+			secflag=_(txt_selection_flag_insecure);
 		else
-			secflag=_("[T]"); /* TODO: -> lang.c */
+			secflag=_(txt_selection_flag_secure);
 	}
 
 	if (read_news_via_nntp)
-		snprintf(buf, sizeof(buf), "%s (%s%s  %d%s)", _(txt_group_selection), nntp_server, secflag, selmenu.max, (tinrc.show_only_unread_groups ? _(" R") : "")); /* TODO: -> " R" lang.c */
+		snprintf(buf, sizeof(buf), "%s (%s%s  %d%s)", _(txt_group_selection), nntp_server, secflag, selmenu.max, (tinrc.show_only_unread_groups ? _(txt_selection_flag_only_unread) : ""));
 	else
-		snprintf(buf, sizeof(buf), "%s (%d%s)", _(txt_group_selection), selmenu.max, (tinrc.show_only_unread_groups ? _(" R") : "")); /* TODO: -> " R" lang.c */
+		snprintf(buf, sizeof(buf), "%s (%d%s)", _(txt_group_selection), selmenu.max, (tinrc.show_only_unread_groups ? _(txt_selection_flag_only_unread) : ""));
 
 	if (selmenu.curr < 0)
 		selmenu.curr = 0;


More information about the tin-dev mailing list