id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 19552,makemessages ignores translations in templates with inline comment tags,juneih@…,nobody,"I'm using the management command makemessages to create the po-file for translations in my Django project. I'm having trouble with translations in templates being ignored when they contain in-line comments. Example: {{{ {# Nice comment #} {%trans ""Translate me"" %} }}} The string 'Translate me' is not added to the po-file. I've traced the reason for this to the templatize method in trans_real.py. At the bottom of the method you'll find the following lines: When running the makemessages management command {{{ elif t.token_type == TOKEN_COMMENT: out.write(' # %s' % t.contents) }}} It appears that the comment is not blanked out, but kept and passed on to xgettext. The input for xgettext with the previous example will be: {{{ # nice comment gettext('Translate me') }}} Which means xgettext interprets the entire line as a comment. I'm not really sure why gettext would need the comment in the first place, but the fix for me has been to just add a new line after the string, like so: {{{ elif t.token_type == TOKEN_COMMENT: out.write(' # %s\n' % t.contents) }}} Now the input for xgettext is: {{{ # nice comment gettext('Translate me') }}} ",Bug,closed,Internationalization,1.4,Normal,fixed,"makemessages, template, gettext, xgettext",madkinder@…,Accepted,1,0,0,0,1,0