After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694117 - Add atk_object_get_locale()
Add atk_object_get_locale()
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: atk
unspecified
Other Linux
: Normal normal
: ---
Assigned To: ATK maintainer(s)
ATK maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-02-18 18:55 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2013-02-19 11:50 UTC
See Also:
GNOME target: 3.8
GNOME version: ---


Attachments
Add atk_object_get_accessible_locale (3.29 KB, patch)
2013-02-18 19:36 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review
Deprecate atk_document_get_locale (1.79 KB, patch)
2013-02-18 19:37 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review
A little test using the new API added (868 bytes, text/x-csrc)
2013-02-18 19:38 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
  Details

Description Joanmarie Diggs (IRC: joanie) 2013-02-18 18:55:36 UTC
Currently we have atk_document_get_locale(). This is insufficient for the following reasons:

* individual objects within documents (html, libreoffice) can have
  their own locales
* applications can be launched in a locale other than the session's

With respect to the latter item, Orca users would like Orca to be able to present text and widgets using the speech synthesizer associated with the object's locale. But if an application has a different locale than the session's default locale, we wind up with a mixture of languages such as:

SPEECH OUTPUT: 'Szöveg tördelése Sortörés engedélyezése jelölőnégyzet checked'

I can easily solve this problem if I know the locale of the widget.

Please and thank you. :)
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-02-18 19:01:16 UTC
(In reply to comment #0)
> Currently we have atk_document_get_locale(). This is insufficient for the
> following reasons:
> 
> * individual objects within documents (html, libreoffice) can have
>   their own locales
> * applications can be launched in a locale other than the session's
> 
> With respect to the latter item, Orca users would like Orca to be able to
> present text and widgets using the speech synthesizer associated with the
> object's locale. But if an application has a different locale than the
> session's default locale, we wind up with a mixture of languages such as:
> 
> SPEECH OUTPUT: 'Szöveg tördelése Sortörés engedélyezése jelölőnégyzet checked'
> 
> I can easily solve this problem if I know the locale of the widget.

As talked via IRC, for this, the easier would be add a new method on atk_object:
  * Add virtual atk_object_get_locale method as requested
     * Default implementation could be a call to setlocale (LC_MESSAGES, NULL)
  * Deprecate atk_document_get_locale

Will try to have this method added today, as is release day for the freeze release.
Comment 2 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-02-18 19:36:36 UTC
Created attachment 236654 [details] [review]
Add atk_object_get_accessible_locale

In the end I called this new method "atk_object_get_accessible_locale" in order to avoid any possible name conflict with any other atk_xxx_get_locale method, included the soon to be deprecated (next patch) atk_document_get_locale. This name convection is the one used at atk_image_get_image_locale.
Comment 3 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-02-18 19:37:31 UTC
Created attachment 236655 [details] [review]
Deprecate atk_document_get_locale

Deprecate atk_document_get_locale in favor of atk_object_get_accessible_locale.
Comment 4 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-02-18 19:38:32 UTC
Created attachment 236657 [details]
A little test using the new API added

Just in case someone is curious, a little gtk test using the new API
Comment 5 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-02-18 22:28:23 UTC
Comment on attachment 236654 [details] [review]
Add atk_object_get_accessible_locale

After a change on the method name (atk_object_get_object_locale) this patch was committed
Comment 6 Allison Karlitskaya (desrt) 2013-02-19 09:54:15 UTC
Looks like an #include <locale.h> is missing here, causing build failures for me:

atkobject.c:1567:3: warning: implicit declaration of function 'setlocale' -Wimplicit-function-declaration]
atkobject.c:1567:21: error: 'LC_MESSAGES' undeclared (first use in this function)
Comment 7 Alejandro Piñeiro Iglesias (IRC: infapi00) 2013-02-19 11:50:33 UTC
(In reply to comment #6)
> Looks like an #include <locale.h> is missing here, causing build failures for
> me:
> 
> atkobject.c:1567:3: warning: implicit declaration of function 'setlocale'
> -Wimplicit-function-declaration]
> atkobject.c:1567:21: error: 'LC_MESSAGES' undeclared (first use in this
> function)

Oddly enough, I didn't have that problem. Anyway, just in case, I added the explicit #include <locale.h> on atkobject.c, committed it and rolled a new release including that change:
download.gnome.org/sources/atk/2.7/atk-2.7.91.tar.xz

Thanks for the feedback