Akvaplan-niva company website
- HTML-first multi-page web app
- Server-side rendered in Deno Deploy
- Bilingual, featuring translated and search-engine friendly URLs
Start development server:
deno task devSet the following in .env:
mynewsdesk_key=…
deno_kv_database=…
DENO_KV_ACCESS_TOKEN=…The app is server-rendered in one of two locales (en or no).
For requests to / the browser's list of accepted languages is used to pick
locale (see _middleware.tsx).
Users are then redirected to either /en or /no and served the Home route.
Most routes start with a language segment, used to set the app's lang signal
for use in translation.
// routes/home.tsx
export const config: RouteConfig = {
routeOverride: "/:lang(en|no){/:page(home|hjem)}?",
};In TSX, use the translation function t to lookup a text string in the present
language.
Translations are kept in a simple (key-value) JSON file for each locale.
import { t } from "akvaplan_fresh/text/mod.ts";
<p>{
t(`some.prefix.some.key`);
}</p>Rights are set using a system, resource, email list, with permitted actions ("crud") like:
$ ./bin/kv_set '["rights","kv","panel","xyz@akvaplan.niva.no"]' '{"actions":"cru"}'