We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pootle/core/templatetags/core.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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)

{"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"}], "after_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.filter\ndef 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')\ndef formtable(formtable):\n    return dict(formtable=formtable)\n", "path": "pootle/core/templatetags/core.py"}]}