]> git.draconx.ca Git - cdecl99.git/commitdiff
Output copyright symbol directly, rather than via translations.
authorNick Bowler <nbowler@draconx.ca>
Tue, 30 Jun 2020 03:54:43 +0000 (23:54 -0400)
committerNick Bowler <nbowler@draconx.ca>
Fri, 3 Jul 2020 01:44:51 +0000 (21:44 -0400)
The "(C)" isn't really a translatable string.  Instead of requiring
translations to deal with it, use Gnulib's str_iconv module to encode it
into the user's locale encoding.  We fall back to (C) if that fails for
any reason, or if NLS is disabled.

m4/.gitignore
m4/gnulib-cache.m4
po/en.po
src/cdecl99.c

index 2497a50b70711c4b3ea8b6150380c2927ee93cd0..ab28204011118c998dd1efdfec985e1ca9c38ef2 100644 (file)
@@ -1,5 +1,6 @@
 00gnulib.m4
 codeset.m4
 00gnulib.m4
 codeset.m4
+configmake.m4
 errno_h.m4
 extensions.m4
 extern-inline.m4
 errno_h.m4
 extensions.m4
 extern-inline.m4
@@ -14,7 +15,10 @@ gnulib-common.m4
 gnulib-comp.m4
 gnulib-tool.m4
 iconv.m4
 gnulib-comp.m4
 gnulib-tool.m4
 iconv.m4
+iconv_h.m4
+iconv_open.m4
 include_next.m4
 include_next.m4
+inline.m4
 intdiv0.m4
 intl.m4
 intldir.m4
 intdiv0.m4
 intl.m4
 intldir.m4
@@ -27,6 +31,8 @@ lib-ld.m4
 lib-link.m4
 lib-prefix.m4
 libtool.m4
 lib-link.m4
 lib-prefix.m4
 libtool.m4
+libunistring-base.m4
+localcharset.m4
 lock.m4
 longlong.m4
 ltoptions.m4
 lock.m4
 longlong.m4
 ltoptions.m4
@@ -45,6 +51,7 @@ readline.m4
 realloc.m4
 size_max.m4
 ssize_t.m4
 realloc.m4
 size_max.m4
 ssize_t.m4
+stdbool.m4
 stddef_h.m4
 stdint.m4
 stdint_h.m4
 stddef_h.m4
 stdint.m4
 stdint_h.m4
index 47059076739f1bbe4b5566e24b19d04dd27c3770..2a38a49a218dc50f426ebe7ac42059e74f57206f 100644 (file)
 
 
 # Specification in the form of a command-line invocation:
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk.in --conditional-dependencies --libtool --macro-prefix=gl --no-vc-files getopt-gnu gettext lock readline tls
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk.in --conditional-dependencies --libtool --macro-prefix=gl --no-vc-files getopt-gnu gettext localcharset lock readline striconv tls
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   getopt-gnu
   gettext
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   getopt-gnu
   gettext
+  localcharset
   lock
   readline
   lock
   readline
+  striconv
   tls
 ])
 gl_AVOID([])
   tls
 ])
 gl_AVOID([])
index af0943015497d2c7030506d2efca56645a4848ef..42dc6a004c972a23a050e4ab6cdd311c7c7b8bb9 100644 (file)
--- a/po/en.po
+++ b/po/en.po
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: cdecl99 0.1\n"
 "Report-Msgid-Bugs-To: nbowler@draconx.ca\n"
 msgstr ""
 "Project-Id-Version: cdecl99 0.1\n"
 "Report-Msgid-Bugs-To: nbowler@draconx.ca\n"
-"POT-Creation-Date: 2011-10-06 14:48-0400\n"
+"POT-Creation-Date: 2020-06-29 22:52-0400\n"
 "PO-Revision-Date: 2011-09-13 21:54-0400\n"
 "Last-Translator: Nick Bowler <nbowler@draconx.ca>\n"
 "Language-Team: English\n"
 "PO-Revision-Date: 2011-09-13 21:54-0400\n"
 "Last-Translator: Nick Bowler <nbowler@draconx.ca>\n"
 "Language-Team: English\n"
