#ifndef DECK_I18N_H
#define DECK_I18N_H

#include <stdbool.h>

/* Loads a `key=value` translation file (# comments and blank lines
 * ignored, same format as dist/user.properties) into a process-global
 * catalog, replacing whatever was loaded before. Returns false if the
 * file can't be opened (the catalog is left as it was in that case).
 *
 * This uses stdio, so - like main.c and reading_print_text/_html - it's
 * a desktop-only entry point, not something the Pebble watchapp will
 * call as-is. i18n_get() below is a pure table lookup, so it's fine to
 * port; the watchapp will just need its own (non-file-based) way to
 * populate the catalog, e.g. from a compiled-in resource. */
bool i18n_load(const char *path);

/* Returns the translation for `key` from the loaded catalog, or
 * `fallback` if no catalog is loaded or `key` isn't in it. Every caller
 * in this codebase passes the built-in English text as `fallback`, so a
 * missing file or a partially-translated one degrades to English rather
 * than showing raw keys or blank strings. */
const char *i18n_get(const char *key, const char *fallback);

#endif
