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

dtpaint builds its menus in code, so its labels are catalogued:
programs/dtpaint/dtpaint.msg (set 1, 23 messages: the six menu titles, the
items of File/Edit/View/Image/Colors/Help, the About title and the status
line), the German copy in programs/localized/de_DE.UTF-8/msg/dtpaint.msg,
built by msg.C.am and listed in the PLIST (C plain, ${PLIST.nls} for
German).  catopen/catgets itself, setlocale in main.

dtpaint has no render table (core font): a UTF-8 "ü" in the status line came
out as two latin-1 characters ("Menü"), so the German string says
"Hilfe-Menue" instead (recorded in AGENTS.md).

Measured on Xvfb (1280x800, fresh HOME, ttsession + dtwm), de_DE.UTF-8 via
localedef/LOCPATH: menus "Datei Bearbeiten Ansicht Bild Farben Hilfe",
status "Hilfe: Hilfe-Themen im Hilfe-Menue." (/tmp/opencode/dtpa-de.png);
LANG=C: "File Edit View Image Colors Help" and the English status
(/tmp/opencode/dtpa-c.png).  make mcde-linux MCDE_DIRS="install
programs/dtpaint" and "install programs/localized/C/msg" exit=0;
MCDE_DIRS=plist: "3486 installed names under dt/, 8680 in the PLISTs", ok.
This commit is contained in:
lotherk committed 2026-11-16 10:30:14 +00:00
1 parent 6a620b125a
commit c331971ddd
6 files changed
+114 -25

No files matched your search

