#include <fontconfig/fontconfig.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <locale.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(x) (dgettext(GETTEXT_PACKAGE, x))
+#else
+#define dgettext(d, s) (s)
+#define _(x) (x)
+#endif
#ifndef HAVE_GETOPT
#define HAVE_GETOPT 0
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
+ fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [--config] [--default] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n"),
program);
#else
- fprintf (file, "usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n",
+ fprintf (file, _("usage: %s [-cdVh] [-f FORMAT] [pattern] {element...}\n"),
program);
#endif
- fprintf (file, "List best font matching [pattern]\n");
+ fprintf (file, _("List best font matching [pattern]\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
- fprintf (file, " -c, --config perform config substitution on pattern\n");
- fprintf (file, " -d, -default perform default substitution on pattern\n");
- fprintf (file, " -f, --format=FORMAT use the given output format\n");
- fprintf (file, " -V, --version display font config version and exit\n");
- fprintf (file, " -h, --help display this help and exit\n");
+ fprintf (file, _(" -c, --config perform config substitution on pattern\n"));
+ fprintf (file, _(" -d, --default perform default substitution on pattern\n"));
+ fprintf (file, _(" -f, --format=FORMAT use the given output format\n"));
+ fprintf (file, _(" -V, --version display font config version and exit\n"));
+ fprintf (file, _(" -h, --help display this help and exit\n"));
#else
- fprintf (file, " -c, (config) perform config substitution on pattern\n");
- fprintf (file, " -d, (default) perform default substitution on pattern\n");
- fprintf (file, " -f FORMAT (format) use the given output format\n");
- fprintf (file, " -V (version) display font config version and exit\n");
- fprintf (file, " -h (help) display this help and exit\n");
+ fprintf (file, _(" -c, (config) perform config substitution on pattern\n"));
+ fprintf (file, _(" -d, (default) perform default substitution on pattern\n"));
+ fprintf (file, _(" -f FORMAT (format) use the given output format\n"));
+ fprintf (file, _(" -V (version) display font config version and exit\n"));
+ fprintf (file, _(" -h (help) display this help and exit\n"));
#endif
exit (error);
}
#if HAVE_GETOPT_LONG || HAVE_GETOPT
int c;
+ setlocale (LC_ALL, "");
#if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "cdf:Vh", longopts, NULL)) != -1)
#else
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
+ if (!pat)
+ {
+ fprintf (stderr, _("Unable to parse the pattern\n"));
+ return 1;
+ }
while (argv[++i])
{
if (!os)