Hardcoded special status values "new" and "closed" cannot be localized in Workflow
|Reported by:||Owned by:|
|Severity:||normal||Keywords:||workflow action i18n status|
Custom workflows are problematic for localization. It's possible to be creative with section [ticket-workflow] in trac.ini. For example, (in Finnish)
[ticket-workflow] accept = new,uusi,aloitettu,suljettu -> aloitettu accept.name = Ota lippu vastaan ja ota toteuttaminen vastuullesi accept.operations = set_owner_to_self accept.permissions = TICKET_MODIFY confirm = new -> uusi confirm.default = 2 confirm.name = Vahvista lippu (merkitään uudeksi) confirm.permissions = TICKET_MODIFY leave = * -> * leave.default = 1 leave.name = Ei muutosta leave.operations = leave_status reassign = uusi,aloitettu -> aloitettu reassign.name = Vaihda tekijä reassign.operations = set_owner reassign.permissions = TICKET_MODIFY reopen = suljettu -> uusi reopen.name = Avaa uudelleen (ei olekaan vielä valmis) reopen.operations = del_resolution reopen.permissions = TICKET_CREATE resolve = new,uusi,aloitettu -> suljettu resolve.name = Merkitse suljetuksi resolve.operations = set_resolution resolve.permissions = TICKET_MODIFY close = suljettu -> closed close.name = Vahvista suljetuksi close.permissions = TICKET_MODIFY
In the above configuration "uusi" means "new", "aloitettu" means "work started", "suljettu" means "closed" in Finnish. The .name labels have been set to make sense in Actions form. Logically "uusi" is interpreted as "accepted new", "suljettu" is interpreted as "closed" (but not to trac) and "closed" is interpreted as "verified closed" (and closed to trac). This is far from optimal, but the best I've come up with when using Trac 0.12.1.
However, this does not allow changing displayed labels for status "new" or "closed". These values are leaked to end user through various locations. If I've understood correctly, these are hardcoded in the source and as such, cannot be specified in the configuration.
As I see it, there're two possible solutions:
- Add special code to correctly localize "new" and "closed" status in every place a status is displayed, or
- Add two configuration parameters to define custom status values to replace "new" and "closed" status values.
I personally would prefer 1 if #9472 is ever fixed to allow translating the workflow in whole (so that a single environment can display possible actions in any language the current user happens to use as opposed to using the single language coded in the trac.ini as in the example above).
However, if the official method for translating the workflow (in the future) is to use custom status values with custom .name strings (as in the example above), then I prefer option 2 above because in that case all localization string related to custom workflow would be in a single file.
If solution 2 above is used, I'd suggest two additional parameters to [ticket] section (notice that these cannot be added to [ticket-workflow] because any name in that section can be taken by custom workflow action):
default_status (defaults to currently hardcoded "new"):
Value of this parameter is used as status for all newly created tickets.
override_status_closed (defaults to currently hardcoded "closed"):
If the status of any ticket is set to this value, that ticket should be considered
as closed for any code where the distinction between open and closed tickets do matter.
I'm marking this as component "ticket system" in case option 2 above is implemented (which I believe is easier to implement). In case option 1 above is considered better, the correct component should be i18n. See also: #9472.