MCDE dtsystemsettings: a message catalog, German measured (t0282)

Following dtbar (2c229d08c6): the categories, the panes, the window title and
"Show All" come from dtsystemsettings' catalog -- English source
programs/dtsystemsettings/dtsystemsettings.msg (set 1, messages 1-32: the
four categories, 26 panes by ID, the title, Show All), German copy in
programs/localized/de_DE.UTF-8/msg/dtsystemsettings.msg, gencat rule in
msg.C.am, PLIST C plain and ${PLIST.nls} for the German one.

main.c calls setlocale(LC_ALL, "") first: the window title is an argument of
XtVaAppInitialize, and a catalog opened while the locale was still C would
stay the C one for the whole process (measured: first attempt stayed English
in every label).

Measured on Xvfb (1280x800, fresh HOME, ttsession + dtwm), de_DE.UTF-8 via
localedef/LOCPATH: title "Systemeinstellungen", "Alle zeigen", categories
"Persönlich / Hardware / Internet & Netzwerk / System" and the panes
"Darstellung", "Schreibtisch & Bildschirmschoner", "Sprache", "Sicherheit",
"Standardprogramme", "Ton", "Bildschirme", "Tastatur & Maus", "Drucker",
"Energiesparmodus", "Internet-Konten", "Netzwerk", "Freigaben",
"Systeminformation", "Datum & Uhrzeit", "Starten", "Kindersicherung",
"Benutzer", "Software-Aktualisierung", "Sicherung", "Startvolume",
"Bedienungshilfen"; LANG=C the English labels.  make mcde-linux
MCDE_DIRS="install programs/dtsystemsettings" and "install
programs/localized/C/msg" exit=0; MCDE_DIRS=plist: "3482 installed names
under dt/, 8672 in the PLISTs", ok.
This commit is contained in:
lotherk committed 2026-11-16 09:48:19 +00:00
1 parent 644d4ddebd
commit 89e41554e6
6 files changed
+166 -14

No files matched your search

