dogtail-devel Re: Partially-working automatic i18n support



Thanks for looking into the i18n support. I tried to implement gettext
into the gedit test case, however, the string retrieved has too many
false positive and caused the test case to fail.

Tried to include your patch and observed some errors. I will try again
when I get home. :-)


Lawrence
==========
Detecting distribution:  Red Hat/Fedora/derived distribution
Traceback (most recent call last):
  File "./evolution-test-composing-html.py", line 11, in ?
    from dogtail.apps.wrappers.evolution import *
  File "/usr/lib/python2.3/site-
packages/dogtail/apps/wrappers/evolution.py", line 7, in ?
    from dogtail.tree import *
  File "/usr/lib/python2.3/site-packages/dogtail/tree.py", line 69, in ?
    from utils import doDelay
  File "/usr/lib/python2.3/site-packages/dogtail/utils.py", line 16,
in ?
    from logging import debugLogger as logger
  File "/usr/lib/python2.3/site-packages/dogtail/logging.py", line 207,
in ?
    debugLogger = DebugLogger()
  File "/usr/lib/python2.3/site-packages/dogtail/logging.py", line 195,
in __init__
    self.iconLogger = IconLogger()
  File "/usr/lib/python2.3/site-packages/dogtail/logging.py", line 155,
in __init__
    from trayicon import TrayIcon
  File "/usr/lib/python2.3/site-packages/dogtail/trayicon.py", line 22,
in ?
    import subprocess
ImportError: No module named subprocess


