xfontsel.patch revision 1276
277N/Adiff --git a/xfontsel.c b/xfontsel.c
277N/Aindex cf334e4..0b4bfdb 100644
277N/A--- a/xfontsel.c
277N/A+++ b/xfontsel.c
277N/A@@ -52,6 +52,9 @@ Modified: Mark Leisher <mleisher@crl.nmsu.edu> to deal with UCS sample text.
277N/A #include <X11/Xfuncs.h>
277N/A #include "ULabel.h"
277N/A
277N/A+#include <libintl.h>
277N/A+#include <X11/Xlocale.h>
277N/A+
277N/A #define MIN_APP_DEFAULTS_VERSION 1
277N/A #define FIELD_COUNT 14
277N/A #define DELIM '-'
277N/A@@ -150,24 +153,25 @@ static XrmOptionDescRec options[] = {
277N/A
277N/A static void Syntax(char *call)
277N/A {
277N/A- fprintf (stderr, "usage: %s [-options ...] -fn font\n\n", call);
277N/A- fprintf (stderr, "where options include:\n");
277N/A- fprintf (stderr,
277N/A- " -display dpy X server to contact\n");
277N/A- fprintf (stderr,
277N/A- " -geometry geom size and location of window\n");
277N/A- fprintf (stderr,
277N/A- " -pattern fontspec font name pattern to match against\n");
277N/A- fprintf (stderr,
277N/A- " -print print selected font name on exit\n");
277N/A- fprintf (stderr,
277N/A- " -sample string sample text to use for 1-byte fonts\n");
277N/A- fprintf (stderr,
277N/A- " -sample16 string sample text to use for 2-byte fonts\n");
277N/A- fprintf (stderr,
277N/A- " -sampleUCS string sample text to use for ISO10646 fonts\n");
277N/A- fprintf (stderr,
277N/A- " -scaled use scaled instances of fonts\n");
277N/A+ /* Internationalize these strings for Bug: 4363521 Jhobson 6/9/00 */
277N/A+ fprintf (stderr, gettext("usage: %s [-options ...] -fn font\n\n"), call);
277N/A+ fprintf (stderr, gettext("where options include:\n"));
277N/A+ fprintf (stderr, " -display ");
277N/A+ fprintf (stderr, gettext("display X server to contact\n"));
277N/A+ fprintf (stderr, " -geometry ");
277N/A+ fprintf (stderr, gettext("geometry size and location of window\n"));
277N/A+ fprintf (stderr, " -pattern ");
277N/A+ fprintf (stderr, gettext("fontspec font name pattern to match against\n"));
277N/A+ fprintf (stderr, " -print ");
277N/A+ fprintf (stderr, gettext("print selected font name on exit\n"));
277N/A+ fprintf (stderr, " -sample ");
+ fprintf (stderr, gettext("string sample text to use for 1-byte fonts\n"));
+ fprintf (stderr, " -sample16 ");
+ fprintf (stderr, gettext("string sample text to use for 2-byte fonts\n"));
+ fprintf (stderr, " -sampleUCS ");
+ fprintf (stderr, gettext("string sample text to use for ISO10646 fonts\n"));
+ fprintf (stderr, " -scaled ");
+ fprintf (stderr, gettext("do use scaled instances of fonts\n"));
fprintf (stderr, "\n");
exit (1);
}
@@ -261,10 +265,28 @@ main(int argc, char **argv)
{
Widget topLevel, pane;
+ /*
+ * Set up internationalize message for bug: 4363521 Jhobson 8/23/00
+ */
+ char *domaindir;
+
XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
topLevel = XtAppInitialize(&appCtx, "XFontSel", options, XtNumber(options),
&argc, argv, NULL, NULL, 0);
+ /*
+ * Set up internationalize message for bug: 4363521 Jhobson 8/23/00
+ *
+ * Do this after the AppInitialize since setlocale is setup
+ * by XtSetLanguageProc, but does not occur until XtAppInitialize
+ * happens. (Goofy X server)
+ */
+ textdomain("xfontsel");
+
+ if((domaindir = getenv("TEXTDOMAINDIR")) == NULL){
+ domaindir = getenv("XLOCALEDIR");
+ }
+ bindtextdomain("xfontsel", domaindir);
if (argc != 1) Syntax(argv[0]);
@@ -275,12 +297,15 @@ main(int argc, char **argv)
XtGetApplicationResources( topLevel, (XtPointer)&AppRes,
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);
@@ -514,7 +539,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();
@@ -1012,11 +1037,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)
- snprintf( label, sizeof(label), "%d names match", matchingFontCount );
+ snprintf( label, sizeof(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 );
}
@@ -1027,9 +1052,9 @@ static void SetParsingFontCount(int count)
char label[80];
Arg args[1];
if (count == 1)
- strcpy( label, "1 name to parse" );
+ strcpy( label, gettext("1 name to parse") );
else
- snprintf( label, sizeof(label), "%d names to parse", count );
+ snprintf( label, sizeof(label), gettext("%d names to parse"), count );
XtSetArg( args[0], XtNlabel, label );
XtSetValues( countLabel, args, ONE );
FlushXqueue(XtDisplay(countLabel));
@@ -1234,9 +1259,9 @@ void SelectField(Widget w, XtPointer closure, XtPointer callData)
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" );