Gtk Rtl patch



This patch does

  * check and use bind_textdomain_codeset, to make
    localisations work on glibc2.2

  * export a translated string "default:LTR", which
    if translated to "default:RTL" makes the default
    widget direction right-to-left.
 
    (I think this is a nicer way of doing it than
     the one previously suggested, that of checking
     LANG, etc, for "he", "ar",...)

    And then update fa.po and he.po to make use of that...

  * Make horizontal GtkRanges honour the widget direction...

-- 
I speak for myself, not my employer

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1435
diff -u -r1.1435 ChangeLog
--- ChangeLog	2000/10/20 23:14:35	1.1435
+++ ChangeLog	2000/10/22 01:04:13
@@ -1,3 +1,16 @@
+2000-10-22  Robert Brady  <robert suse co uk>
+
+	* configure.in: Check for bind_textdomain_codeset
+
+	* gtk/gtkmain.c (gtk_init_check): If bind_textdomain_codeset 
+	present, make use of it.
+
+	Add a translatable string "default:LTR" which, if translated
+	to "default:RTL", will cause the default direction to be
+	Right-to-Left.
+
+	* gtk/gtkrange.c: Take into account the widget direction.
+
 2000-10-04  Havoc Pennington  <hp redhat com>
 
 	* gtk/testgtk.c (create_buttons): create some stock buttons
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gtk+/configure.in,v
retrieving revision 1.171
diff -u -r1.171 configure.in
--- configure.in	2000/10/18 15:50:13	1.171
+++ configure.in	2000/10/22 01:04:20
@@ -194,7 +194,7 @@
 fi
 AC_SUBST(REBUILD)
 
-AC_CHECK_FUNCS(lstat mkstemp sigsetjmp)
+AC_CHECK_FUNCS(lstat mkstemp sigsetjmp bind_textdomain_codeset)
 
 AC_MSG_CHECKING(whether make is GNU Make)
 STRIP_BEGIN=
