mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-02-01 02:05:03 -05:00
Make unedited link taglines still translatable
In the process, move taglinetext logic to a python file
This commit is contained in:
@@ -528,6 +528,38 @@ class Link(Thing, Printable):
|
||||
item.expunged = Link._should_expunge_selftext(item)
|
||||
|
||||
item.editted = getattr(item, "editted", False)
|
||||
|
||||
taglinetext = ''
|
||||
if item.different_sr:
|
||||
author_text = (" <span>" + _("by %(author)s to %(reddit)s") +
|
||||
"</span>")
|
||||
else:
|
||||
author_text = " <span>" + _("by %(author)s") + "</span>"
|
||||
if item.editted:
|
||||
if item.score_fmt == Score.points:
|
||||
taglinetext = ("<span>" +
|
||||
_("%(score)s submitted %(when)s "
|
||||
"ago%(lastedited)s") +
|
||||
"</span>")
|
||||
taglinetext += author_text
|
||||
elif item.different_sr:
|
||||
taglinetext = _("submitted %(when)s ago%(lastedited)s "
|
||||
"by %(author)s to %(reddit)s")
|
||||
else:
|
||||
taglinetext = _("submitted %(when)s ago%(lastedited)s "
|
||||
"by %(author)s")
|
||||
else:
|
||||
if item.score_fmt == Score.points:
|
||||
taglinetext = ("<span>" +
|
||||
_("%(score)s submitted %(when)s ago") +
|
||||
"</span>")
|
||||
taglinetext += author_text
|
||||
elif item.different_sr:
|
||||
taglinetext = _("submitted %(when)s ago by %(author)s "
|
||||
"to %(reddit)s")
|
||||
else:
|
||||
taglinetext = _("submitted %(when)s ago by %(author)s")
|
||||
item.taglinetext = taglinetext
|
||||
|
||||
if user_is_loggedin:
|
||||
incr_counts(wrapped)
|
||||
|
||||
@@ -222,24 +222,13 @@ ${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${w
|
||||
|
||||
<%def name="tagline()">
|
||||
<%
|
||||
if thing.score_fmt == Score.points:
|
||||
taglinetext = "<span>" + _("%(score)s submitted %(when)s ago%(lastedited)s") + "</span>"
|
||||
if thing.different_sr:
|
||||
taglinetext += " <span>" + _("by %(author)s to %(reddit)s") + "</span>"
|
||||
else:
|
||||
taglinetext += " <span>" + _("by %(author)s") + "</span>"
|
||||
elif thing.different_sr:
|
||||
taglinetext = _("submitted %(when)s ago%(lastedited)s by %(author)s to %(reddit)s")
|
||||
else:
|
||||
taglinetext = _("submitted %(when)s ago%(lastedited)s by %(author)s")
|
||||
taglinetext = taglinetext.replace(" ", " ")
|
||||
taglinetext = thing.taglinetext.replace(" ", " ")
|
||||
%>
|
||||
|
||||
${unsafe(taglinetext % dict(reddit = self.subreddit(),
|
||||
score = capture(self.score, thing, thing.likes, tag='span'),
|
||||
when = capture(thing_timestamp, thing, thing.timesince),
|
||||
author = WrappedUser(thing.author, thing.attribs, thing).render(),
|
||||
lastedited = capture(edited, thing, thing.lastedited)
|
||||
${unsafe(taglinetext % dict(reddit=self.subreddit(),
|
||||
score=capture(self.score, thing, thing.likes, tag='span'),
|
||||
when=capture(thing_timestamp, thing, thing.timesince),
|
||||
author=WrappedUser(thing.author, thing.attribs, thing).render(),
|
||||
lastedited=capture(edited, thing, thing.lastedited)
|
||||
))}
|
||||
</%def>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user