xfontsel.patch revision 1068
970N/Adiff -urp -x '*~' -x '*.orig' xfontsel.c xfontsel.c
970N/A--- xfontsel.c 2009-10-16 14:39:19.000000000 -0700
970N/A+++ xfontsel.c 2011-01-28 17:56:03.979720384 -0800
970N/A@@ -54,6 +54,9 @@ Modified: Mark Leisher <mleisher@crl.nms
970N/A #include <X11/Xfuncs.h>
970N/A #include "ULabel.h"
970N/A
970N/A+#include <libintl.h>
970N/A+#include <X11/Xlocale.h>
970N/A+
970N/A #define MIN_APP_DEFAULTS_VERSION 1
970N/A #define FIELD_COUNT 14
970N/A #define DELIM '-'
970N/A@@ -152,24 +155,25 @@ static XrmOptionDescRec options[] = {
970N/A
970N/A static void Syntax(char *call)
970N/A {
970N/A- fprintf (stderr, "usage: %s [-options ...] -fn font\n\n", call);
970N/A- fprintf (stderr, "where options include:\n");
970N/A- fprintf (stderr,
970N/A- " -display dpy X server to contact\n");
970N/A- fprintf (stderr,
970N/A- " -geometry geom size and location of window\n");
970N/A- fprintf (stderr,
970N/A- " -pattern fontspec font name pattern to match against\n");
970N/A- fprintf (stderr,
970N/A- " -print print selected font name on exit\n");
970N/A- fprintf (stderr,
970N/A- " -sample string sample text to use for 1-byte fonts\n");
970N/A- fprintf (stderr,
970N/A- " -sample16 string sample text to use for 2-byte fonts\n");
970N/A- fprintf (stderr,
970N/A- " -sampleUCS string sample text to use for ISO10646 fonts\n");
970N/A- fprintf (stderr,
970N/A- " -scaled use scaled instances of fonts\n");
970N/A+ /* Internationalize these strings for Bug: 4363521 Jhobson 6/9/00 */
970N/A+ fprintf (stderr, gettext("usage: %s [-options ...] -fn font\n\n"), call);
970N/A+ fprintf (stderr, gettext("where options include:\n"));
970N/A+ fprintf (stderr, " -display ");
970N/A+ fprintf (stderr, gettext("display X server to contact\n"));
970N/A+ fprintf (stderr, " -geometry ");
970N/A+ fprintf (stderr, gettext("geometry size and location of window\n"));
970N/A+ fprintf (stderr, " -pattern ");
970N/A+ fprintf (stderr, gettext("fontspec font name pattern to match against\n"));
970N/A+ fprintf (stderr, " -print ");
970N/A+ fprintf (stderr, gettext("print selected font name on exit\n"));
970N/A+ fprintf (stderr, " -sample ");
970N/A+ fprintf (stderr, gettext("string sample text to use for 1-byte fonts\n"));
970N/A+ fprintf (stderr, " -sample16 ");
970N/A+ fprintf (stderr, gettext("string sample text to use for 2-byte fonts\n"));
970N/A+ fprintf (stderr, " -sampleUCS ");
970N/A+ fprintf (stderr, gettext("string sample text to use for ISO10646 fonts\n"));
970N/A+ fprintf (stderr, " -scaled ");
970N/A+ fprintf (stderr, gettext("do use scaled instances of fonts\n"));
970N/A fprintf (stderr, "\n");
970N/A exit (1);
970N/A }
970N/A@@ -263,10 +267,28 @@ main(int argc, char **argv)
970N/A {
970N/A Widget topLevel, pane;
970N/A
970N/A+ /*
970N/A+ * Set up internationalize message for bug: 4363521 Jhobson 8/23/00
970N/A+ */
970N/A+ char *domaindir;
970N/A+
970N/A XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
970N/A
970N/A topLevel = XtAppInitialize(&appCtx, "XFontSel", options, XtNumber(options),
970N/A &argc, argv, NULL, NULL, 0);
970N/A+ /*
970N/A+ * Set up internationalize message for bug: 4363521 Jhobson 8/23/00
970N/A+ *
970N/A+ * Do this after the AppInitialize since setlocale is setup
970N/A+ * by XtSetLanguageProc, but does not occur until XtAppInitialize
970N/A+ * happens. (Goofy X server)
970N/A+ */
970N/A+ textdomain("xfontsel");
970N/A+
970N/A+ if((domaindir = getenv("TEXTDOMAINDIR")) == NULL){
970N/A+ domaindir = getenv("XLOCALEDIR");
970N/A+ }
970N/A+ bindtextdomain("xfontsel", domaindir);
970N/A
970N/A if (argc != 1) Syntax(argv[0]);
970N/A
970N/A@@ -277,12 +299,15 @@ main(int argc, char **argv)
970N/A XtGetApplicationResources( topLevel, (XtPointer)&AppRes,
970N/A resources, XtNumber(resources), NZ );
if (AppRes.app_defaults_version < MIN_APP_DEFAULTS_VERSION) {
+ char message[200];
+ char full_message[300];
XrmDatabase rdb = XtDatabase(XtDisplay(topLevel));
- XtWarning( "app-defaults file not properly installed." );
- XrmPutLineResource( &rdb,
-"*sampleText*UCSLabel:XFontSel app-defaults file not properly installed;\\n\
-see 'xfontsel' manual page."
- );
+ sprintf( message, gettext("app-defaults file not properly installed.") );
+ sprintf( full_message, gettext("%s %s;\\nsee '%s' manual page."),
+ "*sampleText*UCSLabel:XFontSel", message, "xfontsel" );
+
+ XtWarning( message );
+ XrmPutLineResource( &rdb, full_message);
}
ScheduleWork(GetFontNames, (XtPointer)XtDisplay(topLevel), 0);
@@ -524,7 +549,7 @@ void GetFontNames(XtPointer closure)
}
else
XtAppWarning( appCtx,
- "internal error; pattern didn't match first font" );
+ gettext("internal error; pattern didn't match first font" ));
}
else {
SetNoFonts();
@@ -1026,11 +1051,11 @@ static void SetCurrentFontCount(void)
char label[80];
Arg args[1];
if (matchingFontCount == 1)
- strcpy( label, "1 name matches" );
+ strcpy( label, gettext("1 name matches") );
else if (matchingFontCount)
- sprintf( label, "%d names match", matchingFontCount );
+ sprintf( label, gettext("%d names match"), matchingFontCount);
else
- strcpy( label, "no names match" );
+ strcpy( label, gettext("no names match") );
XtSetArg( args[0], XtNlabel, label );
XtSetValues( countLabel, args, ONE );
}
@@ -1041,9 +1066,9 @@ static void SetParsingFontCount(int coun
char label[80];
Arg args[1];
if (count == 1)
- strcpy( label, "1 name to parse" );
+ strcpy( label, gettext("1 name to parse") );
else
- sprintf( label, "%d names to parse", count );
+ sprintf( label, gettext("%d names to parse"), count );
XtSetArg( args[0], XtNlabel, label );
XtSetValues( countLabel, args, ONE );
FlushXqueue(XtDisplay(countLabel));
@@ -1252,9 +1277,9 @@ void SelectField(Widget w, XtPointer clo
int field = (long)closure;
FieldValue *values = fieldValues[field]->value;
int count = fieldValues[field]->count;
- printf( "field %d:\n", field );
+ printf(gettext("field %d:\n"), field );
while (count--) {
- printf( " %s: %d fonts\n", values->string, values->count );
+ printf( gettext(" %s: %d fonts\n"), values->string, values->count );
values++;
}
printf( "\n" );