prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Some languages don't have all strings available for translation
  ### Describe the issue
  
  My project is here: https://hosted.weblate.org/projects/feeder/android-strings
  
  A few languages Polish, French and Chinese (Simplified), are missing a dozen strings.
  
  One example is the string `other_minutes` which is not available for translation in these languages.
  
  I have tried re-scanning strings and similar with no change.
  
  ### I already tried
  
  - [X] I've read and searched [the documentation](https://docs.weblate.org/).
  - [X] I've searched for similar issues in this repository.
  
  ### Steps to reproduce the behavior
  
  Not sure how to reproduce it but it is happening here :https://hosted.weblate.org/projects/feeder/android-strings
  
  look at string `other_minutes`, it is missing from Polish, French, and Chinese (Simplified)
  
  ### Expected behavior
  
  All strings should be available for translation in all languages.
  
  ### Screenshots
  
  _No response_
  
  ### Exception traceback
  
  _No response_
  
  ### How do you run Weblate?
  
  weblate.org service
  
  ### Weblate versions
  
  _No response_
  
  ### Weblate deploy checks
  
  _No response_
  
  ### Additional context
  
  _No response_
  
  </issue>
  <code>
  [start of weblate/addons/cleanup.py]
  1 # Copyright © Michal Čihař <michal@weblate.org>
  2 #
  3 # SPDX-License-Identifier: GPL-3.0-or-later
  4 
  5 from django.utils.translation import gettext_lazy
  6 
  7 from weblate.addons.base import UpdateBaseAddon
  8 from weblate.addons.events import EVENT_POST_COMMIT, EVENT_POST_UPDATE, EVENT_PRE_COMMIT
  9 from weblate.trans.exceptions import FileParseError
  10 
  11 
  12 class BaseCleanupAddon(UpdateBaseAddon):
  13     @classmethod
  14     def can_install(cls, component, user):
  15         if not component.has_template():
  16             return False
  17         return super().can_install(component, user)
  18 
  19 
  20 class CleanupAddon(BaseCleanupAddon):
  21     name = "weblate.cleanup.generic"
  22     verbose = gettext_lazy("Cleanup translation files")
  23     description = gettext_lazy(
  24         "Update all translation files to match the monolingual base file. "
  25         "For most file formats, this means removing stale translation keys "
  26         "no longer present in the base file."
  27     )
  28     icon = "eraser.svg"
  29     events = (EVENT_PRE_COMMIT, EVENT_POST_UPDATE)
  30 
  31     def update_translations(self, component, previous_head):
  32         for translation in self.iterate_translations(component):
  33             filenames = translation.store.cleanup_unused()
  34             if filenames is None:
  35                 continue
  36             self.extra_files.extend(filenames)
  37             translation.store_hash()
  38 
  39     def pre_commit(self, translation, author):
  40         if translation.is_source and not translation.component.intermediate:
  41             return
  42         try:
  43             filenames = translation.store.cleanup_unused()
  44         except FileParseError:
  45             return
  46         if filenames is not None:
  47             self.extra_files.extend(filenames)
  48             translation.store_hash()
  49 
  50 
  51 class RemoveBlankAddon(BaseCleanupAddon):
  52     name = "weblate.cleanup.blank"
  53     verbose = gettext_lazy("Remove blank strings")
  54     description = gettext_lazy(
  55         "Removes strings without a translation from translation files."
  56     )
  57     events = (EVENT_POST_COMMIT, EVENT_POST_UPDATE)
  58     icon = "eraser.svg"
  59 
  60     def update_translations(self, component, previous_head):
  61         for translation in self.iterate_translations(component):
  62             filenames = translation.store.cleanup_blank()
  63             if filenames is None:
  64                 continue
  65             self.extra_files.extend(filenames)
  66             translation.store_hash()
  67 
  68     def post_commit(self, component):
  69         self.post_update(component, None, skip_push=True)
  70
  [end of weblate/addons/cleanup.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/weblate/addons/cleanup.py b/weblate/addons/cleanup.py
  --- a/weblate/addons/cleanup.py
  +++ b/weblate/addons/cleanup.py
  @@ -34,7 +34,7 @@
               if filenames is None:
                   continue
               self.extra_files.extend(filenames)
  -            translation.store_hash()
  +            # Do not update hash here as this is just before parsing updated files
   
       def pre_commit(self, translation, author):
           if translation.is_source and not translation.component.intermediate:
  @@ -63,7 +63,9 @@
               if filenames is None:
                   continue
               self.extra_files.extend(filenames)
  -            translation.store_hash()
  +            # Do not update hash in post_update, only in post_commit
  +            if previous_head == "weblate:post-commit":
  +                translation.store_hash()
   
       def post_commit(self, component):
  -        self.post_update(component, None, skip_push=True)
  +        self.post_update(component, "weblate:post-commit", skip_push=True)
  
verification_info: {"golden_diff": "diff --git a/weblate/addons/cleanup.py b/weblate/addons/cleanup.py\n--- a/weblate/addons/cleanup.py\n+++ b/weblate/addons/cleanup.py\n@@ -34,7 +34,7 @@\n             if filenames is None:\n                 continue\n             self.extra_files.extend(filenames)\n-            translation.store_hash()\n+            # Do not update hash here as this is just before parsing updated files\n \n     def pre_commit(self, translation, author):\n         if translation.is_source and not translation.component.intermediate:\n@@ -63,7 +63,9 @@\n             if filenames is None:\n                 continue\n             self.extra_files.extend(filenames)\n-            translation.store_hash()\n+            # Do not update hash in post_update, only in post_commit\n+            if previous_head == \"weblate:post-commit\":\n+                translation.store_hash()\n \n     def post_commit(self, component):\n-        self.post_update(component, None, skip_push=True)\n+        self.post_update(component, \"weblate:post-commit\", skip_push=True)\n", "issue": "Some languages don't have all strings available for translation\n### Describe the issue\n\nMy project is here: https://hosted.weblate.org/projects/feeder/android-strings\r\n\r\nA few languages Polish, French and Chinese (Simplified), are missing a dozen strings.\r\n\r\nOne example is the string `other_minutes` which is not available for translation in these languages.\r\n\r\nI have tried re-scanning strings and similar with no change.\n\n### I already tried\n\n- [X] I've read and searched [the documentation](https://docs.weblate.org/).\n- [X] I've searched for similar issues in this repository.\n\n### Steps to reproduce the behavior\n\nNot sure how to reproduce it but it is happening here :https://hosted.weblate.org/projects/feeder/android-strings\r\n\r\nlook at string `other_minutes`, it is missing from Polish, French, and Chinese (Simplified)\n\n### Expected behavior\n\nAll strings should be available for translation in all languages.\n\n### Screenshots\n\n_No response_\n\n### Exception traceback\n\n_No response_\n\n### How do you run Weblate?\n\nweblate.org service\n\n### Weblate versions\n\n_No response_\n\n### Weblate deploy checks\n\n_No response_\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "# Copyright \u00a9 Michal \u010ciha\u0159 <michal@weblate.org>\n#\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom django.utils.translation import gettext_lazy\n\nfrom weblate.addons.base import UpdateBaseAddon\nfrom weblate.addons.events import EVENT_POST_COMMIT, EVENT_POST_UPDATE, EVENT_PRE_COMMIT\nfrom weblate.trans.exceptions import FileParseError\n\n\nclass BaseCleanupAddon(UpdateBaseAddon):\n    @classmethod\n    def can_install(cls, component, user):\n        if not component.has_template():\n            return False\n        return super().can_install(component, user)\n\n\nclass CleanupAddon(BaseCleanupAddon):\n    name = \"weblate.cleanup.generic\"\n    verbose = gettext_lazy(\"Cleanup translation files\")\n    description = gettext_lazy(\n        \"Update all translation files to match the monolingual base file. \"\n        \"For most file formats, this means removing stale translation keys \"\n        \"no longer present in the base file.\"\n    )\n    icon = \"eraser.svg\"\n    events = (EVENT_PRE_COMMIT, EVENT_POST_UPDATE)\n\n    def update_translations(self, component, previous_head):\n        for translation in self.iterate_translations(component):\n            filenames = translation.store.cleanup_unused()\n            if filenames is None:\n                continue\n            self.extra_files.extend(filenames)\n            translation.store_hash()\n\n    def pre_commit(self, translation, author):\n        if translation.is_source and not translation.component.intermediate:\n            return\n        try:\n            filenames = translation.store.cleanup_unused()\n        except FileParseError:\n            return\n        if filenames is not None:\n            self.extra_files.extend(filenames)\n            translation.store_hash()\n\n\nclass RemoveBlankAddon(BaseCleanupAddon):\n    name = \"weblate.cleanup.blank\"\n    verbose = gettext_lazy(\"Remove blank strings\")\n    description = gettext_lazy(\n        \"Removes strings without a translation from translation files.\"\n    )\n    events = (EVENT_POST_COMMIT, EVENT_POST_UPDATE)\n    icon = \"eraser.svg\"\n\n    def update_translations(self, component, previous_head):\n        for translation in self.iterate_translations(component):\n            filenames = translation.store.cleanup_blank()\n            if filenames is None:\n                continue\n            self.extra_files.extend(filenames)\n            translation.store_hash()\n\n    def post_commit(self, component):\n        self.post_update(component, None, skip_push=True)\n", "path": "weblate/addons/cleanup.py"}]}