atspi: add translation domain for name and description.
@feature
This commit is contained in:
parent
61845ef600
commit
d1ec64205d
|
@ -126,6 +126,7 @@ struct _Elm_Interface_Atspi_Accessible_Data
|
|||
Elm_Atspi_Role role;
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *translation_domain;
|
||||
Elm_Interface_Atspi_Accessible *parent;
|
||||
};
|
||||
|
||||
|
@ -215,7 +216,19 @@ _elm_interface_atspi_accessible_role_name_get(Eo *obj EINA_UNUSED, Elm_Interface
|
|||
EOLIAN char *
|
||||
_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
|
||||
{
|
||||
return pd->name ? strdup(pd->name) : NULL;
|
||||
if (pd->name)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
if (pd->translation_domain)
|
||||
return strdup(dgettext(pd->translation_domain, pd->name));
|
||||
else
|
||||
return strdup(pd->name);
|
||||
#else
|
||||
return strdup(pd->name);
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -226,6 +239,10 @@ _elm_interface_atspi_accessible_name_set(Eo *obj EINA_UNUSED, Elm_Interface_Atsp
|
|||
|
||||
const char * _elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
if (pd->translation_domain)
|
||||
return dgettext(pd->translation_domain, pd->description);
|
||||
#endif
|
||||
return pd->description;
|
||||
}
|
||||
|
||||
|
@ -340,4 +357,16 @@ _elm_interface_atspi_accessible_event_handler_del(Eo *class EINA_UNUSED, void *p
|
|||
}
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
_elm_interface_atspi_accessible_translation_domain_set(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd, const char *domain)
|
||||
{
|
||||
eina_stringshare_replace(&pd->translation_domain, domain);
|
||||
}
|
||||
|
||||
EOLIAN const char*
|
||||
_elm_interface_atspi_accessible_translation_domain_get(Eo *obj EINA_UNUSED, Elm_Interface_Atspi_Accessible_Data *pd)
|
||||
{
|
||||
return pd->translation_domain;
|
||||
}
|
||||
|
||||
#include "elm_interface_atspi_accessible.eo.c"
|
||||
|
|
|
@ -123,6 +123,30 @@ mixin Elm_Interface_Atspi_Accessible ()
|
|||
@in event_info: void*; [[Accessibility event details.]]
|
||||
}
|
||||
}
|
||||
@property translation_domain @protected {
|
||||
get {
|
||||
[[Gets the translation domain of "name" and "description"
|
||||
properties.]]
|
||||
}
|
||||
set {
|
||||
[[Sets the translation domain of "name" and "description"
|
||||
properties.
|
||||
|
||||
Translation domain should be set if application wants to support i18n
|
||||
for accessibily "name" and "description" properties.
|
||||
|
||||
When translation domain is set values of "name" and "description"
|
||||
properties will be translated with dgettext function using
|
||||
current translation domain as "domainname" parameter.
|
||||
|
||||
It is application developer responsibility to ensure that
|
||||
translation files are loaded and binded to translation domain
|
||||
when accessibility is enabled.]]
|
||||
}
|
||||
values {
|
||||
domain: const(char)*; [[ translation domain ]]
|
||||
}
|
||||
}
|
||||
}
|
||||
events {
|
||||
property,changed: const(char)*;
|
||||
|
|
|
@ -4433,6 +4433,7 @@ _elm_widget_item_eo_base_destructor(Eo *eo_item, Elm_Widget_Item_Data *item)
|
|||
|
||||
eo_do(eo_item, elm_interface_atspi_accessible_description_set(NULL));
|
||||
eo_do(eo_item, elm_interface_atspi_accessible_name_set(NULL));
|
||||
eo_do(eo_item, elm_interface_atspi_accessible_translation_domain_set(NULL));
|
||||
|
||||
if (_elm_config->atspi_mode && item->widget)
|
||||
elm_interface_atspi_accessible_children_changed_del_signal_emit(item->widget, eo_item);
|
||||
|
@ -5707,6 +5708,7 @@ _elm_widget_eo_base_destructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
|
|||
{
|
||||
eo_do(obj, elm_interface_atspi_accessible_description_set(NULL));
|
||||
eo_do(obj, elm_interface_atspi_accessible_name_set(NULL));
|
||||
eo_do(obj, elm_interface_atspi_accessible_translation_domain_set(NULL));
|
||||
elm_interface_atspi_accessible_removed(obj);
|
||||
|
||||
eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor());
|
||||
|
|
Loading…
Reference in New Issue