#9354 closed enhancement (fixed)
[patch] missing i18n for TicketClone demo plugin
Reported by: | Owned by: | ||
---|---|---|---|
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)
Change History (19)
comment:1 by , 15 years ago
comment:2 by , 15 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 , 15 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.
comment:4 by , 15 years ago
1st implementation, for the sake of clarity it consists of three patch files (taken directly from my Mercurial Queue)
comment:5 by , 15 years ago
Summary: | missing i18n for TicketClone demo plugin → [patch] missing i18n for TicketClone demo plugin |
---|
comment:6 by , 15 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:8 by , 15 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 , 15 years ago
Attachment: | msg-markup.2 added |
---|
2nd version: mark text for translation with named substitutions
comment:9 by , 15 years ago
Please see 2nd version of markup patch, that has the suggested named arguments in; further comments?
comment:10 by , 14 years ago
Milestone: | → 0.13 |
---|
comment:11 by , 14 years ago
ticket['summary'] + _(" (cloned)")
should be replaced by something like:
_("%(summary)s (cloned)", summary=ticket['summary'])
comment:12 by , 14 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 , 14 years ago
Owner: | set to |
---|
comment:14 by , 14 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Patch applied in [10686] with a few cosmetic corrections and the missing registration of the plugin in setup.py
.
comment:15 by , 14 years ago
Owner: | changed from | to
---|
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