dogtail-devel [Bug 452315] New: i18n.TranslationDb implementation that handles comps.xml



If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=452315

  dogtail | Framework | Ver: 0.6.1
           Summary: i18n.TranslationDb implementation that handles comps.xml
           Product: dogtail
           Version: 0.6.1
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Normal
         Component: Framework
        AssignedTo: dogtail-maint gnome bugs
        ReportedBy: atodorov redhat com
         QAContact: dogtail-maint gnome bugs
     GNOME version: Unspecified
   GNOME milestone: Unspecified


The comps.xml file is used to populate Categories/Groups in package management 
frontends. Examples are yum and 'pirut' (GUI).
Below is a class that implements TranslationDb for use with Dogtail. It has
dependancy on yum.
--------------------------------------------------------------------------------
from yum.comps import Comps

class CompsXMLTranslationDb(TranslationDb):
    def __init__(self, compsFile, language):
        _comps = Comps()
        _comps.add(compsFile)
        self._strings = {}
        # load all strings into a dictionary structure
        for g in _comps._groups.values():
            if g.translated_name.has_key(language):
                self._strings[g.name] = g.translated_name[language]

        for c in _comps._categories.values():
            if c.translated_name.has_key(language):
                self._strings[c.name] = c.translated_name[language]

        del _comps

    def getTranslationsOf(self, srcName):
        result = []
        if self._strings.has_key(srcName):
            result.append(self._strings[srcName])
        return result
--------------------------------------------------------------------------------


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=452315.



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