Skip to content

ratman/dashboard: Add localization (using browser language)

embr requested to merge feature/ratman-webui-i18n into develop

Issue Fix

Part of #50 (closed)

Description

Adds basic localization support to the ratmand dashboard. So far, we support English and German for the whopping 3 sentences in the UI.

The language to use is chosen based on the user's browser settings, via navigator.languages. Fallback for regional dialects (en-GB -> en) is handled automatically, but more specific locales will be used where available; this is important for languages such as Spanish and Portuguese, whose regional variations are not always easily mutually intelligible.

Missing strings in a particular language will fall back to English (in development, the missing line is replaced with an error), and will produce a build warning, which should hopefully encourage us to figure out how to source future translations.

Alternative(s) considered

We could choose not to localise the UI, but at least I would consider this an important accessibility feature; especially if we eventually want non-technical users all around the world using irdest.

We could also choose to put it off for later, but the effort needed to localise an existing UI increases exponentially with both complexity and amount of text. Introducing it early on saves a lot of effort in the long term, and prevents architectural decisions that would further complicate it, eg. un-localised string formatting on the backend

Type

Feature

Screenshots (if applicable)

Screenshot_20220407_170202

(Placeholder text quickly translated to German by @spacekookie via Matrix DM. None of these strings will likely be long for this world, so let's not spend too much time arguing about the exact translation. ^^;;)

Merge request reports