Table of Contents

Localization

To have our responses in different languages, we want to use Project Fluent (Python) as a framework in the backend.

This would imply, that we convert the official translations into `ftl` files.

l10n/
  de/
    main.ftl
  en-US/
    main.ftl

The conversion could be done in the Collector and then our Persistence Controller writes the data to our file system. For reading, writing and transforming Fluent files, there is the Fluent Syntax library.

Python Fluent code would look like this:

# initialize the loader with the locales
from fluent.runtime import FluentLocalization, FluentResourceLoader
loader = FluentResourceLoader("l10n/{locale}")
 
# we would pull all localisations in here and have one huge object in memory
l10n = FluentLocalization(["de", "en-US"], ["main.ftl"], loader) 
 
# then we can query our localisations like this
val = l10n.format_value("my-first-string")
"Fluent can be easy"

Advantages

Disadvantages