Customising Portal Texts and Adding Additional Languages

This guide explains how to tailor the Portal’s interface by customising its text and adding support for additional languages. By modifying the lang.json file and configuring your deployment, you can ensure the Portal matches your organisation’s language requirements and provides a localised experience for users worldwide.

Background Information

The Portal texts can be customised by instructing the reverse proxy to serve an alternative lang.json file instead of the default one. Using the same mechanism, support for additional languages can be added.

Obtaining the default lang.json

To be able to customise lang.json, it first needs to be obtained. It can be downloaded either with your browser or using tools such as wget or curl.

Note that a lang.json corresponds to a specific Portal version. Hence, you should obtain it from the deployed version you intend to modify.

It can be obtained from the following location (adjust to your actual domain):

https://aopp-portal.yourdomain.com/static/lang.json

Customising Existing Text

Open lang.json and modify the existing text strings at will.

Adding Support for Additional Languages

Open lang.json and add new top-level object keys for the desired languages and translations for all the existing text strings. The new top-level keys need to follow the BCP 47 language tag format, e.g. "de-CH" for Swiss-German. Only then the Portal will automatically switch to the user's preferred language.

This task can be automated using one of the popular AI tools but the translations likely still need manual adjustments.

Serving the Modified lang.json Within the Reference Deployment

The diff below showcases the modifications required to serve the alternative lang.json from ./lang/lang.json, a local file that is bind-mounted into the caddy container.

diff --git a/Caddyfile b/Caddyfile
index 6c452f9..e48d37a 100644
--- a/Caddyfile
+++ b/Caddyfile
@@ -89,6 +89,12 @@ aopp-portal.yourDomain.com {
        # End user wallets need to POST their proofs to this path.
        reverse_proxy /proofs/* travel-aopd:3031

+       handle /static/lang.json {
+               root * /usr/share/caddy/lang
+               rewrite /static/lang.json /lang.json
+               file_server
+       }
+
        log
        encode gzip

diff --git a/docker-compose.yml b/docker-compose.yml
index bcd4b27..48988ac 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -162,6 +162,9 @@ services:
         container_name: caddy
         image: docker.io/library/caddy:2.10.2-alpine
         volumes:
+            - type: bind
+              source: ${PWD}/lang/
+              target: /usr/share/caddy/lang/
             - type: bind
               source: ${PWD}/graphiql/
               target: /usr/share/caddy/graphiql/