From 19c9d98d7e44386df49853362dfcd3bfb8bde5b9 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Tue, 12 Feb 2013 15:14:38 +0000 Subject: [PATCH] elementary/widget - added elm_widget_item_translate(). Now each item can be translated by calling this. SVN revision: 83859 --- legacy/elementary/src/lib/elm_widget.c | 17 +++++++++++++++++ legacy/elementary/src/lib/elm_widget.h | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 104ca98..d140923 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -5216,6 +5216,23 @@ _elm_widget_item_access_info_set(Elm_Widget_Item *item, else item->access_info = eina_stringshare_add(txt); } +EAPI void +_elm_widget_item_translate(Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + +#ifdef HAVE_GETTEXT + Elm_Translate_String_Data *ts; + const Eina_List *l; + + EINA_LIST_FOREACH(item->translate_strings, l, ts) + { + const char *s = dgettext(ts->domain, ts->string); + _elm_widget_item_part_text_set(it, ts->id, s); + } +#endif +} + /* happy debug functions */ #ifdef ELM_DEBUG static void diff --git a/legacy/elementary/src/lib/elm_widget.h b/legacy/elementary/src/lib/elm_widget.h index 82f2296..4e51795 100644 --- a/legacy/elementary/src/lib/elm_widget.h +++ b/legacy/elementary/src/lib/elm_widget.h @@ -733,6 +733,7 @@ EAPI void _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, E EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func); EAPI void _elm_widget_item_domain_translatable_part_text_set(Elm_Widget_Item *item, const char *part, const char *domain, const char *label); EAPI const char * _elm_widget_item_translatable_part_text_get(const Elm_Widget_Item *item, const char *part); +EAPI void _elm_widget_item_translate(Elm_Widget_Item *item); /** * Function to operate on a given widget's scrollabe children when necessary. @@ -956,6 +957,13 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out #define elm_widget_item_del_pre_hook_set(item, func) \ _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func) +/** + * Convenience function to query translate hook. + * @see _elm_widget_item_translate() + */ +#define elm_widget_item_translate(item) \ + _elm_widget_item_translate((Elm_Widget_Item *)item) + #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \ do { \ if (!item) { \ -- 2.7.4