Repository: WeblateOrg/weblate

Issue:
UI: Improve error message about PullRequests
### Describe the issue

When PullRequests (button "Push") not working there is a simple message that doesn't help anyone.

    Could not push to remote branch on bitdemo/bit_demo.

### 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

Push.

### Expected behavior

Name the reason why the Push didn't work. What **exactly** is missing?
And maybe give a hint about how to solve the problem.

If you link to the docu please make sure the docu really helps. It often does not. I read all the GitHub pullrequest setup stuff. [I don't get it](https://codeberg.org/Codeberg/Community/issues/1004). What is missing in the docu is use-case orientated stuff. Describe use cases with a step by step tutorial. And also keep in mind that your users often do not know how weblate internally works. The same with git.
Take your users by the hand.

### Screenshots

![image](https://user-images.githubusercontent.com/11861496/235093002-8ff73505-b113-4666-89bb-756a60e06c84.png)


### Exception traceback

_No response_

### How do you run Weblate?

Other

### Weblate versions

_No response_

### Weblate deploy checks

_No response_

### Additional context

_No response_


Discussion:
https://github.com/WeblateOrg/weblate/discussions/8535
The detailed error message is stored in the history, but it makes sense to show it in the error message as well.
This issue seems to be a good fit for newbie contributors. You are welcome to contribute to Weblate! Don't hesitate to ask any questions you would have while implementing this.

You can learn about how to get started in our [contributors documentation](https://docs.weblate.org/en/latest/contributing/index.html).
Turn off the damn bot. Things like this do drive potential contributors away.
> The detailed error message is stored in the history, but it makes sense to show it in the error message as well.

Where can I find the "History"? Maybe linking to that history in that error message would be helpful.

You mean this?
![image](https://user-images.githubusercontent.com/11861496/235128707-bffec824-0082-42e6-9825-caf61d66648e.png)

The message doesn't help me. The error was about a PullRequest. So why is there the need of a fork?
To submit a pull request, Weblate needs to push changes somewhere. Depending on a configuration, it will push to a branch or fork the repo, see https://docs.weblate.org/en/latest/admin/continuous.html#pushing-changes-from-weblate
And, yes, Gitea didn't provide an error message after calling API, so it's hard to guess what is wrong (still, it might be a bug in Weblate, but it's hard to tell without any additional information).
> To submit a pull request, Weblate needs to push changes somewhere. Depending on a configuration, it will push to a branch or fork the repo, see https://docs.weblate.org/en/latest/admin/continuous.html#pushing-changes-from-weblate

I still don't understand the "fork". A fork is not a "git" operation. You mean "git clone"? But what is the source and what the destination of that clone? How does this help to get commits from a internal-weblate-git-repo into a codehosters git repo?
You typically fork a repository to create a pull request, see https://docs.gitea.io/en-us/usage/pull-request/
> You typically fork a repository to create a pull request, see https://docs.gitea.io/en-us/usage/pull-request/

You reference inplicite knowledge here. That is one of the big problems of Weblate UI and its docu. Not all your users are nerds and hackers. And not all of them are dump or script kidies. But you need to find a way to better connect to your users. I don't open such issues just to ask things. I'm really interested in improving Weblate. I do contribute that way. Currently you definitely don't "connect to your users" and everyone knows and talk about how "problematic" the Weblate documentation and its GUI is.

I know what a "fork" is. But it is inconsistent in your UI. A "fork" is a marketing worked used (and maybe invented) by GitHub (now owned by Microsoft). Technically a fork is not a git operation but a "git clone" is. Then name it that way.

The term "fork" has a meaning in none technical area where one project is "duplicated" to go it's own way of development and evolution. For example Gitea is forked to Forge. Raiders now is known as Twix. 😄 A fork is an act of politics.

It is not clear what this error message is about and what Weblate tries to do here. Does it "git clone"? Be transparent about that.

Resolving patch:
diff --git a/weblate/trans/models/component.py b/weblate/trans/models/component.py
--- a/weblate/trans/models/component.py
+++ b/weblate/trans/models/component.py
@@ -1625,7 +1625,12 @@ def push_repo(self, request, retry=True):
                         else:
                             return self.push_repo(request, retry=False)
                 messages.error(
-                    request, _("Could not push to remote branch on %s.") % self
+                    request,
+                    _("Failed to push %(component)s: %(error_text)s")
+                    % {
+                        "component": self,
+                        "error_text": error_text,
+                    },
                 )
                 self.add_alert("PushFailure", error=error_text)
                 return False


Test patch: