Peter
I haven't given up but I haven't had time to focus on it yet. Thanks for
your suggestions.
My original plan was to write a new class which returned field labels so
all translations could be done in one place. But now I'm thinking it
might be simpler to just get the <field>.label value from the trac.ini
mixin wherever it is needed.
Cheers
Mike
On 7/08/2014 5:00 AM, Peter Suter wrote:
On 06.08.2014 07:56, Mike Dewhirst wrote:
I have not found access to trac.ini values without deliberately finding
the file and reading it. I'm sure there must be an object in ticket.api
with the necessary data or which could be persuaded to get it. If you
can help I would appreciate it. And that would let me clean it all up
and offer a patch.
Any Trac Component has the entire trac.ini Configuration available in
self.config.
Specific options are often declared and hence available as `Option`
attributes on some Component e.g. `TicketSystem.default_version`
corresponds to trac.ini [ticket] default_version=...
Similarly, `TicketSystem.ticket_custom_section` corresponds to the
entire trac.ini [ticket-custom] section.
So to allow relabelling any standard ticket field via trac.ini:
[ticket-custom]
cc.label=Stakeholders
owner.label=Developer
I had something like this patch in mind:
{{{
diff -r 47a8451d3eab trac/ticket/api.py
--- a/trac/ticket/api.py Wed Aug 06 10:46:49 2014 +0000
+++ b/trac/ticket/api.py Wed Aug 06 20:49:52 2014 +0200
@@ -373,6 +373,11 @@
fields.append({'name': 'changetime', 'type': 'time',
'format': 'relative', 'label': N_('Modified')})
+ for field in fields:
+ key = field['name'] + '.label'
+ if key in self.ticket_custom_section:
+ field['label'] = self.ticket_custom_section.get(key)
+
for field in self.custom_fields:
if field['name'] in [f['name'] for f in fields]:
self.log.warning('Duplicate field name "%s" (ignoring)',
}}}
Other issues/work of concern include:
1. Translations of new labels
2. Documentation
3. Work required in site.html (I could offer a new site.html.sample
with the necessary items in there but commented out. Might be
independently useful anyway.)
Yes, unfortunately I now realize that this simple patch only does part
of the job, and a general solution might have too many complications for
translations etc.
[5]
http://trac.edgewall.org/browser/trunk/trac/ticket/api.py?version=12992&marks=291-310,316-391#L291
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.