Edgewall Software
Modify

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#9354 closed enhancement (fixed)

[patch] missing i18n for TicketClone demo plugin

Reported by: hasienda <hoff.st@…> Owned by: hasienda <hoff.st@…>
Priority: normal Milestone: 1.0
Component: i18n Version: 0.12dev
Severity: normal Keywords: i18n plugin
Cc: Branch:
Release Notes:

ticket: Added the ticket clone sample plugin as an optional component.

API Changes:
Internal Changes:

Description

looking at the current version in Trac trunk is disappointing in that case:
not trace of i18n work at TicketClone plugin code, but it shouldn't go like this for 0.12, the i18n release

Attachments (4)

cleanup (475 bytes ) - added by hasienda <hoff.st@…> 14 years ago.
1st version: move plugin script to /trunk/tracopt
setup (443 bytes ) - added by hasienda <hoff.st@…> 14 years ago.
1st version: add i18n function
msg-markup (1.3 KB ) - added by hasienda <hoff.st@…> 14 years ago.
1st version: mark text for translation
msg-markup.2 (1.4 KB ) - added by hasienda <hoff.st@…> 14 years ago.
2nd version: mark text for translation with named substitutions

Download all attachments as: .zip

Change History (19)

comment:1 by hasienda <hoff.st@…>, 14 years ago

since we have a botton text in here, i18n is needed, however we'll loose a nice one-file plugin, since message catalog stuff needs to be done in separate files, hence this will ultimately require for packaging etc.

this is a nice little task for a rainy day, I need it for a localized production system, so most likely this will be done within few hours, cheer up

comment:2 by Christian Boos, 14 years ago

Right, single file plugins can't be localized, I'm afraid.

The TicketClone plugin could however graduate to tracopt (see #4686 for background), then its messages could be translated in the default catalog.

comment:3 by hasienda <hoff.st@…>, 14 years ago

Thanks for the hint, was actually just studying plugins history (emerging from a part of template/ticket.html).

Would you prefer moving to tracopt then? This is crucial, since otherwise I'd arrange for separate translation. Actually already working on a setup.py for packaging, but now it's still time to change it.

by hasienda <hoff.st@…>, 14 years ago

Attachment: cleanup added

1st version: move plugin script to /trunk/tracopt

by hasienda <hoff.st@…>, 14 years ago

Attachment: setup added

1st version: add i18n function

by hasienda <hoff.st@…>, 14 years ago

Attachment: msg-markup added

1st version: mark text for translation

comment:4 by hasienda <hoff.st@…>, 14 years ago

1st implementation, for the sake of clarity it consists of three patch files (taken directly from my Mercurial Queue)

comment:5 by hasienda <hoff.st@…>, 14 years ago

Summary: missing i18n for TicketClone demo plugin[patch] missing i18n for TicketClone demo plugin

comment:6 by Remy Blank, 14 years ago

You should not use the % operator to expand strings after a _() call, but named arguments inside the call:

_("Cloned from #%(id)s:\n----\n%(description)s",
  id=ticket.id, description=ticket['description'])

comment:7 by hasienda <hoff.st@…>, 14 years ago

still learning Python, will adjust this, thanks

comment:8 by hasienda <hoff.st@…>, 14 years ago

there are other scripts at the perimeter of Trac's core code, that would profit from localizable messages: trunk/

  • sample-plugins/
    • HelloWorld.py (maybe a 'wont-fix', or even add a HelloWorldIntl.py with i18n support for demonstration?)
    • ticket_clone.py (starter of this ticket)
    • workflow/
      • CodeReview.py
      • DeleteTicket.py
      • StatusFixer.py
      • VoteOperation.py

any comment on how to handle these?

by hasienda <hoff.st@…>, 14 years ago

Attachment: msg-markup.2 added

2nd version: mark text for translation with named substitutions

comment:9 by hasienda <hoff.st@…>, 14 years ago

Please see 2nd version of markup patch, that has the suggested named arguments in; further comments?

comment:10 by Christian Boos, 14 years ago

Milestone: 0.13

comment:11 by Christian Boos, 14 years ago

ticket['summary'] + _(" (cloned)")

should be replaced by something like:

_("%(summary)s (cloned)", summary=ticket['summary'])

comment:12 by Christian Boos, 13 years ago

So this seems to be a bit in contradiction with #9910 (turning that single file plugin into an sample packaged plugin).

I'd prefer making it an optional feature for the ticket module, which is much simpler, both for i18n as requested here and for later activation (via the Plugins admin panel).

comment:13 by Christian Boos, 13 years ago

Owner: set to Christian Boos

comment:14 by Remy Blank, 13 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Patch applied in [10686] with a few cosmetic corrections and the missing registration of the plugin in setup.py.

comment:15 by Remy Blank, 13 years ago

Owner: changed from Christian Boos to hasienda <hoff.st@…>

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain hasienda <hoff.st@…>.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from hasienda <hoff.st@…> to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.