Index: gtk/gtkmain.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmain.c,v
retrieving revision 1.138
diff -u -r1.138 gtkmain.c
--- gtk/gtkmain.c	2000/09/14 16:41:19	1.138
+++ gtk/gtkmain.c	2000/10/22 01:04:25
@@ -395,6 +395,9 @@
 #ifdef ENABLE_NLS
 #ifndef G_OS_WIN32
   bindtextdomain(GETTEXT_PACKAGE, GTK_LOCALEDIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODSET
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+#endif
 #else
   {
     /* GTk+ locale dir is %WinDir%\gtk+\locale */
@@ -406,6 +409,17 @@
   }
 #endif
 #endif  
+
+  {
+  /* Translate to default:RTL if you want your widgets
+     to be RTL, otherwise translate to default:LTR */
+    char *e = _("default:LTR");
+    if (strcmp(e, "default:RTL")==0) {
+      gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
+    } else if (strcmp(e, "default:LTR")) {
+      g_warning("Whoever translated default:LTR did so wrongly.\n");
+    }
+  }
 
   /* Initialize the default visual and colormap to be
    *  used in creating widgets. (We want to use the system
Index: gtk/gtkrange.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrange.c,v
retrieving revision 1.37
diff -u -r1.37 gtkrange.c
--- gtk/gtkrange.c	2000/07/26 11:32:45	1.37
+++ gtk/gtkrange.c	2000/10/22 01:04:28
@@ -457,6 +457,9 @@
       else if (x > right)
 	x = right;
 
+      if (gtk_widget_get_direction(range) == GTK_TEXT_DIR_RTL)
+	x = right - (x - left);
+      
       move_and_update_window (range->slider, x, GTK_WIDGET (range)->style->ythickness);
     }
 }
@@ -521,7 +524,10 @@
   gtk_range_trough_hdims (range, &left, &right);
   gdk_window_get_size (range->slider, &slider_length, NULL);
   right += slider_length;
-	      
+
+  if (gtk_widget_get_direction(range) == GTK_TEXT_DIR_RTL)
+    x = (right - x) + left;
+
   if ((x > left) && (y > ythickness))
     {
       gdk_window_get_size (range->trough, &trough_width, &trough_height);
@@ -615,6 +621,9 @@
     return;
 
   new_pos = slider_x + xdelta;
+
+  if (gtk_widget_get_direction(range) == GTK_TEXT_DIR_RTL)
+    new_pos = (right - new_pos) + left;
 
   if (new_pos < left)
     new_pos = left;
Index: po/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/po/ChangeLog,v
retrieving revision 1.81
diff -u -r1.81 ChangeLog
--- po/ChangeLog	2000/10/19 12:59:03	1.81
+++ po/ChangeLog	2000/10/22 01:04:29
@@ -1,3 +1,7 @@
+2000-10-22  Robert Brady  <robert suse co uk>
+
+	* fa.po, he.po: Default to right-to-left.
+
 2000-10-19  Christian Rose  <menthos menthos com>
 
 	* sv.po: Updated Swedish translation.
Index: po/POTFILES.in
===================================================================
RCS file: /cvs/gnome/gtk+/po/POTFILES.in,v
retrieving revision 1.4
diff -u -r1.4 POTFILES.in
--- po/POTFILES.in	2000/07/27 12:05:21	1.4
+++ po/POTFILES.in	2000/10/22 01:04:29
@@ -7,6 +7,7 @@
 gtk/gtkfontsel.c
 gtk/gtkgamma.c
 gtk/gtkinputdialog.c
+gtk/gtkmain.c
 gtk/gtknotebook.c
 gtk/gtkrc.c
 gtk/gtkthemes.c
Index: po/fa.po
===================================================================
RCS file: /cvs/gnome/gtk+/po/fa.po,v
retrieving revision 1.2
diff -u -r1.2 fa.po
--- po/fa.po	2000/10/15 23:44:47	1.2
+++ po/fa.po	2000/10/22 01:04:33
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: gtk+ 1.3.1\n"
-"POT-Creation-Date: 2000-10-12 20:58+0100\n"
+"POT-Creation-Date: 2000-10-22 01:23+0100\n"
 "PO-Revision-Date: 2000-10-13 15:00+0330\n"
 "Last-Translator: Roozbeh Pournader <roozbeh sina sharif ac ir>\n"
 "Language-Team: Persian <fa li org>\n"
@@ -13,6 +13,32 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
+#: gdk-pixbuf/io-gif.c:426
+msgid "GIF file was missing some data (perhaps it was truncated somehow?)"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:435
+#, c-format
+msgid "Internal error in the GIF loader (%s)"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:584
+msgid "Circular table entry in GIF file"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:921
+msgid "File does not appear to be a GIF file"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:933
+#, c-format
+msgid "Version %s of the GIF file format is not supported"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:985
+msgid "GIF animation contained a frame with an incorrect size"
+msgstr ""
+
 #: gtk/gtkcolorsel.c:1422
 msgid "Hue:"
 msgstr "پرده:"
@@ -239,13 +265,13 @@
 #: gtk/gtkinputdialog.c:476
 msgid "Wheel"
 msgstr "چرخ"
-# farmaan
 
+# farmaan
 #: gtk/gtkinputdialog.c:516
 msgid "none"
 msgstr "هیچ‌کدام"
-# hich-yek, hich-kodaam, be-hich-vajh, aslan
 
+# hich-yek, hich-kodaam, be-hich-vajh, aslan
 #: gtk/gtkinputdialog.c:550 gtk/gtkinputdialog.c:586
 msgid "(disabled)"
 msgstr "(از کار افتاده)"
@@ -253,35 +279,46 @@
 #: gtk/gtkinputdialog.c:579
 msgid "(unknown)"
 msgstr "(نامعلوم)"
-# naashenaakhte, naashenaas, naama'loom, naamoshakhkhas
 
+# naashenaakhte, naashenaas, naama'loom, naamoshakhkhas
 #. and clear button
 #: gtk/gtkinputdialog.c:664
 msgid "clear"
 msgstr "پاک شود"
-# paak kardan, rad kardan, tamiz kardan, door rikhtan, rowshan kardan, towzih daadan
 
+#. Translate to default:RTL if you want your widgets
+#. to be RTL, otherwise translate to default:LTR
+#: gtk/gtkmain.c:416
+msgid "default:LTR"
+msgstr "default:RTL"
+
+# paak kardan, rad kardan, tamiz kardan, door rikhtan, rowshan kardan, towzih daadan
 #: gtk/gtknotebook.c:2059 gtk/gtknotebook.c:4131
 #, c-format
 msgid "Page %u"
 msgstr "صفحه‌ی %u"
 
-#: gtk/gtkrc.c:1945
+#: gtk/gtkrc.c:1978
 #, c-format
 msgid "Unable to locate image file in pixmap_path: \"%s\" line %d"
-msgstr "پرونده‌ی تصویری در pixmap_path مقابل یافت نشد: \"%s\" سطر %d"
+msgstr ""
+"پرونده‌ی تصویری در pixmap_path مقابل یافت نشد: "
+"\"%s\" سطر %d"
 
-#: gtk/gtkrc.c:1948
+#: gtk/gtkrc.c:1981
 #, c-format
 msgid "Unable to locate image file in pixmap_path: \"%s\""
-msgstr "پرونده‌ی تصویری در pixmap_path مقابل یافت نشد: \"%s\""
+msgstr ""
+"پرونده‌ی تصویری در pixmap_path مقابل یافت نشد: "
+"\"%s\""
 
-#: gtk/gtkthemes.c:65
+#: gtk/gtkthemes.c:117
 #, c-format
 msgid "Unable to locate loadable module in module_path: \"%s\","
-msgstr "واحد بارشونده در module_path مقابل یافت نشد: \"%s\","
+msgstr ""
+"واحد بارشونده در module_path مقابل یافت نشد: "
+"\"%s\","
 
 #: gtk/gtktipsquery.c:180
 msgid "--- No Tip ---"
 msgstr "--- کمک بی کمک ---"
-
Index: po/he.po
===================================================================
RCS file: /cvs/gnome/gtk+/po/he.po,v
retrieving revision 1.2
diff -u -r1.2 he.po
--- po/he.po	2000/08/11 02:56:24	1.2
+++ po/he.po	2000/10/22 01:04:33
@@ -2,11 +2,10 @@
 # Copyright (C) 2000 Free Software Foundation, Inc.
 # Tzafrir Cohen <tzafrir technion ac il>, 2000.
 #
-#, fuzzy
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-08-10 21:20-0400\n"
+"POT-Creation-Date: 2000-10-22 02:04+0100\n"
 "PO-Revision-Date: 2000-07-26 HO:MI+ZONE\n"
 "Last-Translator: Tzafrir Cohen <tzafrir technion ac il>\n"
 "Language-Team: LANGUAGE <he li org>\n"
@@ -14,55 +13,81 @@
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: gtk/gtkcolorsel.c:1420
+#: gdk-pixbuf/io-gif.c:426
+msgid "GIF file was missing some data (perhaps it was truncated somehow?)"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:435
+#, c-format
+msgid "Internal error in the GIF loader (%s)"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:584
+msgid "Circular table entry in GIF file"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:921
+msgid "File does not appear to be a GIF file"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:933
+#, c-format
+msgid "Version %s of the GIF file format is not supported"
+msgstr ""
+
+#: gdk-pixbuf/io-gif.c:985
+msgid "GIF animation contained a frame with an incorrect size"
+msgstr ""
+
+#: gtk/gtkcolorsel.c:1422
 msgid "Hue:"
 msgstr ""
 
-#: gtk/gtkcolorsel.c:1421
+#: gtk/gtkcolorsel.c:1423
 msgid "Saturation:"
 msgstr ""
 
-#: gtk/gtkcolorsel.c:1422
+#: gtk/gtkcolorsel.c:1424
 msgid "Value:"
 msgstr "ערך:"
 
-#: gtk/gtkcolorsel.c:1423
+#: gtk/gtkcolorsel.c:1425
 msgid "Red:"
 msgstr "אדום:"
 
-#: gtk/gtkcolorsel.c:1424
+#: gtk/gtkcolorsel.c:1426
 msgid "Green:"
 msgstr "אדום:"
 
-#: gtk/gtkcolorsel.c:1425
+#: gtk/gtkcolorsel.c:1427
 msgid "Blue:"
 msgstr "כחול:"
 
-#: gtk/gtkcolorsel.c:1428
+#: gtk/gtkcolorsel.c:1430
 msgid "Opacity:"
 msgstr ""
 
-#: gtk/gtkcolorsel.c:1443
+#: gtk/gtkcolorsel.c:1445
 msgid "Hex Value:"
 msgstr "ערך הקס':"
 
-#: gtk/gtkcolorsel.c:1464
+#: gtk/gtkcolorsel.c:1466
 msgid "Custom Palette"
 msgstr ""
 
-#: gtk/gtkcolorsel.c:1469
+#: gtk/gtkcolorsel.c:1471
 msgid "Set Color"
 msgstr ""
 
 #. The OK button
-#: gtk/gtkcolorseldialog.c:105 gtk/gtkfilesel.c:567 gtk/gtkfontsel.c:952
+#: gtk/gtkcolorseldialog.c:105 gtk/gtkfilesel.c:565 gtk/gtkfontsel.c:952
 #: gtk/gtkgamma.c:415
 msgid "OK"
 msgstr "אישור"
 
 #. The Cancel button
-#: gtk/gtkcolorseldialog.c:111 gtk/gtkfilesel.c:574 gtk/gtkfilesel.c:963
-#: gtk/gtkfilesel.c:1067 gtk/gtkfilesel.c:1182 gtk/gtkfontsel.c:965
+#: gtk/gtkcolorseldialog.c:111 gtk/gtkfilesel.c:572 gtk/gtkfilesel.c:968
+#: gtk/gtkfilesel.c:1077 gtk/gtkfilesel.c:1201 gtk/gtkfontsel.c:965
 #: gtk/gtkgamma.c:423
 msgid "Cancel"
 msgstr "ביטול"
@@ -72,31 +97,31 @@
 msgstr "עזרה"
 
 #. The directories clist
-#: gtk/gtkfilesel.c:514
+#: gtk/gtkfilesel.c:512
 msgid "Directories"
 msgstr "תיקיות"
 
 # hebrew note: "תיקיה" is "folder", but there is no better word for
 # "directory"
 #. The files clist
-#: gtk/gtkfilesel.c:534
+#: gtk/gtkfilesel.c:532
 msgid "Files"
 msgstr "קבצים"
 
-#: gtk/gtkfilesel.c:605 gtk/gtkfilesel.c:1621
+#: gtk/gtkfilesel.c:603 gtk/gtkfilesel.c:1639
 #, c-format
 msgid "Directory unreadable: %s"
 msgstr "תיקיה לא קריאה: %s"
 
-#: gtk/gtkfilesel.c:637
+#: gtk/gtkfilesel.c:635
 msgid "Create Dir"
 msgstr "יצירת תיקיה"
 
-#: gtk/gtkfilesel.c:648 gtk/gtkfilesel.c:1036
+#: gtk/gtkfilesel.c:646 gtk/gtkfilesel.c:1046
 msgid "Delete File"
 msgstr "מחיקת קובץ"
 
-#: gtk/gtkfilesel.c:659 gtk/gtkfilesel.c:1140
+#: gtk/gtkfilesel.c:657 gtk/gtkfilesel.c:1159
 msgid "Rename File"
 msgstr "שינוי שם קובץ"
 
@@ -105,39 +130,39 @@
 #. (GtkSignalFunc) gtk_file_selection_fileop_destroy,
 #. (gpointer) fs);
 #.
-#: gtk/gtkfilesel.c:828
+#: gtk/gtkfilesel.c:827
 msgid "Error"
 msgstr "שגיאה"
 
 #. close button
-#: gtk/gtkfilesel.c:851 gtk/gtkinputdialog.c:338
+#: gtk/gtkfilesel.c:850 gtk/gtkinputdialog.c:338
 msgid "Close"
 msgstr "סגירה"
 
-#: gtk/gtkfilesel.c:927
+#: gtk/gtkfilesel.c:932
 msgid "Create Directory"
 msgstr "יצירת תיקיב"
 
-#: gtk/gtkfilesel.c:941
+#: gtk/gtkfilesel.c:946
 msgid "Directory name:"
 msgstr "שם תיקיה:"
 
 #. buttons
-#: gtk/gtkfilesel.c:954
+#: gtk/gtkfilesel.c:959
 msgid "Create"
 msgstr "יצירה"
 
 #. buttons
-#: gtk/gtkfilesel.c:1058
+#: gtk/gtkfilesel.c:1068
 msgid "Delete"
 msgstr "מחיקה"
 
 #. buttons
-#: gtk/gtkfilesel.c:1173
+#: gtk/gtkfilesel.c:1192
 msgid "Rename"
 msgstr "שינוי שם"
 
-#: gtk/gtkfilesel.c:1600
+#: gtk/gtkfilesel.c:1618
 msgid "Selection: "
 msgstr "בחירה:"
 
@@ -261,19 +286,25 @@
 msgid "clear"
 msgstr ""
 
+#. Translate to default:RTL if you want your widgets
+#. to be RTL, otherwise translate to default:LTR
+#: gtk/gtkmain.c:416
+msgid "default:LTR"
+msgstr "default:RTL"
+
 #: gtk/gtknotebook.c:2059 gtk/gtknotebook.c:4131
 #, c-format
 msgid "Page %u"
 msgstr "דף %u"
 
-#: gtk/gtkrc.c:1872
+#: gtk/gtkrc.c:1978
 #, c-format
 msgid "Unable to locate image file in pixmap_path: \"%s\" line %d"
 msgstr ""
 "לא מצליח לאתר את קובץ התמונה ב-pixmap_path: \"%s\" "
 "שורה %d"
 
-#: gtk/gtkrc.c:1875
+#: gtk/gtkrc.c:1981
 #, c-format
 msgid "Unable to locate image file in pixmap_path: \"%s\""
 msgstr ""


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