Skip to content

Migrate i18n Subsites plugin to own repository#1

Merged
justinmayer merged 35 commits intomainfrom
migrate
May 26, 2025
Merged

Migrate i18n Subsites plugin to own repository#1
justinmayer merged 35 commits intomainfrom
migrate

Conversation

@frederik-elwert
Copy link
Collaborator

Migrate plugin to namespace format.

smartass101 and others added 26 commits January 31, 2014 10:06
This plugin extends the translations functionality by creating i8n-ized
sub-sites for the default site.
This commit implements the basic generation functionality.
this commit introduces optional support for translatable templates
this commit removes the need to make a dummy translation for
the language in which the templates are written.
This only affects themes using jinja2.ext.i18n.
The I18N_THEMES_LANG is introduced to address this issue.

Also expanded the docs for making gettext .po files with babel.
1. was removing items of an active iterator -> only first worked
2. Article inherits Page, so first check if is Article
1. main site url root fix
2. support autoreload mode
Also removed trailing slash on dir name.
Also needed for LOCALE overrides, etc.
- the new variable makes it easier to implement language buttons
- a short howto on language buttons is also provided
- the dictionary mapping template vars are now OrderedDict
  for consistent-looking language buttons
Major highlights
................
- fixed and improved cross-linking (fixes #333) with URLs
  containing e.g. localized month names
  (thanks to issue getpelican/pelican#1198)
- support for custom ``SITEURL`` and ``OUTPUT_PATH`` hierarchy
  (fixes #182)
- sharing of static files (including those of the theme) among
  subsites (fixes #180)

Technical highlights
....................
- added a test suite (works with pelican 3.4)
- translations are installed into Jinja2 environments of all
  generators
- old locale is restored after generation, fixes autoreload

The documentation has been updated and improved (mostly in terms of
formatting).

Known issues
............
- due to the redesign required for correct cross-linking, older
  versions of Pelican (<3.4) are not supported, because they lack
  certain signals
- the ``HIDE_UNTRANSLATED_CONTENT`` setting has been deprecated in
  favor of the ``I18N_UNTRANSLATED_{ARTICLES,PAGES}`` settings which
  offer more control in order to fix #211.
- the test suite works only with pelican 3.4, later versions add a
  timezone field to the date
added 404 test pages for this case
…INJA_ENVIRONMENT

Plugins that were affected:
- assets
- i18n_subsites
- jinja2content
The plugin calls for the extension for the command “gettext” and
doesn’t write the text without it.
Draft is removed in pelican 4+. Import Article as Draft instead
JINJA_ENVIRONMENT replace JINJA_EXTENSIONS. It was changed in the
example codes but not in the how to localize templates with Jinja2.
@frederik-elwert
Copy link
Collaborator Author

I see the tests fail on the GitHub CI, while they work on my machine. I have an idea what might be causing this, let me investigate.

@justinmayer justinmayer changed the title Migrate Migrate i18n Subsites plugin to own repository May 14, 2025
@justinmayer justinmayer changed the title Migrate i18n Subsites plugin to own repository Migrate i18n Subsites plugin to own repository May 14, 2025
@frederik-elwert
Copy link
Collaborator Author

Okay, the GitHub CI was missing the German locale that is used in the tests. I updated the CI config to fix this. Now the tests pass and the code should be ready to merge. Any feedback appreciated!

@justinmayer
Copy link
Contributor

Looks good to me. The last thing we need to proceed is the aforementioned access to the PyPI project. I sent a follow-up message to the relevant person. If we do not hear back within a reasonable amount of time, we can consider whether we want to rename this project, in which case a few more changes will be required.

@rschiang
Copy link

Hi, the publisher of the PyPI project here! I’d like to thank the core team for finally giving this feature a dedicated home. 🎉

The package currently published on PyPI (source) was a fork spun off from the discussion of getpelican/pelican-plugins#1349, merging some of the much-needed revamps at the time. I’m more than happy to renounce package name ownership (invitation sent!), but I’d also like to suggest revisiting some of these old PRs after this lands.

Thanks again to @justinmayer, @frederik-elwert and the amazing Pelican team. Please lemme know if I can be of any help!

Copy link
Contributor

@justinmayer justinmayer left a comment

Choose a reason for hiding this comment

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

Many thanks to @frederik-elwert for assisting with the migration and to @rschiang for helping us connect to the PyPI project.

If all goes well, version 1.0 should automatically be published when this pull request is merged. Then, as Poren suggested, we can take a look at pre-existing work in his repository and see what might make sense to integrate here in the form of follow-up PRs and releases.

Once again, thank you — much appreciated! 🥇

@justinmayer justinmayer merged commit 5c0711e into main May 26, 2025
14 checks passed
@justinmayer justinmayer deleted the migrate branch May 26, 2025 19:14
@justinmayer
Copy link
Contributor

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.