From a3d8a202d6a1c13769886a9ea856878d36433a07 Mon Sep 17 00:00:00 2001 From: lclausen Date: Sun, 26 Feb 2006 14:58:26 +0000 Subject: [PATCH] I18n fix for sheet names, element width/height setting turned off. --- ChangeLog | 20 ++++++++++++++++++++ app/interface.c | 10 +++++----- app/sheets.c | 2 +- dia.spec | 4 ++-- lib/diaarrowchooser.c | 2 +- lib/element.h | 4 ++-- lib/sheet.c | 15 +++++++++++++-- lib/widgets.c | 2 +- 8 files changed, 45 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 70852fa5..db5fa2cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2006-02-26 Lars Clausen + + * lib/element.h (ELEMENT_COMMON_PROPERTIES): Turning off setting + of element_width and element_height until constraints can be + properly checked. + + * dia.spec (Requires): Updated GTK requirements. + +2006-02-25 Lars Clausen + + * lib/diaarrowchooser.c (dia_arrow_chooser_new): Also making sure + other dynamic menus have proper translation. + + * lib/widgets.c (dia_dynamic_menu_create_string_item): + * app/interface.c (cmp_names): + * app/sheets.c (sheets_optionmenu_create): + * lib/sheet.c (load_register_sheet): Using C locale for sheet + names internally, translating on display instead. Also sorting + by gettext order explicitly. + 2006-02-25 Hans Breuer * app/interface.c(get_sheet_by_name) : be more tolerant about diff --git a/app/interface.c b/app/interface.c index 1cf2cca1..a6a15b2e 100644 --- a/app/interface.c +++ b/app/interface.c @@ -789,7 +789,7 @@ get_sheet_by_name(const gchar *name) /* There is something fishy with comparing both forms: the english and the localized one. * But we should be on the safe side here, especially when bug #328570 gets tackled. */ - if (0 == g_strcasecmp(name, sheet->name) || 0 == g_strcasecmp(name, gettext(sheet->name))) + if (0 == g_strcasecmp(name, sheet->name) || 0 == g_strcasecmp(name, gettext(sheet->name))) return sheet; } return NULL; @@ -912,7 +912,7 @@ sheet_menu_callback(DiaDynamicMenu *menu, const gchar *string, void *user_data) static int cmp_names (const void *a, const void *b) { - return g_utf8_collate((gchar *)a, (gchar *)b); + return g_utf8_collate(gettext( (gchar *)a ), gettext( (gchar *)b )); } static GList * @@ -922,7 +922,7 @@ get_sheet_names() GList *names = NULL; for (tmp = get_sheets_list(); tmp != NULL; tmp = tmp->next) { Sheet *sheet = tmp->data; - names = g_list_append(names, gettext(sheet->name)); + names = g_list_append(names, sheet->name); } /* Already sorted in lib/ but here we sort by the localized (display-)name */ return g_list_sort (names, cmp_names); @@ -943,9 +943,9 @@ create_sheet_dropdown_menu(GtkWidget *parent) sheet_menu_callback, NULL, "sheets"); dia_dynamic_menu_add_default_entry(DIA_DYNAMIC_MENU(sheet_option_menu), - _("Assorted")); + "Assorted"); dia_dynamic_menu_add_default_entry(DIA_DYNAMIC_MENU(sheet_option_menu), - _("UML")); + "UML"); /* gtk_widget_set_size_request(sheet_option_menu, 20, -1);*/ gtk_wrap_box_pack_wrapped(GTK_WRAP_BOX(parent), sheet_option_menu, TRUE, TRUE, FALSE, FALSE, TRUE); diff --git a/app/sheets.c b/app/sheets.c index ebb43d16..281fb053 100644 --- a/app/sheets.c +++ b/app/sheets.c @@ -148,7 +148,7 @@ sheets_optionmenu_create(GtkWidget *option_menu, GtkWidget *wrapbox, continue; { - menu_item = gtk_menu_item_new_with_label(sheet_mod->sheet.name); + menu_item = gtk_menu_item_new_with_label(gettext(sheet_mod->sheet.name)); gtk_menu_append(GTK_MENU(optionmenu_menu), menu_item); diff --git a/dia.spec b/dia.spec index f04b4e19..062d09a8 100644 --- a/dia.spec +++ b/dia.spec @@ -13,10 +13,10 @@ Source: ftp://ftp.gnome.org/pub/GNOME/stable/sources/dia/%{name}-%{ver}.tar.gz URL: http://www.gnome.org/projects/dia/ BuildRoot: /var/tmp/%{name}-%{ver}-root -Requires: libxml2 >= 2.3.9 gtk2 pango >= 1.1.5 freetype2 >= 2.0.9 +Requires: libxml2 >= 2.3.9 gtk2 >= 2.6.0 pango >= 1.1.5 freetype2 >= 2.0.9 Requires: libgnome libgnomeui popt Requires: python python-gtk -BuildRequires: libxml2-devel >= 2.3.9 gtk2-devel pango-devel >= 1.1.5 +BuildRequires: libxml2-devel >= 2.3.9 gtk2-devel >= 2.6.0 pango-devel >= 1.1.5 BuildRequires: freetype2-devel >= 2.0.9 intltool > 0.21 BuildRequires: libgnome-devel libgnomeui-devel popt-devel BuildRequires: python python-gtk diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c index a4bd9fdd..2c638d35 100644 --- a/lib/diaarrowchooser.c +++ b/lib/diaarrowchooser.c @@ -407,7 +407,7 @@ dia_arrow_chooser_new(gboolean left, DiaChangeArrowCallback callback, g_object_set_data(G_OBJECT(mi), menuitem_enum_key, GINT_TO_POINTER(arrow_types[i].enum_value)); if (tool_tips) { - gtk_tooltips_set_tip(tool_tips, mi, arrow_types[i].name, NULL); + gtk_tooltips_set_tip(tool_tips, mi, gettext(arrow_types[i].name), NULL); } ar = dia_arrow_preview_new(arrow_types[i].enum_value, left); diff --git a/lib/element.h b/lib/element.h index 9b74c36f..503acb43 100644 --- a/lib/element.h +++ b/lib/element.h @@ -69,9 +69,9 @@ static PropNumData width_range = { -G_MAXFLOAT, G_MAXFLOAT, 0.1}; OBJECT_COMMON_PROPERTIES, \ { "elem_corner", PROP_TYPE_POINT, 0, \ "Element corner", "The corner of the element"}, \ - { "elem_width", PROP_TYPE_REAL, PROP_FLAG_VISIBLE, \ + { "elem_width", PROP_TYPE_REAL, PROP_FLAG_DONT_MERGE, \ "Element width", "The width of the element", &width_range}, \ - { "elem_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE, \ + { "elem_height", PROP_TYPE_REAL, PROP_FLAG_DONT_MERGE, \ "Element height", "The height of the element", &width_range} /* Would like to have the frame, but need to figure out why diff --git a/lib/sheet.c b/lib/sheet.c index a19ff25e..cb7bf0d5 100644 --- a/lib/sheet.c +++ b/lib/sheet.c @@ -107,10 +107,13 @@ static void load_sheets_from_dir(const gchar *directory, SheetScope scope); static void load_register_sheet(const gchar *directory,const gchar *filename, SheetScope scope); +/** Sort the list of sheets by *locale*. + */ static gint dia_sheet_sort_callback(gconstpointer a, gconstpointer b) { - return g_utf8_collate(((Sheet *)(a))->name, ((Sheet *)(b))->name); + return g_utf8_collate(gettext( ((Sheet *)(a))->name ), + gettext( ((Sheet *)(b))->name )); } void @@ -234,10 +237,18 @@ load_register_sheet(const gchar *dirname, const gchar *filename, /* compare the xml:lang property on this element to see if we get a * better language match. LibXML seems to throw away attribute * namespaces, so we use "lang" instead of "xml:lang" */ + /* Now using the C locale for internal sheet names, instead gettexting + * when the name is used in the menus. Not going to figure out the + * XML lang system more than absolutely necessary now. --LC + */ + /* tmp = xmlGetProp(node, "xml:lang"); if (!tmp) tmp = xmlGetProp(node, "lang"); - score = intl_score_locale(tmp); + */ + score = intl_score_locale("C"); + /* if (tmp) xmlFree(tmp); + */ if (name_score < 0 || score < name_score) { name_score = score; diff --git a/lib/widgets.c b/lib/widgets.c index b15e64a7..5ae8b576 100644 --- a/lib/widgets.c +++ b/lib/widgets.c @@ -1762,7 +1762,7 @@ dia_dynamic_menu_activate(GtkWidget *item, gpointer userdata) static GtkWidget * dia_dynamic_menu_create_string_item(DiaDynamicMenu *ddm, gchar *string) { - GtkWidget *item = gtk_menu_item_new_with_label(string); + GtkWidget *item = gtk_menu_item_new_with_label(gettext(string)); return item; } -- 2.11.4.GIT