On Fri, 2005-10-21 at 01:43 -0400, Dave Malcolm wrote:
> I did some more work on dealing with translations in script files, and
> have got automatic translation working... well, almost :-)
> 
> Attached is a reworking of my last i18n test code into a proposed
> dogtail/i18n.py module, together with a patch to various files, and a
> new test script.  
> 
> The idea is that you can install a translation database of some kind.
> One type of translation database is the approach demonstrated in an
> earlier post, involving scraping the package database to find gettext mo
> files to determine the gettext translation domains of interest. So I
> wrote a subclass that implements this.  This is a greybox testing
> approach (assuming I understand the term).  Other subclasses could be
> implemented, either leveraging other implementations of i18n (for 3rd-
> party apps not using GNU gettext), or supplying their own translations
> in the test scripts, for more of a blackbox approach.
> 
> This translation database is a singleton/global throughout the lifetime
> of the script, and is used to pretranslate the strings in each search
> predicate, so that you're doing string matching against translated
> strings (and it means you only run the gettext translation lookup once
> per search, rather than per-search-per-node-visited, so it ought to be
> fairly efficient; my first pass at this used the latter approach and was
> noticeably slower running scripts, with lots of CPU churn).
> 
> I patched the evolution wrapper so that it automatically installs the
> "scraped from the package database" translation db, and took an existing
> script (evolution-test-configuring-imap-smtp) and tried to get it to
> work otherwise unchanged with evolution and the script running in
> LANG=fr_FR.UTF-8
> 
> It gets some way through the script and then runs into problems; here's
> the debug log (on an FC3 box): 
> 
> Detecting distribution:  Red Hat/Fedora/derived distribution
> Warning: Dogtail could not import the Python bindings for libwnck.  Window-manager manipulation will not be available.
> Evolution version 2.0.4
> evolution-data-server version 1.0.4
> gtkhtml3 version 3.3.2
> click on {"Settings..." ("Param�es...") menuitem}
> 
> (evolution:24185): GLib-GObject-WARNING **: g_object_weak_unref: couldn't find weak ref 0x6013d6(0xb7bf4cf4)
> 
> (evolution:24185): Gtk-CRITICAL **: file gtktreesortable.c: line 137 (gtk_tree_sortable_set_sort_column_id): assertion `GTK_IS_TREE_SORTABLE (sortable)' failed
> 
> ** (evolution:24185): CRITICAL **: file utils.c: line 100 (html_utils_get_accessible): assertion `o != NULL' failed
> 
> (evolution:24185): Gtk-CRITICAL **: file gtktogglebutton.c: line 326 (gtk_toggle_button_get_active): assertion `GTK_IS_TOGGLE_BUTTON (toggle_button)' failed
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 3)
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 4)
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 5)
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 6)
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 7)
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 8)
> searching for descendent of {child with name="Evolution Settings" ("Param�es d'Evolution")}: child with name="Add" ("Add") (attempt 9)
> 
> etc...
> 
> It successfully translates the clicks on Tools->Settings and the
> settings dialog name into the french equivalents, but runs into problems
> clicking on the Add button for adding an account; "Add" isn't found in
> any of the mo files suggested by the RPM database.  This string comes
> from a stock item: "gtk-add", referenced in a glade file 
> (mail-config.glade)  I'm not sure ATM how to deal with this
> (specialcasing? a bug? an oversight?)
> 
> (I also patched the predicate classes so that the search and node
> descriptions in the log file contain both the script string, and the
> translated string, if available; you can see this in the logs above).
> 
> I also added a getUserVisibleStrings method to Node, and the i18-test.py
> script mutated somewhat into something that scrapes all strings out of
> an app and tries to autotranslate them (I've attached that script);
> here's the result of running the script on evolution running in English
> and translating to French:
> 
> Detecting distribution:  Red Hat/Fedora/derived distribution
> Warning: Dogtail could not import the Python bindings for libwnck.  Window-manager manipulation will not be available.
> User-visible string: evolution
> Translation in fr locale is:evolution
> User-visible string: Evolution - Mail
> Translation in fr locale is:Evolution - Mail
> User-visible string: grip
> Translation in fr locale is:grip
> User-visible string: File
> Translation in fr locale is:Fichier
> User-visible string: New
> Translation in fr locale is:Nouveau
> User-visible string: Mail Message
> Translation in fr locale is:Mail Message
> User-visible string: Mail Folder
> Translation in fr locale is:Mail Folder
> User-visible string: All Day Appointment
> Translation in fr locale is:All Day Appointment
> User-visible string: Appointment
> Translation in fr locale is:Rendez-vous
> User-visible string: Assigned Task
> Translation in fr locale is:Assigned Task
> User-visible string: Contact
> Translation in fr locale is:Contact
> User-visible string: Contact List
> Translation in fr locale is:Contact List
> User-visible string: Meeting
> Translation in fr locale is:R�ion
> User-visible string: Task
> Translation in fr locale is:T�e
> User-visible string: Address Book
> Translation in fr locale is:Carnet d'adresses
> User-visible string: Calendar
> Translation in fr locale is:Calendrier
> User-visible string: Task list
> Translation in fr locale is:Task list
> User-visible string: New Window
> Translation in fr locale is:New Window
> User-visible string: Open Message
> Translation in fr locale is:Open Message
> User-visible string: Save As...
> Translation in fr locale is:Enregistrer sous...
> User-visible string: Import...
> Translation in fr locale is:Importer...
> User-visible string: Print Preview
> Translation in fr locale is:Aper�avant impression
> User-visible string: Print...
> Translation in fr locale is:Print...
> User-visible string: Folder
> Translation in fr locale is:Dossier
> User-visible string: Properties
> Translation in fr locale is:Propri�s
> User-visible string: Work Offline
> Translation in fr locale is:Travail hors ligne
> User-visible string: Close
> Translation in fr locale is:Fermer
> 
> etc...
> 
> Thoughts?
> 
> The patch to predicate.py probably breaks examples/recorder.py somewhat,
> but that script was fairly broken anyway
> 
> Plus I had to hack away parts of logger to get things working on FC3;
> the trayicon stuff uses "subprocess", which is a Python 2.4 thing, and
> FC3 only has Python 2.3
> 
> Also, I don't how much this affects procedural.py; but it's getting late
> and I really should sleep now...
> 
> 
> Dave
> 
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]