[PATCH] make default string for sample text of font selector localizable



 Hi, 

 I think it would be nice to make the string "abcdefghijk ABCDEFGHIJK"  used
as default string in gtk font selection widget internationalizable. Here is a
patch for it.

 I had to remove macro PREVIEW_TEXT (and turn it into variable), since if it's
defined as
#define PREVIEW_TEXT _("abcdefghijk ABCDEFGHIJK")

 xgettext won't extract that string for some unknown reason.

 This patch makes GtkFontSelection widget much more friendly for users of
non-latin1 locales who don't know what is the encoding - in that case
selection of the font with native glyphs can be "performed" by just iterating
over all fonts in the list (clicking on them) and checking whether hative
glyphs are present in it.

 It also would be nice to set the "encoding" filter of the font
selection widget to contain only locale's encoding by default,
not "*" as it's now, though it may be non-trivial to guess the name of
locale's encoding - what do you think? (There is another problem with this -
typically there are few fonts containing locale-specific glyphs, and if such
unexperienced user will be interested in latin1 font, s/he won't know that
playing with "encoding" filter is required and will be unable to select
latin font).

 If this patch is going to be committed, please tell this (so translators will
be able to commit translations of "abcdefghijk ABCDEFGHIJK" before release).

 Best regards,
  -Vlad

--- gtkfontsel.c~	Fri May 19 09:49:51 2000
+++ gtkfontsel.c	Tue Feb 27 13:18:06 2001
@@ -111,10 +111,6 @@
 #define INITIAL_METRIC		  GTK_FONT_METRIC_POINTS
 #define INITIAL_FONT_SIZE	  140
 
-/* This is the default text shown in the preview entry, though the user
-   can set it. Remember that some fonts only have capital letters. */
-#define PREVIEW_TEXT "abcdefghijk ABCDEFGHIJK"
-
 /* This is the initial and maximum height of the preview entry (it expands
    when large font sizes are selected). Initial height is also the minimum. */
 #define INITIAL_PREVIEW_HEIGHT 44
@@ -1817,6 +1813,10 @@
   gint text_height, new_height;
   gchar *text;
   XFontStruct *xfs;
+
+/* This is the default text shown in the preview entry, though the user
+   can set it. Remember that some fonts only have capital letters. */
+  gchar* default_text = _("abcdefghijk ABCDEFGHIJK");
   
 #ifdef FONTSEL_DEBUG
   g_message("In update_preview\n");
@@ -1846,7 +1846,7 @@
   /* This sets the preview text, if it hasn't been set already. */
   text = gtk_entry_get_text(GTK_ENTRY(fontsel->preview_entry));
   if (strlen(text) == 0)
-    gtk_entry_set_text(GTK_ENTRY(fontsel->preview_entry), PREVIEW_TEXT);
+    gtk_entry_set_text(GTK_ENTRY(fontsel->preview_entry), default_text);
   gtk_entry_set_position(GTK_ENTRY(fontsel->preview_entry), 0);
   
   /* If this is a 2-byte font display a message to say it may not be





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]