Edgewall Software

CookBook/PluginL10N: trac-subtickets-plugin_i18n-l10n.patch

File trac-subtickets-plugin_i18n-l10n.patch, 11.8 KB (added by hasienda <hoff.st@…>, 2 years ago)

i18n/l10n patch for TracSubtickets plugin maintained by Takashi Ito

  • itota-trac-subtickets-plugin-cb202be/setup.cfg

    diff -Nur a/itota-trac-subtickets-plugin-cb202be/setup.cfg b/itota-trac-subtickets-plugin-cb202be/setup.cfg
    a b  
    11[egg_info] 
    22tag_build = .dev 
    33tag_date = True 
     4 
     5[extract_messages] 
     6add_comments = TRANSLATOR: 
     7msgid_bugs_address = hoff.st@web.de 
     8output_file = tracsubtickets/locale/messages.pot 
     9keywords = _ ngettext:1,2 N_ tag_ 
     10width = 72 
     11 
     12[init_catalog] 
     13input_file = tracsubtickets/locale/messages.pot 
     14output_dir = tracsubtickets/locale 
     15domain = tracsubtickets 
     16 
     17[compile_catalog] 
     18directory = tracsubtickets/locale 
     19domain = tracsubtickets 
     20 
     21[update_catalog] 
     22input_file = tracsubtickets/locale/messages.pot 
     23output_dir = tracsubtickets/locale 
     24domain = tracsubtickets 
  • itota-trac-subtickets-plugin-cb202be/setup.py

    diff -Nur a/itota-trac-subtickets-plugin-cb202be/setup.py b/itota-trac-subtickets-plugin-cb202be/setup.py
    a b  
    11#!/usr/bin/python 
    22# 
    33# Copyright (c) 2010, Takashi Ito 
     4# i18n and German translation by Steffen Hoffmann 
    45# All rights reserved. 
    56# 
    67# Redistribution and use in source and binary forms, with or without 
     
    3132 
    3233setup( 
    3334    name = 'TracSubTicketsPlugin', 
    34     version = '0.1.0', 
     35    version = '0.1.1', 
    3536    keywords = 'trac plugin ticket subticket', 
    3637    author = 'Takashi Ito', 
    3738    author_email = 'TakashiC.Ito@gmail.com', 
    3839    url = 'http://github.com/itota/trac-subtickets-plugin', 
    3940    description = 'Trac Sub-Tickets Plugin', 
     41    long_description = """ 
     42    This plugin for Trac 0.12 provides Sub-Tickets functionality. 
     43 
     44    The association is done by adding parent tickets number to a custom field. 
     45    Checks ensure i.e. resolving of sub-tickets before closing the parent. 
     46    Babel is required to display localized texts. 
     47    Currently only translation for de_DE is provided. 
     48    """ 
    4049    license = 'BSD', 
    4150 
    42     install_requires = ['Trac'], 
     51    install_requires = ['Trac >= 0.12dev'], 
    4352 
    4453    packages = find_packages(exclude=['*.tests*']), 
    4554    package_data = { 
    4655        'tracsubtickets': [ 
    4756            'htdocs/css/*.css', 
     57            'locale/*.*', 
     58            'locale/*/LC_MESSAGES/*.*', 
    4859        ], 
    4960    }, 
    5061    entry_points = { 
     
    5768        ], 
    5869    }, 
    5970) 
    60  
  • itota-trac-subtickets-plugin-cb202be/tracsubtickets/api.py

    diff -Nur a/itota-trac-subtickets-plugin-cb202be/tracsubtickets/api.py b/itota-trac-subtickets-plugin-cb202be/tracsubtickets/api.py
    a b  
    2929 
    3030import re 
    3131 
     32import pkg_resources 
     33 
    3234from trac.core import * 
    3335from trac.env import IEnvironmentSetupParticipant 
    3436from trac.db import DatabaseManager 
    3537from trac.ticket.model import Ticket 
    3638from trac.ticket.api import ITicketChangeListener, ITicketManipulator 
    3739 
     40from trac.util.translation import domain_functions 
     41 
     42 
    3843import db_default 
    3944 
    4045 
    4146NUMBERS_RE = re.compile(r'\d+', re.U) 
    4247 
     48# i18n support for plugins, available since Trac r7705 
     49# use _, tag_ and N_ as usual, e.g. _("this is a message text") 
     50_, tag_, N_, add_domain = domain_functions('tracsubtickets',  
     51    '_', 'tag_', 'N_', 'add_domain') 
     52 
    4353 
    4454class SubTicketsSystem(Component): 
    4555 
     
    4757               ITicketChangeListener, 
    4858               ITicketManipulator) 
    4959 
     60    def __init__(self): 
     61        self._version = None 
     62        self.ui = None 
     63        # bind the 'traccsubtickets' catalog to the locale directory 
     64        locale_dir = pkg_resources.resource_filename(__name__, 'locale') 
     65        add_domain(self.env.path, locale_dir) 
     66 
    5067    # IEnvironmentSetupParticipant methods 
    5168    def environment_created(self): 
    5269        self.found_db_version = 0 
     
    159176            myid = str(ticket.id) 
    160177            for id in _ids: 
    161178                if id == myid: 
    162                     yield 'parents', 'A ticket cannot be a parent to itself' 
     179                    yield 'parents', _('A ticket cannot be a parent to itself') 
    163180                else: 
    164181                    # check if the id exists 
    165182                    cursor.execute("SELECT id FROM ticket WHERE id=%s", (id, )) 
    166183                    row = cursor.fetchone() 
    167184                    if row is None: 
    168                         yield 'parents', 'Ticket #%s does not exist' % id 
     185                        yield 'parents', _('Ticket #%s does not exist') % id 
    169186                ids.append(id) 
    170187 
    171188            # circularity check function 
     
    176193                for x in [int(x[0]) for x in cursor]: 
    177194                    if x in all_parents: 
    178195                        error = ' > '.join(['#%s' % n for n in all_parents + [x]]) 
    179                         errors.append(('parents', 'Circularity error: %s' % error)) 
     196                        errors.append(('parents', _('Circularity error: %s') % error)) 
    180197                    else: 
    181198                        errors += _check_parents(x, all_parents) 
    182199                return errors 
     
    185202                # check parent ticket state 
    186203                parent = Ticket(self.env, x) 
    187204                if parent and parent['status'] == 'closed': 
    188                     yield 'parents', 'Parent ticket #%s is closed' % x 
     205                    yield 'parents', _('Parent ticket #%s is closed') % x 
    189206                else: 
    190207                    # check circularity 
    191208                    all_parents = ticket.id and [ticket.id] or [] 
     
    196213 
    197214        except Exception, e: 
    198215            self.log.error(e) 
    199             yield 'parents', 'Not a valid list of ticket IDs' 
     216            yield 'parents', _('Not a valid list of ticket IDs') 
    200217 
  • itota-trac-subtickets-plugin-cb202be/tracsubtickets/locale/de_DE/LC_MESSAGES/tracsubtickets.po

    diff -Nur a/itota-trac-subtickets-plugin-cb202be/tracsubtickets/locale/de_DE/LC_MESSAGES/tracsubtickets.po b/itota-trac-subtickets-plugin-cb202be/tracsubtickets/locale/de_DE/LC_MESSAGES/tracsubtickets.po
    a b  
     1# translation of tracsubtickets.po to German 
     2# German (Germany) translations for TracSubTicketsPlugin. 
     3# Copyright (C) 2010 
     4# This file is distributed under the same license as the 
     5# TracSubTicketsPlugin project. 
     6# 
     7# Steffen Hoffmann <hoff.st@web.de>, 2010. 
     8msgid "" 
     9msgstr "" 
     10"Project-Id-Version: TracSubTicketsPlugin 0.1.x\n" 
     11"Report-Msgid-Bugs-To: hoff.st@web.de\n" 
     12"POT-Creation-Date: 2010-05-04 01:38+0200\n" 
     13"PO-Revision-Date: 2010-05-04 01:48+0200\n" 
     14"Last-Translator: Steffen Hoffmann <hoff.st@web.de>\n" 
     15"Language-Team: German de_DE <trac-dev@googlegroups.com>\n" 
     16"Plural-Forms: nplurals=2; plural=(n != 1)\n" 
     17"MIME-Version: 1.0\n" 
     18"Content-Type: text/plain; charset=utf-8\n" 
     19"Content-Transfer-Encoding: 8bit\n" 
     20"Generated-By: Babel 1.0dev-r482\n" 
     21 
     22#: tracsubtickets/api.py:179 
     23msgid "A ticket cannot be a parent to itself" 
     24msgstr "Ein Ticket kann nicht sein eigener Vorläufer sein" 
     25 
     26#: tracsubtickets/api.py:185 
     27#, python-format 
     28msgid "Ticket #%s does not exist" 
     29msgstr "Ticket #%s ist nicht vorhanden" 
     30 
     31#: tracsubtickets/api.py:196 
     32#, python-format 
     33msgid "Circularity error: %s" 
     34msgstr "Zirkelbezug: %s" 
     35 
     36#: tracsubtickets/api.py:205 tracsubtickets/web_ui.py:129 
     37#, python-format 
     38msgid "Parent ticket #%s is closed" 
     39msgstr "Das Vorgänger-Ticket #%s ist geschossen" 
     40 
     41#: tracsubtickets/api.py:216 
     42msgid "Not a valid list of ticket IDs" 
     43msgstr "Keine gültige Liste von Ticket-IDs" 
     44 
     45#: tracsubtickets/web_ui.py:123 
     46#, python-format 
     47msgid "Child ticket #%s has not been closed yet" 
     48msgstr "Folge-Ticket #%s wurde bisher noch nicht geschlossen" 
     49 
     50#: tracsubtickets/web_ui.py:141 
     51msgid "add" 
     52msgstr "hinzufügen" 
     53 
     54#: tracsubtickets/web_ui.py:143 
     55msgid "Create new child ticket" 
     56msgstr "Neues Folge-Ticket erstellen" 
     57 
     58#: tracsubtickets/web_ui.py:147 
     59msgid "Subtickets " 
     60msgstr "Folge-Tickets " 
     61 
  • itota-trac-subtickets-plugin-cb202be/tracsubtickets/locale/messages.pot

    diff -Nur a/itota-trac-subtickets-plugin-cb202be/tracsubtickets/locale/messages.pot b/itota-trac-subtickets-plugin-cb202be/tracsubtickets/locale/messages.pot
    a b  
     1# Translations template for TracSubTicketsPlugin. 
     2# Copyright (C) 2010 ORGANIZATION 
     3# This file is distributed under the same license as the 
     4# TracSubTicketsPlugin project. 
     5# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. 
     6# 
     7#, fuzzy 
     8msgid "" 
     9msgstr "" 
     10"Project-Id-Version: TracSubTicketsPlugin 0.1.x\n" 
     11"Report-Msgid-Bugs-To: hoff.st@web.de\n" 
     12"POT-Creation-Date: 2010-05-04 01:38+0200\n" 
     13"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
     14"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     15"Language-Team: LANGUAGE <trac-dev@googlegroups.com>\n" 
     16"MIME-Version: 1.0\n" 
     17"Content-Type: text/plain; charset=utf-8\n" 
     18"Content-Transfer-Encoding: 8bit\n" 
     19"Generated-By: Babel 1.0dev-r482\n" 
     20 
     21#: tracsubtickets/api.py:179 
     22msgid "A ticket cannot be a parent to itself" 
     23msgstr "" 
     24 
     25#: tracsubtickets/api.py:185 
     26#, python-format 
     27msgid "Ticket #%s does not exist" 
     28msgstr "" 
     29 
     30#: tracsubtickets/api.py:196 
     31#, python-format 
     32msgid "Circularity error: %s" 
     33msgstr "" 
     34 
     35#: tracsubtickets/api.py:205 tracsubtickets/web_ui.py:129 
     36#, python-format 
     37msgid "Parent ticket #%s is closed" 
     38msgstr "" 
     39 
     40#: tracsubtickets/api.py:216 
     41msgid "Not a valid list of ticket IDs" 
     42msgstr "" 
     43 
     44#: tracsubtickets/web_ui.py:123 
     45#, python-format 
     46msgid "Child ticket #%s has not been closed yet" 
     47msgstr "" 
     48 
     49#: tracsubtickets/web_ui.py:141 
     50msgid "add" 
     51msgstr "" 
     52 
     53#: tracsubtickets/web_ui.py:143 
     54msgid "Create new child ticket" 
     55msgstr "" 
     56 
     57#: tracsubtickets/web_ui.py:147 
     58msgid "Subtickets " 
     59msgstr "" 
     60 
  • itota-trac-subtickets-plugin-cb202be/tracsubtickets/web_ui.py

    diff -Nur a/itota-trac-subtickets-plugin-cb202be/tracsubtickets/web_ui.py b/itota-trac-subtickets-plugin-cb202be/tracsubtickets/web_ui.py
    a b  
    3535from genshi.builder import tag 
    3636from genshi.filters import Transformer 
    3737 
    38 from api import NUMBERS_RE 
     38from api import NUMBERS_RE, _ 
    3939 
    4040 
    4141class SubTicketsModule(Component): 
     
    120120 
    121121            for parent, child in cursor: 
    122122                if Ticket(self.env, child)['status'] != 'closed': 
    123                     yield None, 'Child ticket #%s has not been closed yet' % child 
     123                    yield None, _('Child ticket #%s has not been closed yet') % child 
    124124 
    125125        elif action == 'reopen': 
    126126            ids = set(NUMBERS_RE.findall(ticket['parents'] or '')) 
    127127            for id in ids: 
    128128                if Ticket(self.env, id)['status'] == 'closed': 
    129                     yield None, 'Parent ticket #%s is closed' % id 
     129                    yield None, _('Parent ticket #%s is closed') % id 
    130130 
    131131    # ITemplateStreamFilter method 
    132132    def filter_stream(self, req, method, filename, stream, data): 
     
    138138                # title 
    139139                div = tag.div(class_='description') 
    140140                if ticket['status'] != 'closed': 
    141                     link = tag.a('add', href=req.href.newticket(parents=ticket.id)) 
     141                    link = tag.a(_('add'), 
     142                        href=req.href.newticket(parents=ticket.id), 
     143                        title=_('Create new child ticket')) 
    142144                    link = tag.span('(', link, ')', class_='addsubticket') 
    143145                else: 
    144146                    link = None 
    145                 div.append(tag.h3('Subtickets ', link)) 
     147                div.append(tag.h3(_('Subtickets '), link)) 
    146148 
    147149            if 'subtickets' in data: 
    148150                # table