Close

Naive localization

A project log for 3615 SSH

Retro-future, here we go! Using the minitel as a terminal for an ESP32 SSH client

julien-bellueJulien Bellue 01/14/2022 at 14:130 Comments

I've finally added some localization. I started writing all the strings in French, because it's running on a minitel, and having it display anything else felt like a betrayal.

I finally took the time to add a localization class, that handles English, French and Spanish. The spanish translation could use some checking by a native, but there's no rush now (also, the minitel can't display the "ñ" character, which looks odd).

Basically, all I have is an enum with the strings index, and a 2D array of strings to display :

enum Languages {
    ENGLISH,
    FRENCH,
    SPANISH,

    LANGUAGES_LAST
};
enum L10N_STRINGS {
    SSH_PAGE_TITLE,
    SSH_PAGE_HOST,
    [...]
    L10N_LAST_STRING
};

String languageStore[L10N_LAST_STRING][LANGUAGES_LAST] = {
    { "3615 SSH client", "3615 SSH client", "3615 SSH client" },
    { "Host:",           "Hôte :",          "Servidor:"       },
    [...]
};

The implementation is contained in a single header file, and is super simple to use. It doesn't  have all the bells and whitles of more complete solutions, but it's simple and more than enough for my needs.

Discussions