Skip to content

Fix tag issues/indentation, axe most of Beeware plugin, update edit links#663

Merged
freakboy3742 merged 8 commits intolektorfrom
tags_cleanup
Jun 16, 2025
Merged

Fix tag issues/indentation, axe most of Beeware plugin, update edit links#663
freakboy3742 merged 8 commits intolektorfrom
tags_cleanup

Conversation

@HalfWhitt
Copy link
Copy Markdown
Member

@HalfWhitt HalfWhitt commented Jun 13, 2025

As far as I'm aware, none of this changes any of how the site actually looks.

I cleaned up a few places where tags were interacting oddly with Markdown. Markdown fields generate their own <p> tags, so using them for titles was generating <h3><p>...</p></h3>. And putting a Markdown field inside of a paragraph tag creates <p><p>...</p></p>, which isn't syntactically valid. Technically, the first <p> is implicitly closed by the second one, so the final </p> dangles.

Other than that, I escaped the bare > in the breadcrumbs to &gt;, and tried to make some of the indention of the generated source a little saner. (I've been reading up a bit on ways to manage whitespace more consistently with Jinja, but it's still dauntingly fiddly.)

EDIT: Also fixes #641.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@HalfWhitt HalfWhitt changed the title Fixed tag issues and tweaked some indendation Fixe tag issues and tweak some indentation Jun 13, 2025
@HalfWhitt HalfWhitt changed the title Fixe tag issues and tweak some indentation Fix tag issues and tweak some indentation Jun 13, 2025
@freakboy3742 freakboy3742 added the preview Approved for an automated preview label Jun 13, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 13, 2025

Visit the preview URL for this PR (updated for commit 8fedb26):

https://beeware-org--pr663-tags-cleanup-8rykgzzt.web.app

(expires Sun, 22 Jun 2025 23:53:31 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: b0da44bc067e7d9a4255c77cb2c5fce572218cec

Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes all make sense; my only comment is that they might not go far enough (regarding #641; details inline).

Comment thread templates/layout.html Outdated
@HalfWhitt HalfWhitt changed the title Fix tag issues and tweak some indentation Fix tag issues/indentation, axe Beeware plugin, update edit links Jun 14, 2025
@HalfWhitt HalfWhitt added preview Approved for an automated preview and removed preview Approved for an automated preview labels Jun 14, 2025
@HalfWhitt
Copy link
Copy Markdown
Member Author

HalfWhitt commented Jun 14, 2025

Okay. The edit link now goes to the correct file on Github, when clicked on an English version of a page. Our Weblate site's knowledge of what page its strings are from seems to be fuzzy at best, so I'm not sure if/how to link specifically, but I've set it up so it at least links to the correct language's dashboard.

I also changed "Update translation on Github" to "Edit translation on Weblate". I search-and-replaced Github to Weblate, but at least as of this commit, all those translated strings still say "update".

@HalfWhitt HalfWhitt added preview Approved for an automated preview and removed preview Approved for an automated preview labels Jun 14, 2025
@HalfWhitt
Copy link
Copy Markdown
Member Author

(That last commit was just source indentation; shouldn't change the rendered appearance any.)

@HalfWhitt HalfWhitt requested a review from freakboy3742 June 14, 2025 02:17
Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome cleanup; I only noticed 2 problems:

  1. The text "Edit translation on Weblate" is fairly long in English... "Mettre à jour la traduction sur Weblate" is getting really unwieldy. I wonder if it might be better to just use "Translate" there? I'm open to other suggestions though.
  2. The preview of the Home and News pages aren't rendering any upcoming events. It looks like the Beeware plugin was providing 1 feature that we were using: a value for today. The actual events page isn't affected by this because it renders all events, and "today" is provided by Javascript; but home and news use the value in Python.

@johnzhou721
Copy link
Copy Markdown
Contributor

  • The text "Edit translation on Weblate" is fairly long in English... "Mettre à jour la traduction sur Weblate" is getting really unwieldy. I wonder if it might be better to just use "Translate" there? I'm open to other suggestions though.

"Translate on Weblate" or just "Weblate" (which 1) can be used a noun in the link and 2) the upper right-hand corner of https://weblate.org/en/ uses Weblate jokingly as a verb like "Google")

@freakboy3742
Copy link
Copy Markdown
Member

"Translate on Weblate" or just "Weblate" (which 1) can be used a noun in the link and 2) the upper right-hand corner of https://weblate.org/en/ uses Weblate jokingly as a verb like "Google")

You get to make that joke when you're a brand everyone knows. Weblate is hardly that.

@johnzhou721
Copy link
Copy Markdown
Contributor

"Translate on Weblate" or just "Weblate" (which 1) can be used a noun in the link and 2) the upper right-hand corner of https://weblate.org/en/ uses Weblate jokingly as a verb like "Google")

