def __init__(self, output): htmlpage.Htmlpage.__init__(self, None, output) write = self.writer if not write: return self.prologue("Translation teams", 'utf-8') write(' <table>\n' ' <tr>\n' ' <th>Language</th>\n' ' <th>Code</th>\n' ' <th>Team address</th>\n' ' </tr>\n') for team in registry.team_list(): write(' <tr>\n' ' <td><a href="%s.html">%s</a></td>\n' ' <td>%s</td>\n' % (team.code, team.language, team.code)) if team.mailto: write(' <td><a href="mailto:%s">%s</a></td>\n' % (team.mailto[0], team.mailto[0])) else: write(' <td></td>\n') write(' </tr>\n') write(' </table>\n') self.epilogue()
def decode_database(): import registry write = sys.stdout.write write("""\ <!-- Registry data for use in the Translation Project. -*- coding: utf-8 -*- Copyright © 2001, 2002 Translation Project. Copyright © 1996, 1997, 1998, 1999, 2000 Progiciels Bourbeau-Pinard inc. François Pinard `[email protected]', 1996. --> <!DOCTYPE registry SYSTEM "theregistry.dtd"> <registry> <domains> """) for domain in registry.domain_list(): write('\n') write(domain_description(domain)) write("""\ </domains> <teams> """) for team in registry.team_list(): write('\n') write(team_description(team)) write("""\ </teams> </registry> <!-- Local variables: xxml-highlight-tag-alist: (("domains" . secondary-selection) ("teams" . secondary-selection)) xxml-highlight-initial-alist: (("alias" . font-lock-type-face) ("charset" . xxml-header-4-face) ("code" . xxml-header-1-face) ("disclaimer" . font-lock-comment-face) ("do" . italic) ("domain" . xxml-header-3-face) ("leader" . xxml-header-4-face) ("mailto" . font-lock-string-face) ("nomailto" . font-lock-string-face) ("package" . italic) ("ref" . font-lock-builtin-face) ("remark" . font-lock-comment-face) ("team" . xxml-header-1-face) ("translator" . font-lock-type-face) ("url" . font-lock-string-face)) sgml-validate-command: "SP_CHARSET_FIXED=YES SP_ENCODING=utf-8 nsgmls -s %s %s" sgml-omittag:t sgml-shorttag:nil sgml-omit-transparent:t sgml-namecase-general:t sgml-general-insert-case:lower sgml-minimize-attributes:nil sgml-always-quote-attributes:nil sgml-indent-step:1 sgml-indent-data:nil sgml-parent-document:nil sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> """)
def __init__(self, postats, domain, output): htmlpage.Htmlpage.__init__(self, None, output) write = self.writer if not write: return self.prologue("The '%s' textual domain" % domain.name, 'utf-8') if not domain.ref: write(' <p>This page is about the translation of the messages' ' for the <b><code>%s</code></b> textual domain.</p>\n' % domain.name) else: write(' <p>This page is about the translation of the messages' ' for the <b><code>%s</code></b> textual domain. More' ' information about the package can be found here:</p>\n' ' <table>\n' ' <tr>\n' ' <th>Topic</th>\n' ' <th>URL</th>\n' ' </tr>\n' % domain.name) for ref in domain.ref: write(' <tr>\n' ' <td>%s</td>\n' ' <td align=left><a href="%s">%s</a></td>\n' ' </tr>\n' % (ref[0], ref[1], ref[1])) write(' </table>\n') if domain.note: write(' <ul>\n') for note in domain.note: write(' <li>%s</li>' % note) write(' </ul>\n') if domain.disclaim: write(' <p>The maintainer of this package requires that' ' disclaimers be filled out and sent to the' ' Free Software Foundation before accepting PO files' ' from the Translation Project.</p>\n') else: write(' <p>The maintainer does not require any special papers' ' prior to accepting translations.</p>\n') if len(postats) and postats.potstats.has_key(domain.name): file = postats.potstats[domain.name][0] url = registry.hints(file).template_url() write(' <p>The current template for this domain is' ' <a href="%s">%s</a>.\n' % (url, file)) if domain.url: write(' <p>The following URL may help translators that need' ' a finer context in order to make their translation. ' ' Be aware that the indicated package could be just' ' a pre-release, and might not even compile:</p>\n') write(' <ul>\n') for url in domain.url: write(' <li><a href="%s">%s</a>\n' % (url, url)) write(' </ul>\n') write(' <p>The following table lists (under <strong>Version</strong>) all the' ' PO files that are available for this domain:</p>\n' ' <table class="tablesorter" name="stats-table" id="stats-table" >\n' ' <tr>\n' ' <th>Language</th>\n' ' <th>Code</th>\n' ' <th>Package version</th>\n' ' <th>Last translator</th>\n' ' <th>Translation Statistics</th>\n' ' </tr>\n') for team in registry.team_list(): if team.code in domain.ext: stats = get_extstats().get((domain.name, team.name)) if stats: trans = stats['translated'] fuzzy = stats['fuzzy'] untrans = stats['untranslated'] total = trans + fuzzy + untrans percent = 100*trans/(total) numbers = "%d%% %d %d %d" % (percent, trans, fuzzy, untrans) else: numbers = "unknown" if os.path.isfile('%s/%s/%s.po' % (config.last_path, domain.name, team.name)): color = "#f8d0f8" # Magenta: external but file is present. else: color = "#e8e8e8" # Grey: plain external. write('<tr>' '<td><a href="../team/%s.html">%s</a></td>' '<td>%s</td><td>--</td>' '<td><i>external</i></td>' '<td bgcolor="%s">%s</td></tr>\n' % (team.code, team.language, team.code, color, numbers)) else: build_language_cell(postats, write, team, domain) write(' </table>\n') self.epilogue()