Weblog
Mikel Larreategi: Multilingual Plone & Volto
Talk by Mikel Larreategi at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
In our region we have Basque, Spanish and French as languages, with different official rights. So a multilingual approach is important.
Basic options that you have in Plone are to set a default language and other available languages. then you get a language switcher at the top of the page to choose the language of the UI. This is useful when you have basic needs.
You can also activate the multilingual add-on. This gives more options for multilingual content. For each language, a folder is created automatically and the user interface is shown in the language of that folder. This is useful when you have most content in the main language and then have secondary languages.
You can force using an admin language for the UI using the https://github.com/miohtama/silvuple add-on.
You can also choose real multilingual content: link all translations, for example go to a Spanish news item, select Basque as language, and you are redirected to the Basque version of this same news item.
Of course an editor needs to create the translations of those pages. In the toolbar (Classic UI) are extra options for adding a translation or linking existing content as a translation. When editing, you can use the "babel view" to see the original language on the left and the editable language on the right.
The translated pages are not special items: a translated news item is still a news item, not something special. You can move it, rename it, workflow it, etc.
You can link to the same content in all languages: there is a multilingual link that is shown in the toolbar. In the html head of the page, there are links to the other languages. This is useful for search engines.
If as a visitor you go to a Plone multilingual site for the first time, Plone accesses the language-switcher view. This looks at the Accept-Language header, at an I18N_LANGUAGE cookie, or falls back to the default language.
There are some glitches and problems for SEO. Language change urls are not direct. Sometimes Plone keeps showing a `?set_language=XX` parameter in the url, leading to duplicately indexed content.
How about Volto? You need to configure the backend as you would do in Classic UI. In the Volto config you need to add some settings, like `isMultilingual = true`.
Can we use automatic translation? Yes, there is an integration with Google Translate. You need to get an API key for that from Google, then it is available in the babel translate view. And in Volto? You can use ecityclic.google_translate.
This can work for Spanish, but in Basque the automatic translations are not so good. There are some external services you could use. We made a pull request to improve this.
There is an add-on with which you can force an admin language in case you deal with some languages that you really can't read: https://github.com/miohtama/silvuple or its update for more recent Plone versions: https://github.com/codesyntax/cs.adminlanguage
Lightning talks Wednesday
Lightning talks on Wednesday at the Plone conference 2024 in Brasilia.
Érico Andrei: PyTour 2024
There were five Python conferences in Brazil this year. Six with this one. If you visited all of them, that is more than 12 thousand kilometers. Two heroines visited them all!
Alexander Loechel: Secure your keys
You should only use key-based authentication for accessing servers via ssh. Use ssh-fido or ssh-resident keys. Don't store them on your machines. Get hardware keys. You can check with a command if your server supports these keys.
Alin Voinea: EEA and Plone
The EEA, European Environment Agency, is using Plone since at least 2006. In 2019 we jumped into Volto, Plone 6 in 2023, this year Volto 17.
We have 74 PyPI add-ons and 119 NPM add-ons, around 400 Docker images and 900 repositories on GitHub.
EEA has a design system, see https://eea.github.io/volto-eea-design-system/. That makes them not always work with the Volto Light Theme, but talk with us and we can look.
We use generative AI with Volto-chatbot to generate answers from all our Plone sites.
Kim: Plone user guide
Plone's user guide was written for Plone Classic. We wanted an updated version for the training: https://plone.org/userguide
This was done with https://scribehow.com/, a paid service. Can export to PDF, html.
Breno Brito: Speed run coding with AI
Demo. Prompt: make a beautiful to do app with Python and Flask.
Belisa: Eu te amo, pandas
I love you, pandas. I am working with some Brazilian data in an Excel file with 188 thousand rows. I import them using pandas
and polars
and compare how they do. With polars it takes 12 seconds to import. With pandas... still busy, so let's sing some karaoke. So I love you, pandas, but...
Mikel Larreategi: Translations
Plone translations are in the plone.app.locales package: https://github.com/collective/plone.app.locales/
Most translations in Volto also come from this package. Some specific translations are in Volto itself.
In the readme of plone.app.locales you can see a graph that shows how much in your language is translated. You can clone the repo and edit, or use online Weblate: https://hosted.weblate.org/projects/plone/
The documentation is here: https://6.docs.plone.org/i18n-l10n/contributing-translations.html
Piero Nicolli: Bring your own front-end
Talk by Piero Nicolli at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
Volto is already almost ten years old. Things are moving in the frontend world.
We had a client request for something specific for tourists, with native look and feel, PWA support, multilingual, good performance and UX, accessible. Of course limited budget. It did not really need dynamic routes or the whole that Plone has to offer. But they did like to use Plone for this. But did not really look like a Volto project.
Bring your own frontend. There is Vite, but we already knew NextJS and had only short time so we went with it.
I felt it was faster for us to really start from scratch with a new layout, for this project. We used framer-motion for animated route changes. And used @plone/client, @plone/providers, @plone/components, Tailwind CSS, TypeScript.
react-aria actively helps you with accessibility, it logs warnings.
After a while they wanted dynamic routes anyway, so being able to create pages in a section of the site and they could get dynamically loaded, next to the static routes. Sure. We used @plone/registry.
What if... we would show the whole site? With the dynamic routes we were almost there anyway, we could show pages with blocks just fine.
Promise: we can run Plone in Next.JS. I am working on a template for that. Features/plan: config registry and add-ons, blocks, slots, fully dynamic routes, dynamic theme. Ideas and feedback are welcome here: https://github.com/plone/volto/pull/6442.
Thijs Feryn: Varnish caching in Plone
Talk by Thijs Feryn at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
If your website is slow or is down, you lose money. How do you solve this. Some say: throw servers/money at the problem. Yes, this can work in the short term, but mo' money, mo' servers, mo' problems.
Optimize: make it faster: your Python, javascript, css, html. At some point you hit a limit.
Use caching. That is what we will talk about. Basic idea: why would you recompute if the data has not changed.
I am tech evangelist at Varnish software. I have a colleague here at the conference who speaks Portuguese, and a German colleague who speaks Spanish. So talk to them as well if you want.
New book by me: Varnish 6 by example.
The visitor of your site first gets sent to Varnish, and this either sends the request on to Plone, or serves a previous answer from its cache. That is basically how it works.
Everything that is static is easy to cache. We listen to any cache headers that are available in the request, or set by Plone in the response.
But by default, if the request has a cookie, we do not cache. But these days every website uses cookies! So we just have to deal with them properly.
You do this using the VCL language. This is a domain-specific language for Varnish only. It is not a top-down language, it builds on other settings, and you can write extra routines for this.
Let's talk about caching in problem. Disclaimer: I am not a Plone expert.
I have setup a Plone backend and Volto frontend locally with varnish, in Docker containers.
In the cache settings:
- I see good things in here, you can enable caching.
- Very good: you can set a url for purge requests.
- A bit strange: you need to select which content types should be purged, I selected them all.
- For various sorts of contents and files you can choose strong caching, moderate, weak or terse, which sets all kinds of cache headers, even some e-tags, which is cool.
E-tags are sent on again by the browser if it requests this again. Plone then checks this e-tag and if nothing has changed, it sends back a 304 Not Modified response.
What if we could store the e-tag somewhere, then you could return very fast maybe even without contacting the framework. Maybe this happens already.
Some of the rules use a Vary header, but I wonder if the Accept header is the best here. Also, watch out for filling the cache when an attacker makes request after request with a different Accept header. In Varnish we have an `accept` module that can help here.
Cache purging: on a PURGE request we clear the cache for a url. You allow this from a white list of IP addresses. Plone purges a lot of paths, but maybe not enough. I think the `/Plone` is missing from some urls. And some urls with query parameters are not purged.
I have written a VCL for this, but not sure if that is the way to go. What about tag-based cache invalidation instead? You can do that in the VCL with `add_key`. You can also strip off query parameters.
Also, you can mark things as required, instead of actively purging it. Note that you can also serve stale content while Varnish gets a fresh answer from Plone.
Can we set the stale-while-revalidate keyword in Plone, for the Cache-Control header? That could help.
Question: should you use the varnish load balancer or a specialised load balancer like haproxy? Answer: I am biased of course, but if you are already using Varnish, just use that. We have some advanced options.
Plone is already very advanced here in how it does caching. But look at the Vary Accept header, and at tag-based caching.
Guido Stevens: Public Sector & Open Source: Natural Allies
Talk by Guido Stevens at the Plone conference 2024 in Brasilia.
Link to talk information on Plone conference website.
The worldwide Crowdstrike outage on Windows computers this year: crazy how such a thing can happen. I have better quality control than that! How resilient is our tech infrastructure?
What is the point of writing code if the world is going to pieces?
A short history of the internet revolution. The Berkeley software was started in the sixties. It grew a lot, in the nineties Web 1.0 started. Metcalfe's law: the value of each new connection increases.
Mandelbrot wrote The (mis)behavior of markets. From bell curve to power law or the long tail: a few people get very rich and most people get very poor. That happens in networked connections. People are more geared towards linear connections.
Web 2.0, in the 2000s, went from a read-only web, to a read-write web.
Trump, Brexit, Covid, they all rocked the world.
"Post-truth is pre-fascism", writes Timothy Snyder in On tyranny. You should read this.
Web 3.0 is skipped and we just have AI. AI will swamp the web with nonsense, and no one can find your content anymore.
I had higher hopes, too. I did not sign up for this dystopia. I have an MBA in environmental economics, done OSS web development for decades, am on the Plone Foundation, and founder of Quaive.
I wrote a book Systems of intent: Open source (Plone) plus knowledge management = Quaive. Quaive changes the Plone UI. It shows an activity stream, documents, news, personally configurable dashboard. It enables a shift in the company from top-down to bottom-up. Technology can also cause problems. But is technology the problem? Or is capitalism the problem? Resistance is not futile.
Chaos theory, butterfly effect: small acts can have huge effects. You and I are all complex individuals, complex systems. It is a shift from a clockwork universe to an alive universe. Emergence: on a higher level something more happens than what you can imagine looking at the lower levels.
Adrienne Maree Brown: Emergent strategy. Adaptive: constant change. Move at the speed of trust.
Principles:
- Local autonomy. Have control over your technology.
- Strive for technological excellence. Our stuff needs to be good and secure.
- Networked agility: how we cooperate and coordinate effectively.
- Community sharing: celebrate that we are not alone.
The clients that use Quaive may not be interested in our GPK license, but they do care about those principles.
Asterix: the whole of France is occupied? No, one corner not. Same now: Half of Belgium (the Walloon region) uses Plone in basically all their towns, supported by IMIO. We got into an agreement when I visited personally.
Technical detail: using Docker, IMIO was able to host 8 sites on a server where we previously could only host one site.
Think global, act local. Open source is not only free as in beer, but free as in freedom. The community makes this possible: Free as in community. Public sector and open source are natural allies.