You get to make that joke when you're a brand everyone knows. Weblate is hardly that.

“Translate on Weblate” is still a bit shorter than “edit translation on Weblate” which is the main suggestion in my message.

@HalfWhitt
Copy link
Copy Markdown
Member Author

  1. I like "Translate on Weblate".
    1a. I'm a bit fuzzy on the source of truth for Weblate translation stuff... when I change a string like this in English, should I attempt to alter the equivalent translated string in the .ini file? Or does that even matter, if those are pulled from Weblate?
  2. Ah, missed that was where today was coming from. Before next committing, I think I'll make a blank local Git repo and copy the before-and-after generated files into it to double-check what is and isn't changing. I wonder if there'd be a way to automate that as part of CI...

@freakboy3742
Copy link
Copy Markdown
Member

  1. I like "Translate on Weblate".
    1a. I'm a bit fuzzy on the source of truth for Weblate translation stuff... when I change a string like this in English, should I attempt to alter the equivalent translated string in the .ini file? Or does that even matter, if those are pulled from Weblate?

The .ini files aren't pulled into Weblate. That's a known gap in our translation tooling at present; they have to be fixed by PR. I'm happy with a Google Translate (or equivalent - the main translation is done with DeepL) as a first pass translation.

  1. Ah, missed that was where today was coming from. Before next committing, I think I'll make a blank local Git repo and copy the before-and-after generated files into it to double-check what is and isn't changing. I wonder if there'd be a way to automate that as part of CI...

I'm sure it could be... the question for me is whether the squeeze is worth the juice.

@HalfWhitt
Copy link
Copy Markdown
Member Author

The .ini files aren't pulled into Weblate. That's a known gap in our translation tooling at present; they have to be fixed by PR. I'm happy with a Google Translate (or equivalent - the main translation is done with DeepL) as a first pass translation.

So I go and put them in via Weblate?

I'm sure it could be... the question for me is whether the squeeze is worth the juice.

Depends on how complicated it'd be, I guess. I've found myself wishing for it pretty often during the last few PRs. I might see about just whipping up a script to automate it locally.

@HalfWhitt HalfWhitt changed the title Fix tag issues/indentation, axe Beeware plugin, update edit links Fix tag issues/indentation, axe most of Beeware plugin, update edit links Jun 15, 2025
@HalfWhitt HalfWhitt added preview Approved for an automated preview and removed preview Approved for an automated preview labels Jun 15, 2025
@HalfWhitt
Copy link
Copy Markdown
Member Author

So — if I understood correctly, databags/translate.ini is the source of truth for the English strings, but everything else is only copied there from Weblate; as such, I've reverted all changes to other languages in that file file in this PR. Let me know if that's not correct.

from lektor.pluginsystem import Plugin


class BeeWarePlugin(Plugin):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection to having this if there's no other option - but is there no pre-existing plugin that will give "today's date" as a context variable? It seems like one of those things that is so common it must exist...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may very well... That said, I've also been working, in parallel, on a plugin to provide a more convenient filter replacing our current translation macro. Might as well feed two birds with one scone.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we wasting perfectly good scones on the birds? 🤣

Did you want to roll that new plugin into this, or land this version of a vastly-minimised plugin, and replace it in the next pass?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it's much nicer than stones : )

I think it would be a much simpler PR to review (and verify nothing is out of order) if done separately.

Comment thread packages/lektor_beeware_plugin/lektor_beeware_plugin.py Outdated
Co-authored-by: John <johnzhou721@gmail.com>
@freakboy3742
Copy link
Copy Markdown
Member

