Preferences
Language and theme
Switching language and theme, how each is remembered, and what is translated.
Democratia ships in English and European Portuguese, with light, dark and system themes. Both are independent: changing one never changes the other.
Switching
Both live in the account menu, at the top right — the same two controls whether or not you are signed in. Theme is a segmented light / dark / system control; language is a list with the current choice checked.
They are ordinary form posts, so each works with JavaScript disabled. The menu panel itself needs JavaScript to open, so the same two controls also sit on your account page, which is the path to them without it.
Changing either preference returns you to the page you were on.
How the language is remembered
The active language is resolved in this order, first match winning:
- Your account preference, if you are signed in.
- An explicit choice this session, for visitors without an account.
- A long-lived cookie, so that choice survives a return visit.
- The application default, English.
Because a signed-in choice lives on the account, it follows you to every device you sign in from.
URLs are not localised. /polls/abc123 is the same address in both languages, so a link works for
whoever you send it to and they see it in their own language.
What is translated
Everything a person reads: navigation, buttons, headings, empty states, validation messages, authentication messages, emails, notifications, phase names, voting method names, date descriptions, countdown labels, accessibility text and error pages.
Dates and numbers follow the language too. So do plurals — "1 opção" and "4 opções" are both correct, which needs more than appending an "s".
Two things stay in English by design: whatever anybody typed into a poll, and the technical writing kept in the repository for whoever runs the installation.
These pages are translated one at a time. Almost all of them are available in both languages. A page without a translation is shown in English with a notice saying so, and the list never shortens — every page stays reachable in every language, which is what makes translating them one by one possible. The changelog is fully translated.
How the theme is remembered
The same way: your account preference if signed in, otherwise a long-lived cookie.
Three modes:
- Light — always light.
- Dark — always dark.
- Match system — follows your operating system setting, and changes with it. This is the default.
No flash of the wrong theme
The theme is decided by the server and written into the page's opening tag, so the correct palette is in the very first byte of HTML. There is no moment at which the wrong colours could paint.
Most sites manage this with a small script that runs before the page is drawn. Democratia runs no such script: in light or dark mode the server states the choice, and in system mode it states nothing and lets your operating system setting decide.
Colour and contrast
Both themes are built from one set of named colours, so every screen exists once and is correct in either — there is no second, dimmer copy of any page waiting to drift out of step with the first.
Focus rings get the same treatment everywhere and are always visible, in both themes. Contrast was chosen against WCAG AA for body text.