@@ -51,138 +51,136 @@ msgstr ""
 msgid "%s: invalid option -- '%c'\n"
 msgstr ""
 
 msgid "%s: invalid option -- '%c'\n"
 msgstr ""
 
-#: lib/getopt.c:858 lib/getopt.c:875 lib/getopt.c:1083 lib/getopt.c:1101
+#: lib/getopt.c:861 lib/getopt.c:878 lib/getopt.c:1088 lib/getopt.c:1106
 #, c-format
 msgid "%s: option requires an argument -- '%c'\n"
 msgstr ""
 
 #, c-format
 msgid "%s: option requires an argument -- '%c'\n"
 msgstr ""
 
-#: lib/getopt.c:931 lib/getopt.c:947
+#: lib/getopt.c:934 lib/getopt.c:950
 #, c-format
 msgid "%s: option '-W %s' is ambiguous\n"
 msgstr ""
 
 #, c-format
 msgid "%s: option '-W %s' is ambiguous\n"
 msgstr ""
 
-#: lib/getopt.c:971 lib/getopt.c:989
+#: lib/getopt.c:974 lib/getopt.c:992
 #, c-format
 msgid "%s: option '-W %s' doesn't allow an argument\n"
 msgstr ""
 
 #, c-format
 msgid "%s: option '-W %s' doesn't allow an argument\n"
 msgstr ""
 
-#: lib/getopt.c:1010 lib/getopt.c:1028
+#: lib/getopt.c:1013 lib/getopt.c:1031
 #, c-format
 msgid "%s: option '-W %s' requires an argument\n"
 msgstr ""
 
 #, c-format
 msgid "%s: option '-W %s' requires an argument\n"
 msgstr ""
 
-#: src/cdecl99.c:38
+#: src/cdecl99.c:43
 msgctxt "longopt"
 msgid "quiet"
 msgstr ""
 
 msgctxt "longopt"
 msgid "quiet"
 msgstr ""
 
-#: src/cdecl99.c:39
+#: src/cdecl99.c:44
 msgctxt "longopt"
 msgid "batch"
 msgstr ""
 
 msgctxt "longopt"
 msgid "batch"
 msgstr ""
 
-#: src/cdecl99.c:40
+#: src/cdecl99.c:45
 msgctxt "longopt"
 msgid "interactive"
 msgstr ""
 
 msgctxt "longopt"
 msgid "interactive"
 msgstr ""
 
-#: src/cdecl99.c:41
+#: src/cdecl99.c:46
 msgctxt "longopt"
 msgid "file"
 msgstr ""
 
 msgctxt "longopt"
 msgid "file"
 msgstr ""
 
-#: src/cdecl99.c:42
+#: src/cdecl99.c:47
 msgctxt "longopt"
 msgid "execute"
 msgstr ""
 
 msgctxt "longopt"
 msgid "execute"
 msgstr ""
 
-#: src/cdecl99.c:43
+#: src/cdecl99.c:48
 msgctxt "longopt"
 msgid "version"
 msgstr ""
 
 msgctxt "longopt"
 msgid "version"
 msgstr ""
 
-#: src/cdecl99.c:44
+#: src/cdecl99.c:49
 msgctxt "longopt"
 msgid "help"
 msgstr ""
 
 msgctxt "longopt"
 msgid "help"
 msgstr ""
 
-#: src/cdecl99.c:62
+#. TRANSLATORS: Help messages are indented 20 spaces and thus should
+#. not have lines longer than 60 columns.
+#.
+#: src/cdecl99.c:67
 msgid "Suppress the welcome message.\n"
 msgstr ""
 
 msgid "Suppress the welcome message.\n"
 msgstr ""
 
-#: src/cdecl99.c:63
+#: src/cdecl99.c:68
 msgid "Execute commands as normal, but do not print any prompts.\n"
 msgstr ""
 
 msgid "Execute commands as normal, but do not print any prompts.\n"
 msgstr ""
 
-#: src/cdecl99.c:64
+#: src/cdecl99.c:69
 msgid "Run in interactive mode.  This is the default.\n"
 msgstr ""
 
 msgid "Run in interactive mode.  This is the default.\n"
 msgstr ""
 
-#: src/cdecl99.c:65
+#: src/cdecl99.c:70
 msgid "Read commands from FILE instead of standard input.\n"
 msgstr ""
 
 msgid "Read commands from FILE instead of standard input.\n"
 msgstr ""
 
-#: src/cdecl99.c:66
+#: src/cdecl99.c:71
 msgctxt "longopt|file"
 msgid "FILE"
 msgstr ""
 
 msgctxt "longopt|file"
 msgid "FILE"
 msgstr ""
 
-#: src/cdecl99.c:67
+#: src/cdecl99.c:72
 msgid ""
 "Execute COMMAND as if it were entered at the prompt.\n"
 "This can be specified multiple times.\n"
 msgstr ""
 
 msgid ""
 "Execute COMMAND as if it were entered at the prompt.\n"
 "This can be specified multiple times.\n"
 msgstr ""
 
-#: src/cdecl99.c:69
+#: src/cdecl99.c:74
 msgctxt "longopt|execute"
 msgid "COMMAND"
 msgstr ""
 
 msgctxt "longopt|execute"
 msgid "COMMAND"
 msgstr ""
 
-#: src/cdecl99.c:70
+#: src/cdecl99.c:75
 msgid "Print a version message and then exit.\n"
 msgstr ""
 
 msgid "Print a version message and then exit.\n"
 msgstr ""
 
-#: src/cdecl99.c:71
+#: src/cdecl99.c:76
 msgid "Print this message.\n"
 msgstr ""
 
 #. TRANSLATORS: ARG is only used for options without help text.
 msgid "Print this message.\n"
 msgstr ""
 
 #. TRANSLATORS: ARG is only used for options without help text.
-#: src/cdecl99.c:74
+#: src/cdecl99.c:79
 msgctxt "longopt"
 msgid "ARG"
 msgstr ""
 
 msgctxt "longopt"
 msgid "ARG"
 msgstr ""
 
-#. TRANSLATORS: (C) must *always* be translated as ©.
-#: src/cdecl99.c:81
-msgid "(C)"
-msgstr "©"
-
-#: src/cdecl99.c:132
+#: src/cdecl99.c:147
 #, c-format
 msgid "  -%c"
 msgstr ""
 
 #, c-format
 msgid "  -%c"
 msgstr ""
 
-#: src/cdecl99.c:135
+#: src/cdecl99.c:150
 #, c-format
 msgid "  -%c, --%s=%s"
 msgstr ""
 
 #, c-format
 msgid "  -%c, --%s=%s"
 msgstr ""
 
-#: src/cdecl99.c:136
+#: src/cdecl99.c:151
 #, c-format
 msgid "  -%c, --%s"
 msgstr ""
 
 #, c-format
 msgid "  -%c, --%s"
 msgstr ""
 
-#: src/cdecl99.c:141
+#: src/cdecl99.c:156
 #, c-format
 msgid "  -%c, --%s=%s, --%s=%s"
 msgstr ""
 
 #, c-format
 msgid "  -%c, --%s=%s, --%s=%s"
 msgstr ""
 
-#: src/cdecl99.c:145
+#: src/cdecl99.c:160
 #, c-format
 msgid "  -%c, --%s, --%s"
 msgstr ""
 
 #, c-format
 msgid "  -%c, --%s, --%s"
 msgstr ""
 
-#: src/cdecl99.c:181
+#: src/cdecl99.c:196
 msgid ""
 "This is \"cdecl99\": a command-line tool for parsing and constructing\n"
 "complicated C declarations.\n"
 msgid ""
 "This is \"cdecl99\": a command-line tool for parsing and constructing\n"
 "complicated C declarations.\n"
