@register.simple_tag
def get_location_links(unit):
 ret = []
 if (len(unit.location) == 0):
  return u''
 if unit.location.isdigit():
  return (_(u'unit ID %s') % unit.location)
 for location in unit.location.split(u','):
  location = location.strip()
  if (location == u''):
   continue
  location_parts = location.split(u':')
  if (len(location_parts) == 2):
   (filename, line) = location_parts
  else:
   filename = location_parts[0]
   line = 0
  link = unit.translation.subproject.get_repoweb_link(filename, line)
  if (link is None):
   ret.append(escape(location))
  else:
   ret.append(u'<a href="{0}">{1}</a>'.format(escape(link), escape(location)))
 return mark_safe(u'\n'.join(ret))

@ register . simple_tag def get_location_links ( unit ) : ret = [ ] if ( len ( unit . location ) == 0 ) : return u'' if unit . location . isdigit ( ) : return ( _ ( u'unit ID %s' ) % unit . location ) for location in unit . location . split ( u',' ) : location = location . strip ( ) if ( location == u'' ) : continue location_parts = location . split ( u':' ) if ( len ( location_parts ) == 2 ) : ( filename , line ) = location_parts else : filename = location_parts [ 0 ] line = 0 link = unit . translation . subproject . get_repoweb_link ( filename , line ) if ( link is None ) : ret . append ( escape ( location ) ) else : ret . append ( u'<a href="{0}">{1}</a>' . format ( escape ( link ) , escape ( location ) ) ) return mark_safe ( u'\n' . join ( ret ) )
generates links to source files where translation was used .