#else
# define _(text) text
#endif
+#define N_(text) text
#if HAVE_LIMITS_H
# include <limits.h>
return r;
}
+/* Return the translation of MSGID if there is one, and
+ DEFAULT_TRANSLATION otherwise. */
+static char const *
+gettext_default (char const *msgid, char const *default_translation)
+{
+ char const *translation = _(msgid);
+ return translation == msgid ? default_translation : translation;
+}
+
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
argument ARG (of size ARGSIZE), using QUOTING_STYLE and the
non-quoting-style part of O to control quoting.
break;
case locale_quoting_style:
- for (quote_string = _("`"); *quote_string; quote_string++)
- STORE (*quote_string);
- backslash_escapes = 1;
- quote_string = _("'");
- quote_string_len = strlen (quote_string);
+ {
+ /* Get translations for open and closing quotation marks.
+
+ The message catalog should translate "{LEFT QUOTATION
+ MARK}" to a left quotation mark suitable for the locale,
+ and similarly for "{RIGHT QUOTATION MARK}". If the catalog
+ has no translation, the code below uses a neutral
+ (vertical) quotation mark instead, as it is the most
+ appropriate for the C locale.
+
+ For example, an American English Unicode locale should
+ translate the string "{LEFT QUOTATION MARK}" to the
+ character U+201C (LEFT DOUBLE QUOTATION MARK), and should
+ translate the string "{RIGHT QUOTATION MARK}" to the
+ character U+201D (RIGHT DOUBLE QUOTATION MARK). A British
+ English Unicode locale should instead translate these to
+ U+2018 (LEFT SINGLE QUOTATION MARK) and U+2019 (RIGHT
+ SINGLE QUOTATION MARK), respectively. */
+
+ static char const quotation_mark[] = "\"";
+ char const *left = gettext_default (N_("{LEFT QUOTATION MARK}"),
+ quotation_mark);
+ char const *right = gettext_default (N_("{RIGHT QUOTATION MARK}"),
+ quotation_mark);
+ for (quote_string = left; *quote_string; quote_string++)
+ STORE (*quote_string);
+ backslash_escapes = 1;
+ quote_string = right;
+ quote_string_len = strlen (quote_string);
+ }
break;
case shell_always_quoting_style:
OPTIONS specifies the quoting options.
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
- N must be nonnegative. N is deliberately declared with type `int'
+ N must be nonnegative. N is deliberately declared with type "int"
to allow for future extensions (using negative values). */
static char *
quotearg_n_options (int n, char const *arg,