[WEBLATE] Prevent code error within Weblate #5077
Replies: 19 comments
-
A first step has been made: all {} code is now shown grayed in Weblate. This brings extra attention to translators not to translate these strings. It is still possible though. Some more investigation wil go into this issue to find more ways to prevent errors due to translation. |
Beta Was this translation helpful? Give feedback.
-
A second step has been made. Now inline code is shown grayed as well. Usually this is of a form like `{print}`. This is now completely greyed, not only the {print} part. In code blocks (with three ticks) the first step (code in {}) is still very usefull. We can dismiss this per string, so not a big problem, but is this the best way to deal with |
Beta Was this translation helpful? Give feedback.
-
Ok I want to bump this issue cause it is making my life kinda miserable not having this!! It is a lot of work to fix code errors in Weblate PRs and there are always a few, misspelled keywords, spaces in weird places and I end up spending a few hours each week fixes these small things which distracts a lot from other work but yeah we do want to gather more translations...! What we would like (but I do not even know if this is possible!) is to do a call from Weblate to our parser (accessing |
Beta Was this translation helpful? Give feedback.
-
Maybe @jpelay could do a bit of Googling to see if there is something like a hook we can use? Or maybe @Mark-Giesen still wants to explore this? |
Beta Was this translation helpful? Give feedback.
-
I had a lot of different communications with Weblate about this, finally resulting in what we have now as being "normally enough". But having runnable code to translate is far from normal, even for Weblate. I'll have to retrace my steps in this communication. I believe it is possible, but...? In the end; Weblate itself is open source, so if it's not in there, we can add it. |
Beta Was this translation helpful? Give feedback.
-
I couldn't wait :-). One of the things that looked promissing was AUTOFIX_LIST. These are fixes Weblate silently does see here some examples. We could build one of our own like this. |
Beta Was this translation helpful? Give feedback.
-
Ah thanks for looking into this further @Mark-Giesen! The https://docs.weblate.org/en/latest/admin/checks.html#custom-autofix looks promising! Can we dive into whether that would allow us to do a call to the (online) parser, or would we copy-paste the transpiler code in? And can we do this hosted too? |
Beta Was this translation helpful? Give feedback.
-
I just posted a new summary question on my weblate helpdesk site. I believe this sums up the problem and options we have and the results I had sofar with Weblate. See message below:
|
Beta Was this translation helpful? Give feedback.
-
First reaction from Weblate is in, they wanted some example strings in our database to check on the configuration. Since we're on the open source free edition, the support is done on a little lower priority, but done! I expect further progress tomorrow. |
Beta Was this translation helpful? Give feedback.
-
How cool that this is moving forward!! |
Beta Was this translation helpful? Give feedback.
-
Hi @Mark-Giesen! Do you have any updates? @ToniSkulj wants to explore whether he can put something together in a fork or Weblate. And @rix0rrr had a nice idea, we could also consider making a GreaseMonkey script? It would require people to install a plugin but it would be relatively easy and enthusiastic translators might be willing to do that. Something to think about if we don't succeed with Weblate. |
Beta Was this translation helpful? Give feedback.
-
No, not yet. I'll asked for an update. Trying is a good idea. If we have something working, they might be able to react to that specific. |
Beta Was this translation helpful? Give feedback.
-
Well, just received an answer:
Apparently the python brace check should prevent saving, thought this wasn't true, have to reinvestigate that. Anyway, we can write one ourselves (with the same restriction of not saving to work). If someone wants to check this out, be my guest. If not, I can have a look in my Christmas holidays, maybe a little sooner. |
Beta Was this translation helpful? Give feedback.
-
Well, I had 5 minutes, so did a quick check to find out if my memory or this answer was the truth. The example string has 3 errors, of which one is enforced. The enforced one should have prevented this text to exist in de DB, my opinion. Changing the text is still possible. Add a full stop at the end and save, this works and one of the errors is fixed. This is what we don't want. |
Beta Was this translation helpful? Give feedback.
-
At FOSDEM I met the Creator of Weblate and discussed this issue. I finally got the confirmation that an enforced check does not prevent saving, but it prevents the "needs editing" to be cleared. A real "prevent saving" check might be pretty easy to build for them, but they don't have much time to spare on this item, but would like this to become part of the tool. |
Beta Was this translation helpful? Give feedback.
-
What needs to be discussed is whether or not we take the "stop saving" check approach first. It's easy (Weblate thinks) because all parts are available somewhere in Weblate. The last step (external check of code by our parser) is the final and best approach, but might take more effort and therefore more time. So is it worthwhile to try the first option or shoud we skip that and go for the more complex solution at once? |
Beta Was this translation helpful? Give feedback.
-
Hi @Mark-Giesen! Pasting your text from Discord here so we can discuss it: I think we now have 3 options to explore.
(3 by the way is a browser plugin, I think we can declare that out of scope for now) As for 2, if we are going to do autofix, then it would be a lot less work to do the auto-fix on our side, than we do not need a plugin at all. Yesterday I have worked on a script in our tester that reverts broken code back to the original English. It is not ideal, but it is more or less ready to go! We will discuss tomorrow in the meeting also what other people think about the reverting (in our code or in Weblate) |
Beta Was this translation helpful? Give feedback.
-
What's the status of this? Did the "revert broken code to EN" make it into production? And if so, is this issue closed then? Other issues make take precedence now, or do we want to investigate further options on Weblate side? |
Beta Was this translation helpful? Give feedback.
-
Yes, see: #4544 My pressing time-sink problem of fixing Weblate is solved, so my life is noticeably better now! I think there is enough other work on Weblate for now, so even though this would still be nice to have, the amount of work it would be for you would be better spent elsewhere I think. |
Beta Was this translation helpful? Give feedback.
-
Translator usually know not to touch strings within {} or ```. But every now and then this goes wrong. The time it takes to find this error is usually some days (merge and test of the Weblate Pull Request). We have to fix the code and risk merging conflicts.
Could it be possible to write an add-on for Weblate to prevent {} blocks to be translated and ``` blocks to be transpiled. Errors could be provided to the translators at the moment of translation. This shortens the loop with days and gives translators much needed feedback.
Beta Was this translation helpful? Give feedback.
All reactions