Ticket #2301 (new enhancement)

Opened 2 years ago

Last modified 23 months ago

Replace old-style string formatting with format() method (at least in strings marked for translation)

Reported by: seanh Owned by: seanh
Priority: minor Milestone: ckan-future
Component: ckan Keywords: i18n
Cc: Repository: ckan
Theme: none

Description (last modified by seanh) (diff)

Some strings in CKAN are passed to gettext with more than one %s in them, this is no good as translators may need to change the order of substituted words.

Strings should not use the old style % substitution, they should use the new format method in Python 2.6+, e.g.:

'This {food} is {adjective}.'.format(food='spam', adjective='absolutely horrible')

http://docs.python.org/release/2.6.8/tutorial/inputoutput.html#fancier-output-formatting

We should probably only change strings that are marked for translation and that contain multiple %s, don't want to make too much work or cause too many strings to change and need to be re-translated.

Change History

comment:1 Changed 2 years ago by seanh

  • Description modified (diff)
  • Summary changed from Fix substitutions in strings marked for translation to Replace old-style string formatting with format() method (at least in strings marked for translation)

comment:2 Changed 2 years ago by seanh

  • Description modified (diff)

comment:3 Changed 2 years ago by seanh

  • Milestone changed from ckan-sprint-2012-04-30 to current-ckan-sprint-2012-05-15

comment:4 Changed 2 years ago by seanh

  • Priority changed from awaiting triage to minor

comment:5 Changed 2 years ago by seanh

  • Milestone changed from current-ckan-sprint-2012-05-15 to ckan-v1.8

comment:6 Changed 23 months ago by seanh

  • Keywords i18n added

comment:7 Changed 23 months ago by seanh

  • Milestone changed from ckan-v1.8 to ckan-future
Note: See TracTickets for help on using tickets.