elementary/widget - added elm_widget_item_translate(). Now each item can be translate...
authorChunEon Park <hermet@hermet.pe.kr>
Tue, 12 Feb 2013 15:14:38 +0000 (15:14 +0000)
committerChunEon Park <hermet@hermet.pe.kr>
Tue, 12 Feb 2013 15:14:38 +0000 (15:14 +0000)
SVN revision: 83859

src/lib/elm_widget.c
src/lib/elm_widget.h

index 104ca98..d140923 100644 (file)
@@ -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
index 82f2296..4e51795 100644 (file)
@@ -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) {                                            \