CookBook/PluginL10N: trac-subtickets-plugin_i18n-l10n.patch
File trac-subtickets-plugin_i18n-l10n.patch, 11.8 KB (added by , 14 years ago) |
---|
-
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 1 1 [egg_info] 2 2 tag_build = .dev 3 3 tag_date = True 4 5 [extract_messages] 6 add_comments = TRANSLATOR: 7 msgid_bugs_address = hoff.st@web.de 8 output_file = tracsubtickets/locale/messages.pot 9 keywords = _ ngettext:1,2 N_ tag_ 10 width = 72 11 12 [init_catalog] 13 input_file = tracsubtickets/locale/messages.pot 14 output_dir = tracsubtickets/locale 15 domain = tracsubtickets 16 17 [compile_catalog] 18 directory = tracsubtickets/locale 19 domain = tracsubtickets 20 21 [update_catalog] 22 input_file = tracsubtickets/locale/messages.pot 23 output_dir = tracsubtickets/locale 24 domain = 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 1 1 #!/usr/bin/python 2 2 # 3 3 # Copyright (c) 2010, Takashi Ito 4 # i18n and German translation by Steffen Hoffmann 4 5 # All rights reserved. 5 6 # 6 7 # Redistribution and use in source and binary forms, with or without … … 31 32 32 33 setup( 33 34 name = 'TracSubTicketsPlugin', 34 version = '0.1. 0',35 version = '0.1.1', 35 36 keywords = 'trac plugin ticket subticket', 36 37 author = 'Takashi Ito', 37 38 author_email = 'TakashiC.Ito@gmail.com', 38 39 url = 'http://github.com/itota/trac-subtickets-plugin', 39 40 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 """ 40 49 license = 'BSD', 41 50 42 install_requires = ['Trac '],51 install_requires = ['Trac >= 0.12dev'], 43 52 44 53 packages = find_packages(exclude=['*.tests*']), 45 54 package_data = { 46 55 'tracsubtickets': [ 47 56 'htdocs/css/*.css', 57 'locale/*.*', 58 'locale/*/LC_MESSAGES/*.*', 48 59 ], 49 60 }, 50 61 entry_points = { … … 57 68 ], 58 69 }, 59 70 ) 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 29 29 30 30 import re 31 31 32 import pkg_resources 33 32 34 from trac.core import * 33 35 from trac.env import IEnvironmentSetupParticipant 34 36 from trac.db import DatabaseManager 35 37 from trac.ticket.model import Ticket 36 38 from trac.ticket.api import ITicketChangeListener, ITicketManipulator 37 39 40 from trac.util.translation import domain_functions 41 42 38 43 import db_default 39 44 40 45 41 46 NUMBERS_RE = re.compile(r'\d+', re.U) 42 47 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 43 53 44 54 class SubTicketsSystem(Component): 45 55 … … 47 57 ITicketChangeListener, 48 58 ITicketManipulator) 49 59 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 50 67 # IEnvironmentSetupParticipant methods 51 68 def environment_created(self): 52 69 self.found_db_version = 0 … … 159 176 myid = str(ticket.id) 160 177 for id in _ids: 161 178 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') 163 180 else: 164 181 # check if the id exists 165 182 cursor.execute("SELECT id FROM ticket WHERE id=%s", (id, )) 166 183 row = cursor.fetchone() 167 184 if row is None: 168 yield 'parents', 'Ticket #%s does not exist'% id185 yield 'parents', _('Ticket #%s does not exist') % id 169 186 ids.append(id) 170 187 171 188 # circularity check function … … 176 193 for x in [int(x[0]) for x in cursor]: 177 194 if x in all_parents: 178 195 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)) 180 197 else: 181 198 errors += _check_parents(x, all_parents) 182 199 return errors … … 185 202 # check parent ticket state 186 203 parent = Ticket(self.env, x) 187 204 if parent and parent['status'] == 'closed': 188 yield 'parents', 'Parent ticket #%s is closed'% x205 yield 'parents', _('Parent ticket #%s is closed') % x 189 206 else: 190 207 # check circularity 191 208 all_parents = ticket.id and [ticket.id] or [] … … 196 213 197 214 except Exception, e: 198 215 self.log.error(e) 199 yield 'parents', 'Not a valid list of ticket IDs'216 yield 'parents', _('Not a valid list of ticket IDs') 200 217 -
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. 8 msgid "" 9 msgstr "" 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 23 msgid "A ticket cannot be a parent to itself" 24 msgstr "Ein Ticket kann nicht sein eigener Vorläufer sein" 25 26 #: tracsubtickets/api.py:185 27 #, python-format 28 msgid "Ticket #%s does not exist" 29 msgstr "Ticket #%s ist nicht vorhanden" 30 31 #: tracsubtickets/api.py:196 32 #, python-format 33 msgid "Circularity error: %s" 34 msgstr "Zirkelbezug: %s" 35 36 #: tracsubtickets/api.py:205 tracsubtickets/web_ui.py:129 37 #, python-format 38 msgid "Parent ticket #%s is closed" 39 msgstr "Das Vorgänger-Ticket #%s ist geschossen" 40 41 #: tracsubtickets/api.py:216 42 msgid "Not a valid list of ticket IDs" 43 msgstr "Keine gültige Liste von Ticket-IDs" 44 45 #: tracsubtickets/web_ui.py:123 46 #, python-format 47 msgid "Child ticket #%s has not been closed yet" 48 msgstr "Folge-Ticket #%s wurde bisher noch nicht geschlossen" 49 50 #: tracsubtickets/web_ui.py:141 51 msgid "add" 52 msgstr "hinzufügen" 53 54 #: tracsubtickets/web_ui.py:143 55 msgid "Create new child ticket" 56 msgstr "Neues Folge-Ticket erstellen" 57 58 #: tracsubtickets/web_ui.py:147 59 msgid "Subtickets " 60 msgstr "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 8 msgid "" 9 msgstr "" 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 22 msgid "A ticket cannot be a parent to itself" 23 msgstr "" 24 25 #: tracsubtickets/api.py:185 26 #, python-format 27 msgid "Ticket #%s does not exist" 28 msgstr "" 29 30 #: tracsubtickets/api.py:196 31 #, python-format 32 msgid "Circularity error: %s" 33 msgstr "" 34 35 #: tracsubtickets/api.py:205 tracsubtickets/web_ui.py:129 36 #, python-format 37 msgid "Parent ticket #%s is closed" 38 msgstr "" 39 40 #: tracsubtickets/api.py:216 41 msgid "Not a valid list of ticket IDs" 42 msgstr "" 43 44 #: tracsubtickets/web_ui.py:123 45 #, python-format 46 msgid "Child ticket #%s has not been closed yet" 47 msgstr "" 48 49 #: tracsubtickets/web_ui.py:141 50 msgid "add" 51 msgstr "" 52 53 #: tracsubtickets/web_ui.py:143 54 msgid "Create new child ticket" 55 msgstr "" 56 57 #: tracsubtickets/web_ui.py:147 58 msgid "Subtickets " 59 msgstr "" 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 35 35 from genshi.builder import tag 36 36 from genshi.filters import Transformer 37 37 38 from api import NUMBERS_RE 38 from api import NUMBERS_RE, _ 39 39 40 40 41 41 class SubTicketsModule(Component): … … 120 120 121 121 for parent, child in cursor: 122 122 if Ticket(self.env, child)['status'] != 'closed': 123 yield None, 'Child ticket #%s has not been closed yet'% child123 yield None, _('Child ticket #%s has not been closed yet') % child 124 124 125 125 elif action == 'reopen': 126 126 ids = set(NUMBERS_RE.findall(ticket['parents'] or '')) 127 127 for id in ids: 128 128 if Ticket(self.env, id)['status'] == 'closed': 129 yield None, 'Parent ticket #%s is closed'% id129 yield None, _('Parent ticket #%s is closed') % id 130 130 131 131 # ITemplateStreamFilter method 132 132 def filter_stream(self, req, method, filename, stream, data): … … 138 138 # title 139 139 div = tag.div(class_='description') 140 140 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')) 142 144 link = tag.span('(', link, ')', class_='addsubticket') 143 145 else: 144 146 link = None 145 div.append(tag.h3( 'Subtickets ', link))147 div.append(tag.h3(_('Subtickets '), link)) 146 148 147 149 if 'subtickets' in data: 148 150 # table