Skip to content

Conversation

@kattni
Copy link
Contributor

@kattni kattni commented May 29, 2025

Prepares website for switch to Weblate for translations. Includes the following changes:

  • Configuration files added for i18n plugin.
  • Generated .po and .pot translation files added.
  • Updated BeeWare.lektorproject to include Lektor management of installing i18n plugin.
  • Removed existing translation files.
  • Updated .gitignore to ignore generated language files.

Refs #634

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

@freakboy3742 freakboy3742 added preview Approved for an automated preview and removed preview Approved for an automated preview labels May 29, 2025
@freakboy3742 freakboy3742 added preview Approved for an automated preview and removed preview Approved for an automated preview labels May 29, 2025
@github-actions
Copy link

github-actions bot commented May 29, 2025

Visit the preview URL for this PR (updated for commit 014343a):

https://beeware-org--pr637-switch-to-weblate-68en8zz8.web.app

(expires Thu, 05 Jun 2025 23:47:53 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: b0da44bc067e7d9a4255c77cb2c5fce572218cec

@freakboy3742
Copy link
Member

I've run the .po files through DeepL to generate initial translations; however, the preview site isn't showing them. It's definitely hitting the plugin (I needed to do some poking to get gettext into the build environment)... but the .po content isn't being rendered on the .lr pages.

@freakboy3742
Copy link
Member

Another thing that just occurred to me - there's a bunch of code on the site (driven by the beeware plugin) that identifies if a translated page is out of date. That code is no longer needed (or, at least, needs to be substantially reworked to be accurate). I think we might be able to drop the beeware plugin entirely...

@kattni
Copy link
Contributor Author

kattni commented May 29, 2025

I've run the .po files through DeepL to generate initial translations; however, the preview site isn't showing them. It's definitely hitting the plugin (I needed to do some poking to get gettext into the build environment)... but the .po content isn't being rendered on the .lr pages.

So.... remember that lektor clean command you have never used? Yeah. Lektor is ... caching I guess?... the original version generated on the first run. I am successfully getting it to render locally with the following incantation:

  1. lektor server - This is the first run to generate the .po files and the initial contents+xx.lr files. (So this would only be necessary once; I included it to make sure everything was actually working as intended.)
  2. Translate a string in the contents+fr.po file.
  3. lektor clean
  4. lektor server - Builds the site "fresh", and successfully renders the updated string.
  5. Translate a second string in the contents+fr.po file.
  6. lektor clean
  7. lektor server - Successfully renders the updated string.

So! It looks like the current preview sequence is clean > build. I believe the sequence needs to be clean > build > clean > build. Basically, if the first clean was necessary to begin with, we'll have to keep it present. I considered submitting the update myself, but I realised I don't really know GitHub workflows, and decided that it might be a waste of your time if I'm doing it wrong, so I'll leave that to you.

I think, ultimately, the publish sequence may need to be updated as well. However, we can cross that bridge when we get to it.

It's certainly going to add some time to the build and preview processes, but if this is how it needs to happen, I suppose we deal with it. It's not something that's happening every few minutes or anything, typically, so I suppose it's fine?

My excellent French skills at work:
rendered-translations

@kattni
Copy link
Contributor Author

kattni commented May 29, 2025

Another thing that just occurred to me - there's a bunch of code on the site (driven by the beeware plugin) that identifies if a translated page is out of date. That code is no longer needed (or, at least, needs to be substantially reworked to be accurate). I think we might be able to drop the beeware plugin entirely...

Unless this is causing issues with the current translation setup (I have no idea if it's part of the problem), I think this should be filed as an issue and bumped to a future fix.

@freakboy3742 freakboy3742 added preview Approved for an automated preview and removed preview Approved for an automated preview labels May 29, 2025
@freakboy3742 freakboy3742 added preview Approved for an automated preview and removed preview Approved for an automated preview labels May 29, 2025
@kattni
Copy link
Contributor Author

kattni commented May 29, 2025

For posterity:

It turns out the double clean>build is necessary when running lektor server, but is not necessary when running lektor build.

Copy link
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.

(sweating intensifies)

@freakboy3742 freakboy3742 merged commit 0ab105d into beeware:lektor May 29, 2025
2 checks passed
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.

2 participants