+4 -1
View File
@@ -55,7 +55,10 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
catalog. dtphoto (`dtphoto.msg`, 5 messages: the toolbox title, the two
status lines and the open/save errors) keeps its menus as the reference's
(`dtphoto.menu`, docs/reference/photoshop-ui.csv) -- they are the look of
the program, not its sentences. A new catalog must be added to
the program, not its sentences. dtpaint builds its menus in code and its
labels are catalogued (`dtpaint.msg`, 23 messages); the program has no
render table, so its German strings avoid umlauts (a UTF-8 `ü` came out
as two latin-1 characters under the core font, 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
@@ -2781,6 +2781,7 @@ dt/lib/nls/msg/C/dtlogin.cat
dt/lib/nls/msg/C/dtlp.cat
dt/lib/nls/msg/C/dtmailopts.cat
dt/lib/nls/msg/C/dtpad.cat
dt/lib/nls/msg/C/dtpaint.cat
dt/lib/nls/msg/C/dtpdm.cat
dt/lib/nls/msg/C/dtpdmd.cat
dt/lib/nls/msg/C/dtphoto.cat
@@ -7516,6 +7517,7 @@ ${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtlogin.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtlp.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtmailopts.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtpad.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtpaint.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtpdm.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtpdmd.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtphoto.cat
+49 -23
View File
@@ -19,6 +19,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <nl_types.h>
#include <string.h>
#include <X11/Xlib.h>
@@ -37,6 +39,25 @@
#include <Xm/Separator.h>
#include <Xm/ToggleB.h>
/* dtpaint's message catalog (programs/dtpaint/dtpaint.msg, the locale's copy
* in programs/localized/<locale>/msg, under lib/nls/msg) */
static nl_catd cat = (nl_catd) -1;
static const char *
PaintMsg(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("dtpaint", NL_CAT_LOCALE);
}
if (cat == (nl_catd) -1)
return text;
return catgets(cat, 1, n, text);
}
#define PAL_COLS 14
#define PAL_ROWS 2
#define PAL_N (PAL_COLS * PAL_ROWS)
@@ -630,7 +651,7 @@ Command(Widget w, XtPointer data, XtPointer call)
XtVaSetValues(d, XmNmessageString,
XmStringCreateLocalized("dtpaint\nMCDE"),
XmNdialogTitle,
XmStringCreateLocalized("About dtpaint"), NULL);
XmStringCreateLocalized(PaintMsg(22, "About dtpaint")), NULL);
XtUnmanageChild(XmMessageBoxGetChild(d,
XmDIALOG_CANCEL_BUTTON));
XtManageChild(d);
@@ -678,6 +699,7 @@ FileDialog(int save)
XtManageChild(d);
}
static Widget
AddMenu(Widget bar, const char *name)
{
@@ -797,6 +819,10 @@ Glyph(Display *d, Pixmap p, int t)
int
main(int argc, char **argv)
{
/* before the first PaintMsg(): the catalog is opened for the locale */
(void) setlocale(LC_ALL, "");
/* the compound strings of the menus carry UTF-8 (ü in "Menü") */
XtSetLanguageProc(NULL, NULL, NULL);
XtAppContext app;
Widget menubarW;
XGCValues gv;
@@ -856,30 +882,30 @@ main(int argc, char **argv)
XtManageChild(menubarW);
{
Widget m = AddMenu(menubarW, "File");
Widget m = AddMenu(menubarW, PaintMsg(1, "File"));
AddItem(m, "New", "Ctrl<Key>N", C_NEW, 0);
AddItem(m, "Open...", "Ctrl<Key>O", C_OPEN, 0);
AddItem(m, "Save", "Ctrl<Key>S", C_SAVE, 0);
AddItem(m, "Save As...", NULL, C_SAVEAS, 0);
AddItem(m, PaintMsg(7, "New"), "Ctrl<Key>N", C_NEW, 0);
AddItem(m, PaintMsg(8, "Open..."), "Ctrl<Key>O", C_OPEN, 0);
AddItem(m, PaintMsg(9, "Save"), "Ctrl<Key>S", C_SAVE, 0);
AddItem(m, PaintMsg(10, "Save As..."), NULL, C_SAVEAS, 0);
AddItem(m, NULL, NULL, 0, 1);
AddItem(m, "Exit", "Alt<Key>F4", C_EXIT, 0);
m = AddMenu(menubarW, "Edit");
AddItem(m, "Undo", "Ctrl<Key>Z", C_UNDO, 0);
AddItem(m, PaintMsg(11, "Exit"), "Alt<Key>F4", C_EXIT, 0);
m = AddMenu(menubarW, PaintMsg(2, "Edit"));
AddItem(m, PaintMsg(12, "Undo"), "Ctrl<Key>Z", C_UNDO, 0);
AddItem(m, NULL, NULL, 0, 1);
AddItem(m, "Clear Selection", NULL, C_CLEAR, 0);
m = AddMenu(menubarW, "View");
AddItem(m, "Tool Box", "Ctrl<Key>T", C_TOOLS, 0);
AddItem(m, "Color Box", "Ctrl<Key>L", C_COLORS, 0);
AddItem(m, "Status Bar", NULL, C_STATUS, 0);
m = AddMenu(menubarW, "Image");
AddItem(m, "Flip Horizontal", NULL, C_FLIP, 0);
AddItem(m, "Invert Colors", "Ctrl<Key>I", C_INVERT, 0);
AddItem(m, "Clear Image", "Ctrl<Key>Shift<Key>N", C_CLEAR, 0);
m = AddMenu(menubarW, "Colors");
AddItem(m, "Edit Colors...", NULL, C_ABOUT, 0);
m = AddMenu(menubarW, "Help");
AddItem(m, "About dtpaint...", NULL, C_ABOUT, 0);
AddItem(m, PaintMsg(13, "Clear Selection"), NULL, C_CLEAR, 0);
m = AddMenu(menubarW, PaintMsg(3, "View"));
AddItem(m, PaintMsg(14, "Tool Box"), "Ctrl<Key>T", C_TOOLS, 0);
AddItem(m, PaintMsg(15, "Color Box"), "Ctrl<Key>L", C_COLORS, 0);
AddItem(m, PaintMsg(16, "Status Bar"), NULL, C_STATUS, 0);
m = AddMenu(menubarW, PaintMsg(4, "Image"));
AddItem(m, PaintMsg(17, "Flip Horizontal"), NULL, C_FLIP, 0);
AddItem(m, PaintMsg(18, "Invert Colors"), "Ctrl<Key>I", C_INVERT, 0);
AddItem(m, PaintMsg(19, "Clear Image"), "Ctrl<Key>Shift<Key>N", C_CLEAR, 0);
m = AddMenu(menubarW, PaintMsg(5, "Colors"));
AddItem(m, PaintMsg(20, "Edit Colors..."), NULL, C_ABOUT, 0);
m = AddMenu(menubarW, PaintMsg(6, "Help"));
AddItem(m, PaintMsg(21, "About dtpaint..."), NULL, C_ABOUT, 0);
}
form = XtVaCreateManagedWidget("form", xmFormWidgetClass, mainw,
@@ -947,7 +973,7 @@ main(int argc, char **argv)
XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM,
XmNalignment, XmALIGNMENT_BEGINNING, NULL);
XtVaSetValues(statusHelp, XmNlabelString, XmStringCreateLocalized(
"For Help, click Help Topics on the Help Menu."), NULL);
PaintMsg(23, "For Help, click Help Topics on the Help Menu.")), NULL);
statusPos = XtVaCreateManagedWidget("pos", xmLabelWidgetClass, form,
XmNbottomAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM,
XmNalignment, XmALIGNMENT_END, NULL);
+27
View File
@@ -0,0 +1,27 @@
$ MCDE dtpaint message catalog (set 1) -- English is the source; a locale's copy lives in programs/localized/<locale>/msg/dtpaint.msg.
$
$set 1
1 File
2 Edit
3 View
4 Image
5 Colors
6 Help
7 New
8 Open...
9 Save
10 Save As...
11 Exit
12 Undo
13 Clear Selection
14 Tool Box
15 Color Box
16 Status Bar
17 Flip Horizontal
18 Invert Colors
19 Clear Image
20 Edit Colors...
21 About dtpaint...
22 About dtpaint
23 For Help, click Help Topics on the Help Menu.
@@ -0,0 +1,27 @@
$ MCDE dtpaint message catalog, German.
$
$set 1
1 Datei
2 Bearbeiten
3 Ansicht
4 Bild
5 Farben
6 Hilfe
7 Neu
8 Öffnen...
9 Speichern
10 Speichern unter...
11 Beenden
12 Rückgängig
13 Auswahl aufheben
14 Werkzeuge
15 Farbpalette
16 Statusleiste
17 Horizontal spiegeln
18 Farben umkehren
19 Bild leeren
20 Farben bearbeiten...
21 Über dtpaint...
22 Über dtpaint
23 Hilfe: Hilfe-Themen im Hilfe-Menue.
+5 -1
View File
@@ -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 dtphoto.cat dttoolbox.cat dtlaunch.cat dtsystemsettings.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \
dtbar.cat dtconfig.cat dtpaint.cat dtphoto.cat dttoolbox.cat dtlaunch.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 \
@@ -129,6 +129,10 @@ dtphoto.cat: $(TOP)/dtphoto/dtphoto.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtpaint.cat: $(TOP)/dtpaint/dtpaint.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtfile.cat: $(TOP)/dtfile/dtfile.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@