function translateWithLocale(locale, key, args) {
    let translation = translations[locale][key];
    if (translation === undefined) {
        console.error("Untranslated key in ", locale, ": ", key);
        if (locale != defaultLocale) {
            translation = translations[defaultLocale][key] || key;
        } else {
            translation = key;
        }
    }

    if (typeof args === "object") {
        // Do argument substitution
        for (const arg in args) {
            translation = translation.replaceAll("{{" + arg + "}}", args[arg]);
        }
    }

    return translation;
}
@param {!string} locale name of the language to use for translation, MUST be one of the supported languages
@param {!string} key to translate
@param {!Object.<string, string>} [args] arguments to substitute into the translated key
@returns {string} translated string