Skip to content

akvaplan-niva/akvaplan_fresh

Repository files navigation

akvaplan_fresh

Akvaplan-niva company website

  • HTML-first multi-page web app
  • Server-side rendered in Deno Deploy
  • Bilingual, featuring translated and search-engine friendly URLs

Tech stack

Development

Start development server:

deno task dev

Set the following in .env:

mynewsdesk_key=…
deno_kv_database=…
DENO_KV_ACCESS_TOKEN=…

Intl

The app is server-rendered in one of two locales (en or no).

Locale detection

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)}?",
};

Translations

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>

Permissions

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"}'

About

Akvaplan-niva on Deno's Fresh

Topics

Resources

Stars

Watchers

Forks

Contributors