diff options
author | Akira TAGOH <akira@tagoh.org> | 2014-03-27 15:10:44 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2017-11-07 15:24:54 +0900 |
commit | 9a0fcb948fe7346f6c68028b2e54ab600a2a2a6f (patch) | |
tree | 34cd373fb1529028fc8bb68526227e85ac520ad4 /fc-cat | |
parent | 0c149259e4cc8070f6c8bf149290abb1367f340a (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-cat')
-rw-r--r-- | fc-cat/fc-cat.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index a1dc848b..dfe30d76 100644 --- a/fc-cat/fc-cat.c +++ b/fc-cat/fc-cat.c @@ -41,6 +41,14 @@ #include <sys/stat.h> #include <errno.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 @@ -148,27 +156,27 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-rv] [--recurse] [--verbose] [*-%s" FC_CACHE_SUFFIX "|directory]...\n", + fprintf (file, _("usage: %s [-rv] [--recurse] [--verbose] [*-%s" FC_CACHE_SUFFIX "|directory]...\n"), program, FC_ARCHITECTURE); fprintf (file, " %s [-Vh] [--version] [--help]\n", program); #else - fprintf (file, "usage: %s [-rvVh] [*-%s" FC_CACHE_SUFFIX "|directory]...\n", + fprintf (file, _("usage: %s [-rvVh] [*-%s" FC_CACHE_SUFFIX "|directory]...\n"), program, FC_ARCHITECTURE); #endif - fprintf (file, "Reads font information cache from:\n"); - fprintf (file, " 1) specified fontconfig cache file\n"); - fprintf (file, " 2) related to a particular font directory\n"); + fprintf (file, _("Reads font information cache from:\n")); + fprintf (file, _(" 1) specified fontconfig cache file\n")); + fprintf (file, _(" 2) related to a particular font directory\n")); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -r, --recurse recurse into subdirectories\n"); - fprintf (file, " -v, --verbose be verbose\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, _(" -r, --recurse recurse into subdirectories\n")); + fprintf (file, _(" -v, --verbose be verbose\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, " -r (recurse) recurse into subdirectories\n"); - fprintf (file, " -v (verbose) be verbose\n"); - fprintf (file, " -V (version) display font config version and exit\n"); - fprintf (file, " -h (help) display this help and exit\n"); + fprintf (file, _(" -r (recurse) recurse into subdirectories\n")); + fprintf (file, _(" -v (verbose) be verbose\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); } @@ -294,7 +302,7 @@ main (int argc, char **argv) config = FcInitLoadConfig (); if (!config) { - fprintf (stderr, "%s: Can't init font config library\n", argv[0]); + fprintf (stderr, _("%s: Can't initialize font config library\n"), argv[0]); return 1; } FcConfigSetCurrent (config); @@ -303,7 +311,7 @@ main (int argc, char **argv) args = FcStrSetCreate (); if (!args) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } if (i < argc) @@ -312,7 +320,7 @@ main (int argc, char **argv) { if (!FcStrSetAddFilename (args, (const FcChar8 *) argv[i])) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } } @@ -324,7 +332,7 @@ main (int argc, char **argv) while ((arg = FcStrListNext (arglist))) if (!FcStrSetAdd (args, arg)) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } FcStrListDone (arglist); @@ -332,7 +340,7 @@ main (int argc, char **argv) arglist = FcStrListCreate (args); if (!arglist) { - fprintf (stderr, "%s: malloc failure\n", argv[0]); + fprintf (stderr, _("%s: malloc failure\n"), argv[0]); return 1; } FcStrSetDestroy (args); @@ -372,7 +380,7 @@ main (int argc, char **argv) { if (!first) printf ("\n"); - printf ("Directory: %s\nCache: %s\n--------\n", + printf (_("Directory: %s\nCache: %s\n--------\n"), FcCacheDir(cache), cache_file ? cache_file : arg); first = FcFalse; } |