Bugfixes in preparation for switching to Weblate for translations#635
Bugfixes in preparation for switching to Weblate for translations#635freakboy3742 merged 8 commits intobeeware:lektorfrom
Conversation
| for msg, paths in self.translations.items(): | ||
| if msg: | ||
| result += "#: %s\n" % " ".join(paths) | ||
| for token, repl in {'\\': '\\\\', '\n': '\\n', '\t': '\\t', '"': '\\"'}.items(): | ||
| msg = msg.replace(token, repl) | ||
| result += 'msgid "%s"\n' % msg | ||
| result += 'msgstr ""\n\n' | ||
| return result |
There was a problem hiding this comment.
@freakboy3742 I added the if msg: to this block, as described in the initial PR comment. Tagging it here for more convenient reference.
freakboy3742
left a comment
There was a problem hiding this comment.
Re Q1: I've flagged a couple of possible omissions in the translation markup.
I wonder if we might want to remove some translations as well. Is it reasonable for translators to keep up with blog posts? Event updates? I'm mostly wary that the PO file is 18k lines long, and because it's all one file, there's no good way to prioritise what is "important" content vs less important.
Re Q2: As far as I can make out, the if msg: change makes sense. The only potential risk I can see is on the "reverse" approach - if the code that tries to process the translation does a lookup of "", and doesn't find a match, does it raise an error? Based on my testing, it doesn't look like it does... so maybe that is success?
| label = Author | ||
| type = string | ||
| width = 1/2 | ||
| translate = True |
There was a problem hiding this comment.
Does the author name need to be translated?
There was a problem hiding this comment.
No. I'm not sure why I flagged it. Will remove.
There was a problem hiding this comment.
Presumably flowblocks/button-block.ini also has some translation opportunities in the button label?
There was a problem hiding this comment.
Ah, right. Yes most likely. As I said, I'm not as familiar with the flowblocks. I wasn't thinking about it.
There was a problem hiding this comment.
Not sure if this is the Tor version or the original (it looks like the original), but we should put a note at the top here describing the provenance.
There was a problem hiding this comment.
It should be the Tor version. I will add this.
There was a problem hiding this comment.
No need to include both of these; as long as we retain the license and describe provenance, we don't have to preserve all the content.
There was a problem hiding this comment.
I'll keep this in mind for the next PR. This PR will ultimately not have the plugin in it yet.
|
I looked through the Tor updates. Only one of them has any details beyond the commit title. It appears to resolve the multiple-build issue. Here is what I found:
I am including this here because I don't quite know the implications of the caveat, and I wanted to make sure you were aware as it probably makes more sense to you than me. Regarding your comments:
I am inclined to agree with this. I initially assumed that there was a lot of consistency across the event updates, which if you base it on the last few tutorials, it's not an incorrect assumption, but looking through the .po file as a whole, this appears to not be the case. We can always add this back in if we get the whole site translated and people are looking for more.
I'll take maybe for an answer. Obviously if it eventually chokes, we can revisit it. |
I won't profess enough experience with Lektor to fully understand all the consequence of such a change - but it sounds to me like this is a fix for the 'needs 2 builds' problem you've been seeing. Definitely something worth keeping an eye on, though. |
|
@freakboy3742 Ok, here are the updates:
I think this is ready for another look. |
Understood. That is my take on it as well, however I wanted to ensure you were aware of it in case it ends up affecting our implementation. |
freakboy3742
left a comment
There was a problem hiding this comment.
tl;dr - this looks like a completely uncontroversial set of changes. There's likely more work that could be done to improve the pagination even more (what even is the gutter for on those pages?...) - and the translation flags obviously won't do anything yet, other than indicate that things could be translated - but I'd be happy landing this set of changes as is.
|
@freakboy3742 Updated title, no longer draft status. |
freakboy3742
left a comment
There was a problem hiding this comment.
Looks good - and one step closer to managed translations!
|
Visit the preview URL for this PR (updated for commit 46967a9): https://beeware-org--pr635-weblate-5eia3r6c.web.app (expires Tue, 03 Jun 2025 23:47:54 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: b0da44bc067e7d9a4255c77cb2c5fce572218cec |
I would also love to know the answer to this. I guess we'll have to ask the person who wrote it?
I verified this before submitting this as-is. They are ignored without the plugin. |
Nah - that guy doesn't know anything... 🤣
👍 |
I'd definitely be interested to translate the blog posts, event updates etc, once I have more time. Since we're maintaining the letkor-i18n-plugin, we could add code that splits those into another file (=component on Weblate) and sort them according to the date published that is listed in the lektor source file. When we're merging a little bit more work is needed because AFIAK there's no way for msgmerge to specify a custom sort key. So it'd involve loading the merged unsorted file and resorting it and saving it. Do you think this would be a good way? |
You're one person, translating one language. I'm very wary of setting up a bunch of complex infrastructure to support one contributor on one language, and thereby setting up expectations for other languages, unless we've got evidence that blog posts will be translated regularly.
Is it possible? Maybe. Is it worth it? I doubt it, for the same reason that we omitted blog posts in the first place. |
|
I agree with you on the first part and intended the second part to be a totally theoretical discussion… There’s some regular work in Spanish going on, but there’s nothing in the other langs so far… it’d make sense for a lot of people to be working on website translations for this to be worth it/ |
This is the first step towards switching the website to Weblate for translations.
As discussed, I have updated the data models to indicate what fields should be translated. I also added a fix to the plugin itself to handle the
duplicate message definitionerror, as the workaround we talked about addressed two out of what turned out to be a significant number of instances of this issue.I need the following two things from @freakboy3742 at this point:
translate = Trueto all applicable fields in the model files. These files are in theflowblocksandmodelsdirectories. There may be one or two empty ones that I left out in my initial attempt to deal with the above-mentioned error, and I feel at this point that they should be included, so please be aware of that as you go through this.if msg:to this block. My intention here is to skip generating any sections in the .pot file if there is no content in a given field, to avoid the above-mentioned error. It appears to be working, but I don't understand this enough to really grasp the implications of the change, so I would appreciate your input on it.Fixes #634
PR Checklist: