Repository: WeblateOrg/weblate

Issue:
Autotranslated field
### Describe the problem

Autotranslated entries are hard to check, since they are only available in the (non-editable) history.

### Describe the solution you'd like

A section for autotranslations

The problem is similar to reverting/checking translations or edits made by others, so there could be one for
"translated by others", but I think in addition, since autotranslations are particularly worrisome.

### Describe alternatives you've considered

_No response_

### Screenshots

![bilde](https://user-images.githubusercontent.com/13802408/141013639-e8ef8d03-ad3f-4765-b9fa-a5fc1864254b.png)


### Additional context

_No response_


Discussion:
Currently, with a new file, I do this:
1) I use automatic translation
2) labeled "automatic translation"
This suggestion seems to be right if you could still associate your label with automatic translations. That would help me save a few hours of work per month.
This issue has been put aside. It is currently unclear if it will ever be implemented as it seems to cover too narrow of a use case or doesn't seem to fit into Weblate.

Please try to clarify the use case or consider proposing something more generic to make it useful to more users.
(Optionally) adding label to auto-translated strings might be a viable solution.
@nijel I think that would work. The problem is it doesn't show up in the bar.
I think one common category and then different ones for
- Imported from project strings
- Imported from instance strings
- Machine-translated

Propagated/imported strings aren't as bad, but machine-translation is the real problem.
If it is a problem, it might be better to make these suggestions or set the auto-translated strings as needs editing.
>auto-translated strings as "suggestions"

This is true from the point of view of importing, but only because there is no differentiation between translated and auto-translated strings now. If they are to enter the stringbase at all, they can't be suggested.

>auto-translated strings as "needs editing"

This weakens the state of uncertainty, (and what is often a problem with the source string since it is easier to do)  by conflating it with something that "needs a lot more editing"

In the widgets, it would be really marketable to show manually translated strings as different from auto-translations.
The same thing goes for the statistics.

With it being much more difficult to actually find "untranslated" strings, and fuzzy strings also not a seperate category, I don't want just the basic graphs to work with. Instead

![bilde](https://user-images.githubusercontent.com/13802408/146086210-1ae2fdae-7b3a-4ba2-b8f5-de7bd35ee9d4.png)

This is my view of the hierarchy of content:
Confirmed by me
Translated by me
Confirmed
Translated
Fuzzy
Needs work marked by me
Needs work
Failing important checks
Auto-translated
Failing unimportant checks
Untranslated

I really want to work on stuff in this order:
Failing checks triggered by me
Auto-translated
Failing checks
Fuzzy
Needs work
Needs work marked by me
Untranslated
Translated by me
Confirmed by me
Translated
Confirmed

First by source, and then by translations.

What this does is give me the worst stuff to attack with my time.
It gives the most insight into assumed quality, and as close to a selected "certainty" by translators.

What I have in the bars:
Confirmed+confirmed by me
Translated+translated by me
Failing checks+Fuzzy+needs work+needs work marked by me

What I have in the categories:
Confirmed+confirmed by me
Translated+translated by me
Failing checks
Untranslated
Fuzzy+needs work+needs work marked by me

Resolving patch:
diff --git a/weblate/trans/models/unit.py b/weblate/trans/models/unit.py
--- a/weblate/trans/models/unit.py
+++ b/weblate/trans/models/unit.py
@@ -27,7 +27,7 @@
 from django.db.models import Count, Max, Q
 from django.utils import timezone
 from django.utils.functional import cached_property
-from django.utils.translation import gettext, gettext_lazy
+from django.utils.translation import gettext, gettext_lazy, gettext_noop
 from pyparsing import ParseException
 
 from weblate.checks.flags import Flags
@@ -1238,6 +1238,8 @@ def translate(
 
         Propagation is currently disabled on import.
         """
+        component = self.translation.component
+
         # Fetch current copy from database and lock it for update
         old_unit = Unit.objects.select_for_update().get(pk=self.pk)
         self.store_old_unit(old_unit)
@@ -1270,8 +1272,8 @@ def translate(
         # Enforced checks can revert the state to needs editing (fuzzy)
         if (
             self.state >= STATE_TRANSLATED
-            and self.translation.component.enforced_checks
-            and self.all_checks_names & set(self.translation.component.enforced_checks)
+            and component.enforced_checks
+            and self.all_checks_names & set(component.enforced_checks)
         ):
             self.state = self.original_state = STATE_FUZZY
             self.save(run_checks=False, same_content=True, update_fields=["state"])
@@ -1280,12 +1282,23 @@ def translate(
             user
             and self.target != self.old_unit["target"]
             and self.state >= STATE_TRANSLATED
-            and not self.translation.component.is_glossary
+            and not component.is_glossary
         ):
             transaction.on_commit(
                 lambda: handle_unit_translation_change.delay(self.id, user.id)
             )
 
+        if change_action == Change.ACTION_AUTO:
+            label = component.project.label_set.get_or_create(
+                name=gettext_noop("Automatically translated"),
+                defaults={"color": "yellow"},
+            )[0]
+            self.labels.add(label)
+        else:
+            self.labels.through.objects.filter(
+                label__name="Automatically translated"
+            ).delete()
+
         return saved
 
     def get_all_flags(self, override=None):


Test patch: