summaryrefslogtreecommitdiff
path: root/fc-validate
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2014-03-27 15:10:44 +0900
committerAkira TAGOH <akira@tagoh.org>2017-11-07 15:24:54 +0900
commit9a0fcb948fe7346f6c68028b2e54ab600a2a2a6f (patch)
tree34cd373fb1529028fc8bb68526227e85ac520ad4 /fc-validate
parent0c149259e4cc8070f6c8bf149290abb1367f340a (diff)
Add the ruleset description support
Trying to address what these configuration files really do. This change allows to see the short description that mention the purpose of the content in the config file and obtain them through API. This change also encourage one who want to make some UI for the user-specific configuration management. it is the main purpose of this change for me though. Aside from that, I've also made programs translatable. so we see more dependencies on the build time for gettext, and itstool to generate PO from xml.
Diffstat (limited to 'fc-validate')
-rw-r--r--fc-validate/Makefile.am2
-rw-r--r--fc-validate/fc-validate.c42
2 files changed, 26 insertions, 18 deletions
diff --git a/fc-validate/Makefile.am b/fc-validate/Makefile.am
index 782ceadb..c485aa51 100644
--- a/fc-validate/Makefile.am
+++ b/fc-validate/Makefile.am
@@ -1,5 +1,5 @@
#
-# fontconfig/fc-query/Makefile.am
+# fontconfig/fc-validate/Makefile.am
#
# Copyright © 2003 Keith Packard
#
diff --git a/fc-validate/fc-validate.c b/fc-validate/fc-validate.c
index 6ecff367..2ceee202 100644
--- a/fc-validate/fc-validate.c
+++ b/fc-validate/fc-validate.c
@@ -41,6 +41,14 @@
#include <string.h>
#include <locale.h>
+#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
#endif
@@ -72,26 +80,26 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n",
+ fprintf (file, _("usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n"),
program);
#else
- fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n",
+ fprintf (file, _("usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n"),
program);
#endif
- fprintf (file, "Validate font files and print result\n");
+ fprintf (file, _("Validate font files and print result\n"));
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
- fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n");
- fprintf (file, " -l, --lang=LANG set LANG instead of current locale\n");
- fprintf (file, " -v, --verbose show more detailed information\n");
- fprintf (file, " -V, --version display font config version and exit\n");
- fprintf (file, " -h, --help display this help and exit\n");
+ fprintf (file, _(" -i, --index INDEX display the INDEX face of each font file only\n"));
+ fprintf (file, _(" -l, --lang=LANG set LANG instead of current locale\n"));
+ fprintf (file, _(" -v, --verbose show more detailed information\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, " -i INDEX (index) display the INDEX face of each font file only\n");
- fprintf (file, " -l LANG (lang) set LANG instead of current locale\n");
- fprintf (file, " -v (verbose) show more detailed information\n");
- fprintf (file, " -V (version) display font config version and exit\n");
- fprintf (file, " -h (help) display this help and exit\n");
+ fprintf (file, _(" -i INDEX (index) display the INDEX face of each font file only\n"));
+ fprintf (file, _(" -l LANG (lang) set LANG instead of current locale\n"));
+ fprintf (file, _(" -v (verbose) show more detailed information\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);
}
@@ -156,7 +164,7 @@ main (int argc, char **argv)
if (FT_Init_FreeType (&ftlib))
{
- fprintf (stderr, "Can't initalize FreeType library\n");
+ fprintf (stderr, _("Can't initalize FreeType library\n"));
return 1;
}
@@ -174,7 +182,7 @@ main (int argc, char **argv)
{
if (!index_set && index > 0)
break;
- fprintf (stderr, "Unable to open %s\n", argv[i]);
+ fprintf (stderr, _("Unable to open %s\n"), argv[i]);
err = 1;
}
else
@@ -189,7 +197,7 @@ main (int argc, char **argv)
{
FcChar32 ucs4, pos, map[FC_CHARSET_MAP_SIZE];
- printf ("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n",
+ printf (_("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n"),
argv[i], index, count, lang);
if (verbose)
@@ -219,7 +227,7 @@ main (int argc, char **argv)
}
else
{
- printf ("%s:%d Satisfy the coverage for %s language\n", argv[i], index, lang);
+ printf (_("%s:%d Satisfy the coverage for %s language\n"), argv[i], index, lang);
}
FcCharSetDestroy (fcs);