@@ -190,15 +188,18 @@ msgstr ""
 "This is “cdecl99”: a command-line tool for parsing and constructing\n"
 "complicated C declarations.\n"
 
 "This is “cdecl99”: a command-line tool for parsing and constructing\n"
 "complicated C declarations.\n"
 
-#: src/cdecl99.c:184
+#: src/cdecl99.c:199
 msgid "Options:"
 msgstr ""
 
 msgid "Options:"
 msgstr ""
 
-#: src/cdecl99.c:193
+#: src/cdecl99.c:208
 msgid "For more information, see the cdecl99(1) man page.\n"
 msgstr ""
 
 msgid "For more information, see the cdecl99(1) man page.\n"
 msgstr ""
 
-#: src/cdecl99.c:199
+#. TRANSLATORS: Please add *another line* indicating where users should
+#. report translation bugs.
+#.
+#: src/cdecl99.c:214
 #, c-format
 msgid "Report bugs to <%s>.\n"
 msgstr ""
 #, c-format
 msgid "Report bugs to <%s>.\n"
 msgstr ""
index 99b5d63eaed47bcc2c197117ae95beb7cd89d1ef..bebdfffa43de00ee166bfcbee9b13e9ee70e9015 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Command line utility for making sense of C declarations.
 /*
  * Command line utility for making sense of C declarations.
- * Copyright © 2011-2012 Nick Bowler
+ * Copyright © 2011-2012, 2020 Nick Bowler
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -13,8 +13,9 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
+
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <errno.h>
 #include <locale.h>
 #include <ctype.h>
 #include <errno.h>
 #include <locale.h>
-#include <getopt.h>
-#include <gettext.h>
 #include <assert.h>
 #include <assert.h>
-#include "readline.h"
 #include "history.h"
 #include "cdecl.h"
 
 #include "history.h"
 #include "cdecl.h"
 
+#include <getopt.h>
+#include <gettext.h>
+#include <readline.h>
+#include <striconv.h>
+#include <localcharset.h>
+
 #define _(x) gettext(x)
 #define N_(x) x
 #define PN_(c, x) x
 #define _(x) gettext(x)
 #define N_(x) x
 #define PN_(c, x) x
@@ -78,12 +82,22 @@ static struct helptext {
 
 static void print_version(void)
 {
 
 static void print_version(void)
 {
+       const char *copysign = "(C)";
+       void *convsign = NULL;
+
+       if (ENABLE_NLS) {
+               convsign = str_iconv("\xc2\xa9", "UTF-8", locale_charset());
+               if (convsign)
+                       copysign = convsign;
+       }
+
        puts(PACKAGE_STRING);
        puts(PACKAGE_STRING);
-       /* TRANSLATORS: (C) must *always* be translated as ©. */
-       printf("Copyright %s 2011 Nick Bowler.\n", gettext("(C)"));
-       puts("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.");
+       printf("Copyright %s 2020 Nick Bowler.\n", copysign);
+       puts("License GPLv3+: GNU GPL version 3 or any later version.");
        puts("This is free software: you are free to change and redistribute it.");
        puts("There is NO WARRANTY, to the extent permitted by law.");
        puts("This is free software: you are free to change and redistribute it.");
        puts("There is NO WARRANTY, to the extent permitted by law.");
+
+       free(convsign);
 }
 
 static void print_usage(FILE *f)
 }
 
 static void print_usage(FILE *f)
@@ -478,13 +492,13 @@ static int repl_noninteractive(void)
 /* Initialize gettext and setup translated long options. */
 static void init_i18n(void)
 {
 /* Initialize gettext and setup translated long options. */
 static void init_i18n(void)
 {
+       if (!ENABLE_NLS)
+               return;
+
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
-       if (!ENABLE_NLS)
-               return;
-
        for (int i = 0, j = NOPTS; i < NOPTS; i++) {
                const char *tname = pgettext_expr("longopt", lopts[i].name);
 
        for (int i = 0, j = NOPTS; i < NOPTS; i++) {
                const char *tname = pgettext_expr("longopt", lopts[i].name);