prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Translations in Javascript and Typescript
  When writing Javascript and Typescript in separate, non-HTML files, we can't use the Django template functions `trans`, `blocktrans`, etc. anymore. We have worked around this by putting translated strings into the DOM and accessing them via Javascript then.
  
  Instead of doing this, we want to have a unified approach where the use-site can just write `trans("The server is not responding.")` or so. There are two possible approaches:
  
  1. DIY: We have a function `trans(english: string, to: Language = window.LANGUAGE): string` with `type Language = "English" | "German"`. This function looks up the string in a global dictionary (for example `window.translationDictionary` or so). I am not sure what it should do if the string is not present, probably return the English string and emit a warning? This dictionary would be defined in a script tag in a HTML file, something like (possibly with an implementation that doesn't repeat the strings a little less):
  ```html
  <script type="text/javascript">
      window.translationDictionary = {
          "de": {
              {% language 'de' %}
                  "The server is not responding": "{% trans 'The server is not responding' %}",
              {% endlanguage %}
          }
      };
  </script>
  ```
  2. Use Django's builtin functionality: There is a builtin way that configures an extra endpoint to make all translations available (https://docs.djangoproject.com/en/4.2/topics/i18n/translation/#internationalization-in-javascript-code). A plus is that it also supports `ngettext` and so on. It seems like it can also detect all strings used in translations, but the setup may be a bit tricky with Typescript thrown into the mix.
  
  I think I prefer the first approach, but maybe we encounter difficulties with it or decide that we will need `ngettext` etc. in the future and go with the Django versions directly.
  
  </issue>
  <code>
  [start of evap/development/management/commands/translate.py]
  1 from django.core.management import call_command
  2 from django.core.management.base import BaseCommand
  3 
  4 
  5 class Command(BaseCommand):
  6     args = ""
  7     help = 'Execute "makemessages --locale=de --ignore=node_modules/*"'
  8 
  9     def handle(self, *args, **options):
  10         self.stdout.write('Executing "manage.py makemessages --locale=de --ignore=node_modules/*"')
  11         call_command("makemessages", "--locale=de", "--ignore=node_modules/*")
  12
  [end of evap/development/management/commands/translate.py]
  [start of evap/urls.py]
  1 import django.contrib.auth.views
  2 from django.conf import settings
  3 from django.urls import include, path
  4 
  5 urlpatterns = [
  6     path("", include('evap.evaluation.urls')),
  7     path("staff/", include('evap.staff.urls')),
  8     path("results/", include('evap.results.urls')),
  9     path("student/", include('evap.student.urls')),
  10     path("contributor/", include('evap.contributor.urls')),
  11     path("rewards/", include('evap.rewards.urls')),
  12     path("grades/", include('evap.grades.urls')),
  13 
  14     path("logout", django.contrib.auth.views.LogoutView.as_view(next_page="/"), name="django-auth-logout"),
  15     path("oidc/", include('mozilla_django_oidc.urls')),
  16 ]
  17 
  18 if settings.DEBUG:
  19     urlpatterns += [path('development/', include('evap.development.urls'))]
  20 
  21     if settings.ENABLE_DEBUG_TOOLBAR:
  22         # pylint does not correctly evaluate this if, so it will raise an import-error on
  23         # GitHub actions and a useless-suppression on a vagrant setup. Ignore both cases.
  24         import debug_toolbar  # pylint: disable=import-error, useless-suppression
  25         urlpatterns += [path('__debug__/', include(debug_toolbar.urls))]
  26
  [end of evap/urls.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/evap/development/management/commands/translate.py b/evap/development/management/commands/translate.py
  --- a/evap/development/management/commands/translate.py
  +++ b/evap/development/management/commands/translate.py
  @@ -9,3 +9,11 @@
       def handle(self, *args, **options):
           self.stdout.write('Executing "manage.py makemessages --locale=de --ignore=node_modules/*"')
           call_command("makemessages", "--locale=de", "--ignore=node_modules/*")
  +        call_command(
  +            "makemessages",
  +            "--domain=djangojs",
  +            "--extension=js,ts",
  +            "--locale=de",
  +            "--ignore=node_modules/*",
  +            "--ignore=evap/static/js/*.min.js",
  +        )
  diff --git a/evap/urls.py b/evap/urls.py
  --- a/evap/urls.py
  +++ b/evap/urls.py
  @@ -1,6 +1,9 @@
   import django.contrib.auth.views
   from django.conf import settings
   from django.urls import include, path
  +from django.views.i18n import JavaScriptCatalog
  +
  +from evap.middleware import no_login_required
   
   urlpatterns = [
       path("", include('evap.evaluation.urls')),
  @@ -13,6 +16,8 @@
   
       path("logout", django.contrib.auth.views.LogoutView.as_view(next_page="/"), name="django-auth-logout"),
       path("oidc/", include('mozilla_django_oidc.urls')),
  +
  +    path("catalog.js", no_login_required(JavaScriptCatalog.as_view()), name="javascript-catalog"),
   ]
   
   if settings.DEBUG:
  
verification_info: {"golden_diff": "diff --git a/evap/development/management/commands/translate.py b/evap/development/management/commands/translate.py\n--- a/evap/development/management/commands/translate.py\n+++ b/evap/development/management/commands/translate.py\n@@ -9,3 +9,11 @@\n     def handle(self, *args, **options):\n         self.stdout.write('Executing \"manage.py makemessages --locale=de --ignore=node_modules/*\"')\n         call_command(\"makemessages\", \"--locale=de\", \"--ignore=node_modules/*\")\n+        call_command(\n+            \"makemessages\",\n+            \"--domain=djangojs\",\n+            \"--extension=js,ts\",\n+            \"--locale=de\",\n+            \"--ignore=node_modules/*\",\n+            \"--ignore=evap/static/js/*.min.js\",\n+        )\ndiff --git a/evap/urls.py b/evap/urls.py\n--- a/evap/urls.py\n+++ b/evap/urls.py\n@@ -1,6 +1,9 @@\n import django.contrib.auth.views\n from django.conf import settings\n from django.urls import include, path\n+from django.views.i18n import JavaScriptCatalog\n+\n+from evap.middleware import no_login_required\n \n urlpatterns = [\n     path(\"\", include('evap.evaluation.urls')),\n@@ -13,6 +16,8 @@\n \n     path(\"logout\", django.contrib.auth.views.LogoutView.as_view(next_page=\"/\"), name=\"django-auth-logout\"),\n     path(\"oidc/\", include('mozilla_django_oidc.urls')),\n+\n+    path(\"catalog.js\", no_login_required(JavaScriptCatalog.as_view()), name=\"javascript-catalog\"),\n ]\n \n if settings.DEBUG:\n", "issue": "Translations in Javascript and Typescript\nWhen writing Javascript and Typescript in separate, non-HTML files, we can't use the Django template functions `trans`, `blocktrans`, etc. anymore. We have worked around this by putting translated strings into the DOM and accessing them via Javascript then.\r\n\r\nInstead of doing this, we want to have a unified approach where the use-site can just write `trans(\"The server is not responding.\")` or so. There are two possible approaches:\r\n\r\n1. DIY: We have a function `trans(english: string, to: Language = window.LANGUAGE): string` with `type Language = \"English\" | \"German\"`. This function looks up the string in a global dictionary (for example `window.translationDictionary` or so). I am not sure what it should do if the string is not present, probably return the English string and emit a warning? This dictionary would be defined in a script tag in a HTML file, something like (possibly with an implementation that doesn't repeat the strings a little less):\r\n```html\r\n<script type=\"text/javascript\">\r\n    window.translationDictionary = {\r\n        \"de\": {\r\n            {% language 'de' %}\r\n                \"The server is not responding\": \"{% trans 'The server is not responding' %}\",\r\n            {% endlanguage %}\r\n        }\r\n    };\r\n</script>\r\n```\r\n2. Use Django's builtin functionality: There is a builtin way that configures an extra endpoint to make all translations available (https://docs.djangoproject.com/en/4.2/topics/i18n/translation/#internationalization-in-javascript-code). A plus is that it also supports `ngettext` and so on. It seems like it can also detect all strings used in translations, but the setup may be a bit tricky with Typescript thrown into the mix.\r\n\r\nI think I prefer the first approach, but maybe we encounter difficulties with it or decide that we will need `ngettext` etc. in the future and go with the Django versions directly.\n", "before_files": [{"content": "from django.core.management import call_command\nfrom django.core.management.base import BaseCommand\n\n\nclass Command(BaseCommand):\n    args = \"\"\n    help = 'Execute \"makemessages --locale=de --ignore=node_modules/*\"'\n\n    def handle(self, *args, **options):\n        self.stdout.write('Executing \"manage.py makemessages --locale=de --ignore=node_modules/*\"')\n        call_command(\"makemessages\", \"--locale=de\", \"--ignore=node_modules/*\")\n", "path": "evap/development/management/commands/translate.py"}, {"content": "import django.contrib.auth.views\nfrom django.conf import settings\nfrom django.urls import include, path\n\nurlpatterns = [\n    path(\"\", include('evap.evaluation.urls')),\n    path(\"staff/\", include('evap.staff.urls')),\n    path(\"results/\", include('evap.results.urls')),\n    path(\"student/\", include('evap.student.urls')),\n    path(\"contributor/\", include('evap.contributor.urls')),\n    path(\"rewards/\", include('evap.rewards.urls')),\n    path(\"grades/\", include('evap.grades.urls')),\n\n    path(\"logout\", django.contrib.auth.views.LogoutView.as_view(next_page=\"/\"), name=\"django-auth-logout\"),\n    path(\"oidc/\", include('mozilla_django_oidc.urls')),\n]\n\nif settings.DEBUG:\n    urlpatterns += [path('development/', include('evap.development.urls'))]\n\n    if settings.ENABLE_DEBUG_TOOLBAR:\n        # pylint does not correctly evaluate this if, so it will raise an import-error on\n        # GitHub actions and a useless-suppression on a vagrant setup. Ignore both cases.\n        import debug_toolbar  # pylint: disable=import-error, useless-suppression\n        urlpatterns += [path('__debug__/', include(debug_toolbar.urls))]\n", "path": "evap/urls.py"}]}