forked from enlightenment/efl
elementary/widget item - and add elm_object_item_domain_part_text_translatable_set().
This commit is contained in:
parent
9ad338cdfa
commit
c81bda1077
|
@ -1275,7 +1275,8 @@
|
|||
|
||||
2013-04-23 ChunEon Park
|
||||
|
||||
* Added elm_object_domain_part_text_translatable_set().
|
||||
* Added elm_object_domain_part_text_translatable_set(),
|
||||
elm_object_item_domain_part_text_translatable_set().
|
||||
|
||||
2013-04-23 Jaehwan Kim
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ Additions:
|
|||
* Add the API elm_scroller_single_direction_set/get.
|
||||
* Add the feature for key events.
|
||||
* Add elm_access_action(), elm_access_action_cb_set()
|
||||
* Add elm_object_domain_part_text_translatable_set()
|
||||
* Add elm_object_domain_part_text_translatable_set(), elm_object_item_domain_part_text_translatable_set().
|
||||
|
||||
Improvements:
|
||||
|
||||
|
|
|
@ -1573,6 +1573,12 @@ elm_object_item_translatable_part_text_get(const Elm_Object_Item *it, const char
|
|||
return _elm_widget_item_translatable_part_text_get((Elm_Widget_Item *)it, part);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_object_item_domain_part_text_translatable_set(Elm_Object_Item *it, const char *part, const char *domain, Eina_Bool translatable)
|
||||
{
|
||||
_elm_widget_item_domain_part_text_translatable_set((Elm_Widget_Item *)it, part, domain, translatable);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_object_access_info_set(Evas_Object *obj, const char *txt)
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ EAPI const char *elm_object_translatable_part_text_get(const Evas_Object *obj, c
|
|||
* @param translatable @c EINA_TRUE, the part text will be translated
|
||||
* internally. @c EINA_FALSE, otherwise.
|
||||
*
|
||||
* @see elm_object_domain_part_text_translatable_set()
|
||||
* @see elm_object_domain_translatable_part_text_set()
|
||||
* @see elm_object_part_text_set()
|
||||
* @see elm_policy()
|
||||
*
|
||||
|
|
|
@ -171,6 +171,34 @@ EAPI const char *elm_object_item_translatable_part_text_get(const Elm_Object_Ite
|
|||
|
||||
#define elm_object_item_translatable_text_get(it) elm_object_item_translatable_part_text_get((it), NULL)
|
||||
|
||||
/**
|
||||
* Mark the part text to be transltable or not.
|
||||
*
|
||||
* Once you mark the part text to be translatable, the text will be translated
|
||||
* internally regardless of elm_object_item_part_text_set() and
|
||||
* elm_object_item_domain_translatable_part_text_set(). In other case, if you
|
||||
* set the Elementary policy that all text will be translatable in default, you
|
||||
* can set the part text to not be translated by calling this API.
|
||||
*
|
||||
* @param it The object item containing the text part
|
||||
* @param part The part name of the translatable text
|
||||
* @param domain The translation domain to use
|
||||
* @param translatable @c EINA_TRUE, the part text will be translated
|
||||
* internally. @c EINA_FALSE, otherwise.
|
||||
*
|
||||
* @see elm_object_item_domain_translatable_part_text_set()
|
||||
* @see elm_object_item_part_text_set()
|
||||
* @see elm_policy()
|
||||
*
|
||||
* @since 1.8
|
||||
*
|
||||
* @ingroup General
|
||||
*/
|
||||
EAPI void elm_object_item_domain_part_text_translatable_set(Elm_Object_Item *it, const char *part, const char *domain, Eina_Bool translatable);
|
||||
|
||||
#define elm_object_item_part_text_translatable_set(it, part, translatable) elm_object_item_domain_part_text_translatable_set((it), (part), NULL, (translatable))
|
||||
|
||||
#define elm_object_item_domain_text_translatable_set(it, domain, translatable) elm_object_item_domain_part_text_translatable_set((it), NULL, (domain), (translatable))
|
||||
|
||||
/**
|
||||
* Set the text to read out when in accessibility mode
|
||||
|
|
|
@ -5143,6 +5143,36 @@ _elm_widget_item_translatable_part_text_get(const Elm_Widget_Item *item,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
_elm_widget_item_domain_part_text_translatable_set(Elm_Widget_Item *item,
|
||||
const char *part,
|
||||
const char *domain,
|
||||
Eina_Bool translatable)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
Elm_Translate_String_Data *ts;
|
||||
const char *text;
|
||||
|
||||
ts = _part_text_translatable_set(&item->translate_strings, part,
|
||||
translatable, EINA_TRUE);
|
||||
if (!ts) return;
|
||||
if (!ts->domain) ts->domain = eina_stringshare_add(domain);
|
||||
else eina_stringshare_replace(&ts->domain, domain);
|
||||
|
||||
text = _elm_widget_item_part_text_get(item, part);
|
||||
if (!text || !text[0]) return;
|
||||
|
||||
if (!ts->string) ts->string = eina_stringshare_add(text);
|
||||
|
||||
//Try to translate text since we don't know the text is already translated.
|
||||
#ifdef HAVE_GETTEXT
|
||||
text = dgettext(domain, text);
|
||||
#endif
|
||||
item->on_translate = EINA_TRUE;
|
||||
_elm_widget_item_part_text_set(item, part, text);
|
||||
item->on_translate = EINA_FALSE;
|
||||
}
|
||||
|
||||
typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip;
|
||||
|
||||
struct _Elm_Widget_Item_Tooltip
|
||||
|
@ -5716,11 +5746,13 @@ _elm_widget_item_translate(Elm_Widget_Item *item)
|
|||
#ifdef HAVE_GETTEXT
|
||||
Elm_Translate_String_Data *ts;
|
||||
const Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(item->translate_strings, l, ts)
|
||||
{
|
||||
if (!ts->string) continue;
|
||||
const char *s = dgettext(ts->domain, ts->string);
|
||||
item->on_translate = EINA_TRUE;
|
||||
_elm_widget_item_part_text_set(item, ts->id, s);
|
||||
item->on_translate = EINA_FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -765,6 +765,7 @@ EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, E
|
|||
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);
|
||||
EAPI void _elm_widget_item_domain_part_text_translatable_set(Elm_Widget_Item *item, const char *part, const char *domain, Eina_Bool translatable);
|
||||
|
||||
/**
|
||||
* Function to operate on a given widget's scrollabe children when necessary.
|
||||
|
|
Loading…
Reference in New Issue