prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  GetText check fails incorrectly on newline
  https://pontoon.mozilla.org/en-GB/all-projects/all-resources/?string=286055
  
  If you copy the source string, an extra line is added at the back, and that fails the checks for GetText.
  
  </issue>
  <code>
  [start of pontoon/translations/forms.py]
  1 from django import forms
  2 from django.contrib.postgres.forms import SimpleArrayField
  3 
  4 from pontoon.base.models import (
  5     Entity,
  6     Locale,
  7 )
  8 
  9 
  10 class CreateTranslationForm(forms.Form):
  11     """
  12     Form for parameters to the `entities` view.
  13     """
  14 
  15     entity = forms.IntegerField()
  16     locale = forms.CharField()
  17     plural_form = forms.CharField()
  18 
  19     # Some file formats allow empty original strings and translations.
  20     # We must allow both here. Validation is handled in pontoon.checks module.
  21     original = forms.CharField(required=False)
  22     translation = forms.CharField(required=False)
  23 
  24     ignore_warnings = forms.BooleanField(required=False)
  25     approve = forms.BooleanField(required=False)
  26     force_suggestions = forms.BooleanField(required=False)
  27     paths = forms.MultipleChoiceField(required=False)
  28     machinery_sources = SimpleArrayField(forms.CharField(max_length=30), required=False)
  29 
  30     def clean_paths(self):
  31         try:
  32             return self.data.getlist("paths[]")
  33         except AttributeError:
  34             # If the data source is not a QueryDict, it won't have a `getlist` method.
  35             return self.data.get("paths[]") or []
  36 
  37     def clean_entity(self):
  38         try:
  39             return Entity.objects.get(pk=self.cleaned_data["entity"])
  40         except Entity.DoesNotExist:
  41             raise forms.ValidationError(f"Entity `{self.entity}` could not be found")
  42 
  43     def clean_locale(self):
  44         try:
  45             return Locale.objects.get(code=self.cleaned_data["locale"])
  46         except Locale.DoesNotExist:
  47             raise forms.ValidationError(f"Locale `{self.entity}` could not be found")
  48 
  49     def clean_plural_form(self):
  50         if self.cleaned_data["plural_form"] == "-1":
  51             return None
  52         return self.cleaned_data["plural_form"]
  53 
  54     def clean_translation(self):
  55         return self.data.get("translation", "")
  56
  [end of pontoon/translations/forms.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/pontoon/translations/forms.py b/pontoon/translations/forms.py
  --- a/pontoon/translations/forms.py
  +++ b/pontoon/translations/forms.py
  @@ -51,5 +51,8 @@
               return None
           return self.cleaned_data["plural_form"]
   
  +    def clean_original(self):
  +        return self.data.get("original", "")
  +
       def clean_translation(self):
           return self.data.get("translation", "")
  
verification_info: {"golden_diff": "diff --git a/pontoon/translations/forms.py b/pontoon/translations/forms.py\n--- a/pontoon/translations/forms.py\n+++ b/pontoon/translations/forms.py\n@@ -51,5 +51,8 @@\n             return None\n         return self.cleaned_data[\"plural_form\"]\n \n+    def clean_original(self):\n+        return self.data.get(\"original\", \"\")\n+\n     def clean_translation(self):\n         return self.data.get(\"translation\", \"\")\n", "issue": "GetText check fails incorrectly on newline\nhttps://pontoon.mozilla.org/en-GB/all-projects/all-resources/?string=286055\r\n\r\nIf you copy the source string, an extra line is added at the back, and that fails the checks for GetText.\n", "before_files": [{"content": "from django import forms\nfrom django.contrib.postgres.forms import SimpleArrayField\n\nfrom pontoon.base.models import (\n    Entity,\n    Locale,\n)\n\n\nclass CreateTranslationForm(forms.Form):\n    \"\"\"\n    Form for parameters to the `entities` view.\n    \"\"\"\n\n    entity = forms.IntegerField()\n    locale = forms.CharField()\n    plural_form = forms.CharField()\n\n    # Some file formats allow empty original strings and translations.\n    # We must allow both here. Validation is handled in pontoon.checks module.\n    original = forms.CharField(required=False)\n    translation = forms.CharField(required=False)\n\n    ignore_warnings = forms.BooleanField(required=False)\n    approve = forms.BooleanField(required=False)\n    force_suggestions = forms.BooleanField(required=False)\n    paths = forms.MultipleChoiceField(required=False)\n    machinery_sources = SimpleArrayField(forms.CharField(max_length=30), required=False)\n\n    def clean_paths(self):\n        try:\n            return self.data.getlist(\"paths[]\")\n        except AttributeError:\n            # If the data source is not a QueryDict, it won't have a `getlist` method.\n            return self.data.get(\"paths[]\") or []\n\n    def clean_entity(self):\n        try:\n            return Entity.objects.get(pk=self.cleaned_data[\"entity\"])\n        except Entity.DoesNotExist:\n            raise forms.ValidationError(f\"Entity `{self.entity}` could not be found\")\n\n    def clean_locale(self):\n        try:\n            return Locale.objects.get(code=self.cleaned_data[\"locale\"])\n        except Locale.DoesNotExist:\n            raise forms.ValidationError(f\"Locale `{self.entity}` could not be found\")\n\n    def clean_plural_form(self):\n        if self.cleaned_data[\"plural_form\"] == \"-1\":\n            return None\n        return self.cleaned_data[\"plural_form\"]\n\n    def clean_translation(self):\n        return self.data.get(\"translation\", \"\")\n", "path": "pontoon/translations/forms.py"}]}