prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add current character count when entering translations
  We're trying to use Pootle to translate metadata strings for an app in the iOS AppStore. The metadata includes individual messages for the app name, subtitle, description, privacy URL and so on and there are different limits on the number of characters allowed in each of them. For instance, an app's name can be no more than 30 characters. 
  
  When entering translations, it would be really helpful to see the current number of characters that the translation uses as you type to ensure that you're not exceeding the limit. This could maybe fit on the lower right corner of the input view. You currently have timeline / comment / raw on the left. Current character count could just be a small label that floats to the right on the same line.
  
  # Environment (i.e. 'pootle --version', DB, OS, Browser):
  
  Pootle 2.8.0
  
  </issue>
  <code>
  [start of pootle/core/templatetags/core.py]
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 #
  4 # Copyright (C) Pootle contributors.
  5 #
  6 # This file is a part of the Pootle project. It is distributed under the GPL3
  7 # or later license. See the LICENSE file for a copy of the license and the
  8 # AUTHORS file for copyright and authorship information.
  9 
  10 from django import template
  11 from django.utils.html import escapejs
  12 from django.utils.safestring import mark_safe
  13 
  14 from ..utils.json import jsonify
  15 
  16 
  17 register = template.Library()
  18 
  19 
  20 @register.filter
  21 def to_js(value):
  22     """Returns a string which leaves the value readily available for JS
  23     consumption.
  24     """
  25     return mark_safe('JSON.parse("%s")' % escapejs(jsonify(value)))
  26 
  27 
  28 @register.inclusion_tag('includes/formtable.html')
  29 def formtable(formtable):
  30     return dict(formtable=formtable)
  31
  [end of pootle/core/templatetags/core.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/pootle/core/templatetags/core.py b/pootle/core/templatetags/core.py
  --- a/pootle/core/templatetags/core.py
  +++ b/pootle/core/templatetags/core.py
  @@ -25,6 +25,13 @@
       return mark_safe('JSON.parse("%s")' % escapejs(jsonify(value)))
   
   
  +@register.filter
  +def map_to_lengths(value):
  +    """Maps a list value by replacing each element with its length.
  +    """
  +    return [len(e) for e in value]
  +
  +
   @register.inclusion_tag('includes/formtable.html')
   def formtable(formtable):
       return dict(formtable=formtable)
  
verification_info: {"golden_diff": "diff --git a/pootle/core/templatetags/core.py b/pootle/core/templatetags/core.py\n--- a/pootle/core/templatetags/core.py\n+++ b/pootle/core/templatetags/core.py\n@@ -25,6 +25,13 @@\n     return mark_safe('JSON.parse(\"%s\")' % escapejs(jsonify(value)))\n \n \n+@register.filter\n+def map_to_lengths(value):\n+    \"\"\"Maps a list value by replacing each element with its length.\n+    \"\"\"\n+    return [len(e) for e in value]\n+\n+\n @register.inclusion_tag('includes/formtable.html')\n def formtable(formtable):\n     return dict(formtable=formtable)\n", "issue": "Add current character count when entering translations\nWe're trying to use Pootle to translate metadata strings for an app in the iOS AppStore. The metadata includes individual messages for the app name, subtitle, description, privacy URL and so on and there are different limits on the number of characters allowed in each of them. For instance, an app's name can be no more than 30 characters. \r\n\r\nWhen entering translations, it would be really helpful to see the current number of characters that the translation uses as you type to ensure that you're not exceeding the limit. This could maybe fit on the lower right corner of the input view. You currently have timeline / comment / raw on the left. Current character count could just be a small label that floats to the right on the same line.\r\n\r\n# Environment (i.e. 'pootle --version', DB, OS, Browser):\r\n\r\nPootle 2.8.0\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom django import template\nfrom django.utils.html import escapejs\nfrom django.utils.safestring import mark_safe\n\nfrom ..utils.json import jsonify\n\n\nregister = template.Library()\n\n\n@register.filter\ndef to_js(value):\n    \"\"\"Returns a string which leaves the value readily available for JS\n    consumption.\n    \"\"\"\n    return mark_safe('JSON.parse(\"%s\")' % escapejs(jsonify(value)))\n\n\n@register.inclusion_tag('includes/formtable.html')\ndef formtable(formtable):\n    return dict(formtable=formtable)\n", "path": "pootle/core/templatetags/core.py"}]}