From f04a6d19d9fc6801033eba561c43d3f58fb7a2b5 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 9 Nov 2020 18:56:42 +0100 Subject: Fix i18n in backgrounds and emblems dialog --- eel/eel-xml-extensions.c | 40 ------------------------------- eel/eel-xml-extensions.h | 2 -- libcaja-private/caja-customization-data.c | 4 ++-- src/caja-property-browser.c | 12 +++++----- 4 files changed, 8 insertions(+), 50 deletions(-) diff --git a/eel/eel-xml-extensions.c b/eel/eel-xml-extensions.c index de09b99f..da2cf6b5 100644 --- a/eel/eel-xml-extensions.c +++ b/eel/eel-xml-extensions.c @@ -84,43 +84,3 @@ eel_xml_get_root_child_by_name_and_property (xmlDocPtr document, property_name, property_value); } - -xmlChar * -eel_xml_get_property_translated (xmlNodePtr parent, - const char *property_name) -{ - xmlChar *property, *untranslated_property; - char *untranslated_property_name; - const char *translated_property; - - /* Try for the already-translated version. */ - property = xmlGetProp (parent, property_name); - if (property != NULL) - { - return property; - } - - /* Try for the untranslated version. */ - untranslated_property_name = g_strconcat ("_", property_name, NULL); - untranslated_property = xmlGetProp (parent, untranslated_property_name); - g_free (untranslated_property_name); - if (untranslated_property == NULL) - { - return NULL; - } - - /* Try to translate. */ - translated_property = gettext (untranslated_property); - - /* If not translation is found, return untranslated property as-is. */ - if (translated_property == (char *) untranslated_property) - { - return untranslated_property; - } - - /* If a translation happened, make a copy to match the normal - * behavior of this function (returning a string you xmlFree). - */ - xmlFree (untranslated_property); - return xmlStrdup (translated_property); -} diff --git a/eel/eel-xml-extensions.h b/eel/eel-xml-extensions.h index 90d19f5f..fba9ba57 100644 --- a/eel/eel-xml-extensions.h +++ b/eel/eel-xml-extensions.h @@ -37,7 +37,5 @@ xmlNodePtr eel_xml_get_root_child_by_name_and_property (xmlDocPtr document, const char *child_name, const char *property_name, const char *property_value); -xmlChar *eel_xml_get_property_translated (xmlNodePtr parent, - const char *property_name); #endif /* EEL_XML_EXTENSIONS_H */ diff --git a/libcaja-private/caja-customization-data.c b/libcaja-private/caja-customization-data.c index b95cc366..1b9e6608 100644 --- a/libcaja-private/caja-customization-data.c +++ b/libcaja-private/caja-customization-data.c @@ -485,11 +485,11 @@ load_name_map_hash_table (CajaCustomizationData *data) { char *filename, *display_name; - display_name = eel_xml_get_property_translated (current_node, "display_name"); + display_name = xmlGetProp (current_node, "display_name"); filename = xmlGetProp (current_node, "filename"); if (display_name && filename) { - g_hash_table_replace (data->name_map_hash, g_strdup (filename), g_strdup (display_name)); + g_hash_table_replace (data->name_map_hash, g_strdup (filename), g_strdup (_(display_name))); } xmlFree (filename); xmlFree (display_name); diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 56b8d439..c029ad90 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -2071,13 +2071,13 @@ make_properties_from_xml_node (CajaPropertyBrowser *property_browser, } color = xmlNodeGetContent (child_node); - name = eel_xml_get_property_translated (child_node, "name"); + name = xmlGetProp (child_node, "name"); /* make the image from the color spec */ pixbuf = make_color_drag_image (property_browser, color, FALSE); /* make the tile from the pixmap and name */ - new_property = labeled_image_new (name, pixbuf, color, PANGO_SCALE_LARGE); + new_property = labeled_image_new (_(name), pixbuf, color, PANGO_SCALE_LARGE); gtk_container_add (GTK_CONTAINER (property_browser->details->content_table), new_property); gtk_widget_show (new_property); @@ -2266,14 +2266,14 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser) { path = xmlGetProp (cur_node, "path"); mode = xmlGetProp (cur_node, "mode"); - description = eel_xml_get_property_translated (cur_node, "description"); + description = xmlGetProp (cur_node, "description"); type = xmlGetProp (cur_node, "type"); make_category (property_browser, path, mode, cur_node, - description); + _(description)); caja_property_browser_set_drag_type (property_browser, type); xmlFree (path); @@ -2284,12 +2284,12 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser) if (!got_categories) { - display_name = eel_xml_get_property_translated (cur_node, "display_name"); + display_name = xmlGetProp (cur_node, "display_name"); image = xmlGetProp (cur_node, "image"); make_category_link (property_browser, name, - display_name, + _(display_name), image, &group); -- cgit v1.2.1