Opened 9 years ago

Closed 9 years ago

#4713 closed (fixed)

Simple tags don't have a translation hook - as opposed to the documentation

Reported by: Indy Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: Template, Translation, I18N
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

The documentation states that template tags offers a translation hook and accept _('...') instead of a constant string. This doesn't work for simple tags because resolve_variable isn't aware of translations.
If you trying to do so, you receive the following error:

VariableDoesNotExist at ...
Failed lookup for key [_('...

The attached patch is very simple and resolves this problem.

Attachments (3)

__init__.diff (865 bytes) - added by Indy 9 years ago.
Simple patch
__init__.2.diff (1.2 KB) - added by Indy 9 years ago.
Updated patch
4713.patch (1.8 KB) - added by Chris Beaven 9 years ago.
Better take on it

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by Indy

Attachment: __init__.diff added

Simple patch

comment:1 Changed 9 years ago by Malcolm Tredinnick

Component: Template systemInternationalization
Needs documentation: unset
Needs tests: unset
Owner: changed from Adrian Holovaty to Malcolm Tredinnick
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 9 years ago by Indy

Updated the patch for the new variable resolve system.

Changed 9 years ago by Indy

Attachment: __init__.2.diff added

Updated patch

Changed 9 years ago by Chris Beaven

Attachment: 4713.patch added

Better take on it

comment:3 Changed 9 years ago by Chris Beaven

Needs tests: set

comment:4 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [6679]) Fixed #4713 -- Fixed handling of _() in template tag arguments. Based on
patched from Indy and SmileyChris.

Note: See TracTickets for help on using tickets.
Back to Top