+6 -2
View File
@@ -41,8 +41,12 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
locale's copy in `programs/localized/<locale>/msg/`, built by
`programs/localized/*/msg` with gencat and opened by
`catopen("dtbar", NL_CAT_LOCALE)` -- the name without `.cat`, NLSPATH
carries `%L/%N.cat` (dtbar sets it when the session has none). dtbar is
the pattern for the MCDE programs; a catalog must be added to
carries `%L/%N.cat` (dtbar sets it when the session has none).
dtsystemsettings does the same for its categories, panes and the window
title (`dtsystemsettings.msg`, 32 messages); it calls `setlocale` before
its first message, because the window title is already an argument of
`XtVaAppInitialize` and a catalog opened then would stay the C one
(measured 2026-11-16). A new catalog must be added to
`programs/localized/templates/msg.C.am` for C and to the PLIST (C plain,
a locale with `${PLIST.nls}`).
+2
View File
@@ -2787,6 +2787,7 @@ dt/lib/nls/msg/C/dtscreen.cat
dt/lib/nls/msg/C/dtsearch.cat
dt/lib/nls/msg/C/dtsession.cat
dt/lib/nls/msg/C/dtstyle.cat
dt/lib/nls/msg/C/dtsystemsettings.cat
dt/lib/nls/msg/C/dtterm.cat
dt/lib/nls/msg/C/dttypes.cat
dt/lib/nls/msg/C/dtudcexch.cat
@@ -7518,6 +7519,7 @@ ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtscreen.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtsearch.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtsession.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtstyle.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtsystemsettings.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtterm.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dttypes.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtudcexch.cat
@@ -0,0 +1,36 @@
$ MCDE dtsystemsettings message catalog (set 1): the categories and the panes. English is the source; a locale's copy lives in programs/localized/<locale>/msg/dtsystemsettings.msg.
$
$set 1
1 Personal
2 Hardware
3 Internet & Network
4 System
5 Appearance
6 Desktop & Screen Saver
7 Language
8 Dock
9 Security
10 Default Programs
11 Sound
12 Displays
13 Keyboard & Mouse
14 Printers
15 Bluetooth
16 CDs & DVDs
17 Energy Saver
18 Internet Accounts
19 Network
20 Sharing
21 System Information
22 Date & Time
23 Startup
24 Parental Controls
25 Accounts
26 Software Update
27 Backup
28 Startup Disk
29 Accessibility
30 About
31 System Settings
32 Show All
+81 -11
View File
@@ -42,6 +42,9 @@
#include <math.h>
#include <stdlib.h>
#include <Dt/Dt.h>
#include <locale.h>
#include <nl_types.h>
#include <Dt/MsgCatP.h>
#include <Mcde/McdeSys.h>
#include <dirent.h>
@@ -53,6 +56,68 @@
#include "ui.h"
XtAppContext app;
/* dtsystemsettings' message catalog (programs/dtsystemsettings/
* dtsystemsettings.msg, the locale's copy in programs/localized/<locale>/msg,
* installed under lib/nls/msg): the categories and the panes */
static nl_catd cat = (nl_catd) -1;
static const char *
Msg(int n, const char *text)
{
if (cat == (nl_catd) -1) {
if (getenv("NLSPATH") == NULL)
(void) setenv("NLSPATH", CDE_INSTALLATION_TOP
"/lib/nls/msg/%L/%N.cat:" CDE_INSTALLATION_TOP
"/lib/nls/msg/C/%N.cat", 0);
cat = CATOPEN("dtsystemsettings", NL_CAT_LOCALE);
}
if (cat == (nl_catd) -1)
return text;
return CATGETS(cat, 1, n, text);
}
/* the message number of a pane (set 1, 5..30), the categories 1..4 and the
* window title 31; the IDs are stable, the labels are the English source */
static int
PaneMsg(const Pane *p)
{
static const struct {
const char *id;
int msg;
} ids[] = {
{ "appearance", 5 }, { "desktop", 6 }, { "language", 7 },
{ "dock", 8 }, { "security", 9 }, { "defaults", 10 },
{ "sound", 11 }, { "displays", 12 }, { "keyboardmouse", 13 },
{ "printers", 14 }, { "bluetooth", 15 }, { "cds", 16 },
{ "energy", 17 }, { "internet", 18 }, { "network", 19 },
{ "sharing", 20 }, { "sysinfo", 21 }, { "datetime", 22 },
{ "startup", 23 }, { "parental", 24 }, { "accounts", 25 },
{ "update", 26 }, { "backup", 27 }, { "startupdisk", 28 },
{ "accessibility", 29 }, { "about", 30 },
};
size_t i;
for (i = 0; i < sizeof ids / sizeof ids[0]; i++)
if (strcmp(p->id, ids[i].id) == 0)
return ids[i].msg;
return 0;
}
static const char *
PaneLabel(const Pane *p)
{
int n = PaneMsg(p);
return n > 0 ? Msg(n, p->label) : p->label;
}
static const char *
CatName(int c)
{
return c >= 0 && c < CAT_COUNT ? Msg(1 + c, categoryNames[c]) :
categoryNames[0];
}
static Widget shell, title, showAll, overview, paneArea, current;
static Widget backBtn, forwardBtn, searchField;
static Widget ovButton[64], ovLabel[64]; /* the overview's items */
@@ -1019,8 +1084,8 @@ ShowOverview(void)
shown = NULL;
XtUnmanageChild(paneArea);
XtManageChild(overview);
SetText(title, "System Settings");
XtVaSetValues(shell, XmNtitle, "System Settings", NULL);
SetText(title, Msg(31, "System Settings"));
XtVaSetValues(shell, XmNtitle, Msg(31, "System Settings"), NULL);
XtSetSensitive(showAll, False);
}
@@ -1127,8 +1192,8 @@ ShowPane(const Pane *p)
XtManageChild(w);
XtUnmanageChild(overview);
XtManageChild(paneArea);
SetText(title, p->label);
XtVaSetValues(shell, XmNtitle, p->label, NULL);
SetText(title, PaneLabel(p));
XtVaSetValues(shell, XmNtitle, PaneLabel(p), NULL);
XtSetSensitive(showAll, True);
}
@@ -1165,7 +1230,7 @@ MakeOverview(Widget parent)
box, XmNshadowType, XmSHADOW_ETCHED_IN, NULL);
inner = XtVaCreateManagedWidget("inner", xmRowColumnWidgetClass,
band, XmNspacing, 2, NULL);
l = Text(inner, "name", categoryNames[c]);
l = Text(inner, "name", CatName(c));
XtVaSetValues(l, XmNrenderTable, bold, NULL);
row = XtVaCreateManagedWidget("panes", xmRowColumnWidgetClass,
inner, XmNorientation, XmHORIZONTAL, XmNspacing, 8, NULL);
@@ -1187,7 +1252,7 @@ MakeOverview(Widget parent)
XmNlabelPixmap, Icon(row, p->icon),
XmNshadowThickness, 0, XmNrecomputeSize, False,
XmNwidth, 112, XmNheight, 44, NULL);
l = Text(item, "label", p->label);
l = Text(item, "label", PaneLabel(p));
XtVaSetValues(l, XmNalignment, XmALIGNMENT_CENTER, NULL);
ovButton[i] = b;
ovLabel[i] = l;
@@ -1324,8 +1389,8 @@ ListPanesCommand(void)
if (p->kind == PANE_LATER)
continue;
printf("%s\t%s\t%s\t%s\n", p->id, p->label,
categoryNames[p->category], p->keywords ? p->keywords : "");
printf("%s\t%s\t%s\t%s\n", p->id, PaneLabel(p),
CatName(p->category), p->keywords ? p->keywords : "");
}
return 0;
}
@@ -1377,6 +1442,10 @@ main(int argc, char **argv)
const char *start = NULL;
int i;
/* before the first Msg: the catalog is opened for the locale, and the
* window title is already an argument of XtVaAppInitialize */
(void) setlocale(LC_ALL, "");
/* the action of a web page (programs/types, McdeWeb) starts no window
* and needs no display: done before Xt is set up */
for (i = 1; i + 1 < argc; i++)
@@ -1391,7 +1460,8 @@ main(int argc, char **argv)
XtSetLanguageProc(NULL, NULL, NULL);
shell = XtVaAppInitialize(&app, "Dtsystemsettings", NULL, 0, &argc,
argv, (String *) fallback, XmNtitle, "System Settings", NULL);
argv, (String *) fallback, XmNtitle, Msg(31, "System Settings"),
NULL);
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-pane") == 0 && i + 1 < argc)
start = argv[++i];
@@ -1451,8 +1521,8 @@ main(int argc, char **argv)
XtSetSensitive(backBtn, False);
forwardBtn = Button(bar, ">", ForwardClicked, NULL);
XtSetSensitive(forwardBtn, False);
showAll = Button(bar, "Show All", ShowAllClicked, NULL);
title = Text(bar, "title", "System Settings");
showAll = Button(bar, Msg(32, "Show All"), ShowAllClicked, NULL);
title = Text(bar, "title", Msg(31, "System Settings"));
XtVaSetValues(title, XmNrenderTable, PaneFont(bar, 12, True), NULL);
(void) Text(bar, "searchLabel", "Search:");
searchField = XtVaCreateManagedWidget("search", xmTextFieldWidgetClass,
@@ -0,0 +1,36 @@
$ MCDE dtsystemsettings message catalog, German.
$
$set 1
1 Persönlich
2 Hardware
3 Internet & Netzwerk
4 System
5 Darstellung
6 Schreibtisch & Bildschirmschoner
7 Sprache
8 Dock
9 Sicherheit
10 Standardprogramme
11 Ton
12 Bildschirme
13 Tastatur & Maus
14 Drucker
15 Bluetooth
16 CDs & DVDs
17 Energiesparmodus
18 Internet-Konten
19 Netzwerk
20 Freigaben
21 Systeminformation
22 Datum & Uhrzeit
23 Starten
24 Kindersicherung
25 Benutzer
26 Software-Aktualisierung
27 Sicherung
28 Startvolume
29 Bedienungshilfen
30 Über diesen Rechner
31 Systemeinstellungen
32 Alle zeigen
@@ -5,7 +5,7 @@
BUILT_SOURCES = Xm.cat Mrm.cat Uil.cat DtHelp.cat DtMail.cat \
DtPrint.cat DtWidget.cat MotifApp.cat SUNW_TOOLTALK.cat dt.cat \
dtact.cat dtbuilder.cat dtcalc.cat dtcm.cat dtcodegen.cat \
dtbar.cat dtconfig.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \
dtbar.cat dtconfig.cat dtsystemsettings.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \
dthelpgen.cat dthelpprint.cat dticon.cat dtimsstart.cat \
dtlogin.cat dtlp.cat dtmailopts.cat dtpad.cat \
dtpdm.cat dtpdmd.cat dtprintinfo.cat dtscreen.cat dtsearch.cat \
@@ -113,6 +113,10 @@ dtbar.cat: $(TOP)/dtbar/dtbar.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtsystemsettings.cat: $(TOP)/dtsystemsettings/dtsystemsettings.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtfile.cat: $(TOP)/dtfile/dtfile.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@