The .ini files aren't pulled into Weblate. That's a known gap in our translation tooling at present; they have to be fixed by PR. I'm happy with a Google Translate (or equivalent - the main translation is done with DeepL) as a first pass translation.

So I go and put them in via Weblate?

No - they need to be done as part of the ini file. Weblate only works with .po files AFAIK, and the database translation thin is mostly a workaround for translation.

There might be a way to get the databag content into Weblate... but that's definitely a bigger project. For now, it's manual translation by way of PR.

@HalfWhitt
Copy link
Copy Markdown
Member Author

Oh, I see now. I misconstrued.

@freakboy3742
Copy link
Copy Markdown
Member

So — if I understood correctly, databags/translate.ini is the source of truth for the English strings, but everything else is only copied there from Weblate; as such, I've reverted all changes to other languages in that file file in this PR. Let me know if that's not correct.

Yes and no. There's essentially 2 sources of truth - "content", which is what comes from contents.lr, and is passed through PO files and weblate; and databag stuff, which is explicitly translated as "alternate content" in the .ini file. Ideally, every English string in the .ini file would be covered by a translated string in the ini file, but that clearly isn't happening, even for languages that have historically had good translations (like German).

So - it's not required to add translations for new English strings in the database .ini file, but it certainly doesn't hurt. There's probably space for someone to do a full audit of the current databag strings to make sure there's a base machine translation for everything - but that can be a separate PR.

Copy link
Copy Markdown
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - this is enough of an improvement that it's worth landing. There's still plenty that could be done to fill out databag translations, and potentially do the plugin additions you mentioned - but I'm happy for those changes to happen in a follow up.

@freakboy3742 freakboy3742 merged commit 8d7da1c into lektor Jun 16, 2025
@freakboy3742 freakboy3742 deleted the tags_cleanup branch June 16, 2025 01:59
@HalfWhitt
Copy link
Copy Markdown
Member Author

Ah man, I just pushed the translation commit. I'll just put it in the next PR.

@freakboy3742
Copy link
Copy Markdown
Member

Ah man, I just pushed the translation commit. I'll just put it in the next PR.

Gah - sorry!

@HalfWhitt HalfWhitt mentioned this pull request Jun 16, 2025
4 tasks
@johnzhou721
Copy link
Copy Markdown
Contributor

I'm sure it could be... the question for me is whether the squeeze is worth the juice.

Depends on how complicated it'd be, I guess. I've found myself wishing for it pretty often during the last few PRs. I might see about just whipping up a script to automate it locally.

Hi! Did you whip up this script? I think I'm in huge need of it.

@HalfWhitt
Copy link
Copy Markdown
Member Author

Hi! Did you whip up this script? I think I'm in huge need of it.

I'm afraid I didn't. I kind of hacked it — I built the code from base (or whatever I was starting from) and committed the generated site files to a brand new, empty Git repo. Then I built with my changes, replaced what was in the repo with the new results, and committed again. Then I could view the changes between them.

@johnzhou721
Copy link
Copy Markdown
Contributor

Hi! Did you whip up this script? I think I'm in huge need of it.

I'm afraid I didn't. I kind of hacked it — I built the code from base (or whatever I was starting from) and committed the generated site files to a brand new, empty Git repo. Then I built with my changes, replaced what was in the repo with the new results, and committed again. Then I could view the changes between them.

Ack.

Also quoting Dr. Keith-Magee:

So - it's not required to add translations for new English strings in the database .ini file, but it certainly doesn't hurt. There's probably space for someone to do a full audit of the current databag strings to make sure there's a base machine translation for everything - but that can be a separate PR.

Since this is mentioned here, #684 will eliminate the need for this -- it copy+pastes the databags and marks anything that need editing (explained there) with fuzzy (all done by hand), and shows that there's some mismatch between the different files, to the point where we're mixing languages like 黃金 Member at https://beeware.org/zh_TW/community/members/anaconda/.

After that PR completes, progress would be shown in Weblate, along with content translations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Approved for an automated preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin lektor-beeware-plugin may be unnecessary, needs update regardless

3 participants