Files
lotherk f46a914c73 dtchat: add the message catalog and the German UI (T10.4)
i18n.c opens catopen("dtchat", NL_CAT_LOCALE) and dc_text(id, fallback) reads set 1; the program calls dc_i18n_init after setlocale. The visible labels of the main window, the account editor, the request/peer/file/pair dialogs and the local status texts use ui_text.h ids; dtchat.msg (English) has 75 entries and programs/localized/de_DE.UTF-8/msg/dtchat.msg the German copy (ASCII transliteration, core font). test_i18n builds both catalogs with gencat and checks File/Datei, Send/Senden and the fallback; the German run under Xvfb shows Datei/Bearbeiten/Ansicht/Konversation/Hilfe, In der Naehe and Senden (screenshot build/mcde-shots/dtchat-t104-de.png) and the smoke stays green. Dynamic formatted statuses are partly still English. The in-tree build is pending: a foreign release chain holds the lock (pid 141722).
2026-11-17 07:06:55 +00:00

36 lines
608 B
C

/*
* i18n.c -- the dtchat message catalog
*
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
*/
#include "dc_internal.h"
#include <nl_types.h>
static nl_catd catalog = (nl_catd)-1;
void
dc_i18n_init(void)
{
catalog = catopen("dtchat", NL_CAT_LOCALE);
}
void
dc_i18n_close(void)
{
if (catalog != (nl_catd)-1)
(void)catclose(catalog);
catalog = (nl_catd)-1;
}
const char *
dc_text(int id, const char *fallback)
{
const char *text;
if (catalog == (nl_catd)-1)
return fallback;
text = catgets(catalog, 1, id, fallback);
return text != NULL ? text : fallback;
}