MCDE dtbar: a message catalog, German measured (t0081)

The M menu's labels come from dtbar's catalog now, the CDE way: the English
source programs/dtbar/dtbar.msg, the German copy in
programs/localized/de_DE.UTF-8/msg/dtbar.msg, both built by
programs/localized/*/msg with gencat (dtbar.cat added to msg.C.am) and
installed under lib/nls/msg/<locale>/.  catopen("dtbar", NL_CAT_LOCALE) --
the name without .cat, because NLSPATH appends %N.cat (CDE's
NLS_PATH_STRING); dtbar sets NLSPATH itself when the session has none.

Strings: About This Computer, Software Update..., Makronix Software...,
System Settings..., Favourites, Recent Items, Force Quit..., Front Panel,
Sleep, Restart..., Shut Down..., Lock Screen (set 1, messages 1-12).

Measured on Xvfb with ttsession + dtwm + dtbar, a fresh HOME, the M menu
opened with a click:
- LANG=de_DE.UTF-8 (locale generated with localedef into /tmp, LOCPATH):
  "Über diesen Computer", "Software-Aktualisierung...",
  "Systemeinstellungen...", "Favoriten", "Zuletzt verwendet", "Frontplatte",
  "Ruhezustand", "Neustart...", "Ausschalten...", "Bildschirm sperren"
  (screenshot /tmp/opencode/catalog-de.png);
- LANG=C: the English labels (/tmp/opencode/catalog-c.png), so the C
  catalog and the fallback work.
A direct check with catopen/catgets in C returns the same two strings.

make mcde-linux MCDE_DIRS="install programs/dtbar" and
"... programs/localized/C/msg" exit=0; MCDE_DIRS=plist:
"3410 installed names under dt/, 8599 in the PLISTs", ok.
This commit is contained in:
lotherk committed 2026-11-16 08:37:41 +00:00
1 parent 0fb59ccf63
commit 2c229d08c6
6 files changed
+85 -15

No files matched your search

+9 -1
View File
@@ -36,7 +36,15 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
themes (`programs/dtthemesync`, XSETTINGS daemon); MCDE is the reference.
6. **Language**: what a user sees may be translated; configuration, bindings
and the system below are English only (`Mod4<Key>`, `Shift<Key>`,
`Ctrl<Key>` in every app-defaults catalog, never translated).
`Ctrl<Key>` in every app-defaults catalog, never translated). Visible
strings come from a catalog: `programs/dtbar/dtbar.msg` (English) and the
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
`programs/localized/templates/msg.C.am` for C and to the PLIST (C plain,
a locale with `${PLIST.nls}`).
## What is in it
+2
View File
@@ -2760,6 +2760,7 @@ dt/lib/nls/msg/C/Uil.cat
dt/lib/nls/msg/C/Xm.cat
dt/lib/nls/msg/C/dt.cat
dt/lib/nls/msg/C/dtact.cat
dt/lib/nls/msg/C/dtbar.cat
dt/lib/nls/msg/C/dtbuilder.cat
dt/lib/nls/msg/C/dtcalc.cat
dt/lib/nls/msg/C/dtcm.cat
@@ -7421,6 +7422,7 @@ ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/MotifApp.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/SUNW_TOOLTALK.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dt.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtact.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtbar.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtcalc.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtcm.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtconfig.cat
+37 -13
View File
@@ -31,6 +31,8 @@
#include <X11/Shell.h>
#include <X11/Xatom.h>
#include <X11/Xmu/WinUtil.h>
#include <nl_types.h>
#include <Dt/MsgCatP.h>
#include <Xm/Xm.h>
#include <Xm/CascadeBG.h>
#include <Xm/Form.h>
@@ -474,7 +476,7 @@ EditFavourites(Widget w, XtPointer data, XtPointer call)
if ((fp = fopen(file, "a")) != NULL) {
if (ftell(fp) == 0)
fputs("# Favourites: one a line, the name, a tab, the "
"command.\n# Terminal\tdtterm\n", fp);
"command.\n# Terminal\txterm\n", fp);
fclose(fp);
}
snprintf(cmd, sizeof cmd, "dtpad '%s'", file);
@@ -618,30 +620,51 @@ LogOutLabel(char *buf, size_t len)
snprintf(buf, len, "Log Out...");
}
/* dtbar's message catalog (programs/dtbar/dtbar.msg, the locale's copy in
* programs/localized/<locale>/msg, installed under lib/nls/msg) */
static nl_catd barCatalog = (nl_catd) -1;
static const char *
BarMsg(int n, const char *text)
{
if (barCatalog == (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);
barCatalog = CATOPEN("dtbar", NL_CAT_LOCALE);
}
if (barCatalog == (nl_catd) -1)
return text;
return CATGETS(barCatalog, 1, n, text);
}
static void
MakeMMenu(void)
{
Widget menu = Pulldown(bar, "mcdeMMenu");
char logout[200];
Push(menu, "About This Computer", 'A', About, NULL);
Push(menu, "Software Update...", 'U', RunProgram, "update");
Push(menu, BarMsg(1, "About This Computer"), 'A', About, NULL);
Push(menu, BarMsg(2, "Software Update..."), 'U', RunProgram, "update");
/* the package catalogue is a task of its own (t0056): insensitive
* until it exists, as the reference's "Mac OS X Software..." */
Push(menu, "Makronix Software...", 'w', NULL, NULL);
Push(menu, BarMsg(3, "Makronix Software..."), 'w', NULL, NULL);
Separator(menu);
Push(menu, "System Settings...", 'S', RunAction, "dtsystemsettings");
Push(menu, BarMsg(4, "System Settings..."), 'S', RunAction,
"dtsystemsettings");
Separator(menu);
/* the lists are filled when the M menu opens, not when their own menu
* does: a pulldown emptied while Motif posts it closes again */
favouritesMenu = Pulldown(menu, "favourites");
(void) Cascade(menu, "Favourites", 'F', favouritesMenu);
(void) Cascade(menu, BarMsg(5, "Favourites"), 'F', favouritesMenu);
recentMenu = Pulldown(menu, "recent");
(void) Cascade(menu, "Recent Items", 'R', recentMenu);
(void) Cascade(menu, BarMsg(6, "Recent Items"), 'R', recentMenu);
XtAddCallback(menu, XmNmapCallback, FillFavourites, NULL);
XtAddCallback(menu, XmNmapCallback, FillRecent, NULL);
Separator(menu);
forceQuitItem = Push(menu, "Force Quit...", 'Q', ForceQuit, NULL);
forceQuitItem = Push(menu, BarMsg(7, "Force Quit..."), 'Q', ForceQuit,
NULL);
SetAccel(forceQuitItem, "Cmd+Option+Esc");
XtAddCallback(menu, XmNmapCallback, FillForceQuit, NULL);
Separator(menu);
@@ -649,7 +672,7 @@ MakeMMenu(void)
Widget panelMenu = Pulldown(menu, "frontPanel");
Widget item;
(void) Cascade(menu, "Front Panel", 'F', panelMenu);
(void) Cascade(menu, BarMsg(8, "Front Panel"), 'F', panelMenu);
item = Push(panelMenu, "Show or Hide", 'H', MAction,
"f.toggle_frontpanel");
SetAccel(item, "Cmd+Option+D");
@@ -657,13 +680,14 @@ MakeMMenu(void)
Push(panelMenu, "Settings...", 'E', NULL, NULL);
}
Separator(menu);
Push(menu, "Sleep", 'l', DoPower, (XtPointer) (size_t) MCDE_POWER_SLEEP);
Push(menu, "Restart...", 't', AskPower,
Push(menu, BarMsg(9, "Sleep"), 'l', DoPower,
(XtPointer) (size_t) MCDE_POWER_SLEEP);
Push(menu, BarMsg(10, "Restart..."), 't', AskPower,
(XtPointer) (size_t) MCDE_POWER_RESTART);
Push(menu, "Shut Down...", 'D', AskPower,
Push(menu, BarMsg(11, "Shut Down..."), 'D', AskPower,
(XtPointer) (size_t) MCDE_POWER_SHUTDOWN);
Separator(menu);
Push(menu, "Lock Screen", 'k', MAction, "LockDisplay");
Push(menu, BarMsg(12, "Lock Screen"), 'k', MAction, "LockDisplay");
LogOutLabel(logout, sizeof logout);
{
Widget item = Push(menu, logout, 'O', MAction, "ExitSession");
+16
View File
@@ -0,0 +1,16 @@
$ MCDE dtbar message catalog (set 1) -- English is the source; a locale's copy lives in programs/localized/<locale>/msg/dtbar.msg.
$
$set 1
1 About This Computer
2 Software Update...
3 Makronix Software...
4 System Settings...
5 Favourites
6 Recent Items
7 Force Quit...
8 Front Panel
9 Sleep
10 Restart...
11 Shut Down...
12 Lock Screen
@@ -0,0 +1,16 @@
$ MCDE dtbar message catalog, German.
$
$set 1
1 Über diesen Computer
2 Software-Aktualisierung...
3 Makronix-Software...
4 Systemeinstellungen...
5 Favoriten
6 Zuletzt verwendet
7 Sofort beenden...
8 Frontplatte
9 Ruhezustand
10 Neustart...
11 Ausschalten...
12 Bildschirm sperren
@@ -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 \
dtconfig.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \
dtbar.cat dtconfig.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 \
@@ -109,6 +109,10 @@ dtcreate.cat: $(TOP)/dtcreate/dtcreate.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtbar.cat: $(TOP)/dtbar/dtbar.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtfile.cat: $(TOP)/dtfile/dtfile.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@