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

dtphoto's own sentences and titles come from programs/dtphoto/dtphoto.msg
(set 1, 5 messages: the toolbox window title "Tools", the status line
"Scratch: 1.2M/50M", the "Doc: %dK/%dK" format, the open and the save
error), the German copy in programs/localized/de_DE.UTF-8/msg/dtphoto.msg,
built by msg.C.am and listed in the PLIST (C plain, ${PLIST.nls} for
German).  Like dtlaunch it calls catopen/catgets itself and setlocale in
main before its first message.

The menus stay as they are: dtphoto.menu follows
docs/reference/photoshop-ui.csv -- the programme's look -- and the command
lookup matches those English labels, so they are not a catalog.

Measured on Xvfb (1280x800, fresh HOME, ttsession + dtwm), de_DE.UTF-8 via
localedef/LOCPATH: the toolbox is titled "Werkzeuge", the status line reads
"Dok: 225K/1125K" and "Arbeitsspeicher: 1.2M/50M" (/tmp/opencode/dtp-de.png);
LANG=C: "Tools", "Doc: 225K/1125K", "Scratch: 1.2M/50M"
(/tmp/opencode/dtp-c.png).  make mcde-linux MCDE_DIRS="install
programs/dtphoto" and "install programs/localized/C/msg" exit=0;
MCDE_DIRS=plist: "3485 installed names under dt/, 8678 in the PLISTs", ok.
This commit is contained in:
lotherk committed 2026-11-16 10:18:17 +00:00
1 parent 121fab6753
commit 6a620b125a
6 files changed
+60 -7

No files matched your search

+4 -1
View File
@@ -52,7 +52,10 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
messages: the window title and the "no menu" label) does the same and
calls `setlocale` in main before its first message; the menu labels
themselves come from the person's chestrc, which is their file, not a
catalog. A new catalog must be added to
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
`programs/localized/templates/msg.C.am` for C and to the PLIST (C plain,
a locale with `${PLIST.nls}`).
+2
View File
@@ -2783,6 +2783,7 @@ dt/lib/nls/msg/C/dtmailopts.cat
dt/lib/nls/msg/C/dtpad.cat
dt/lib/nls/msg/C/dtpdm.cat
dt/lib/nls/msg/C/dtpdmd.cat
dt/lib/nls/msg/C/dtphoto.cat
dt/lib/nls/msg/C/dtprintinfo.cat
dt/lib/nls/msg/C/dtscreen.cat
dt/lib/nls/msg/C/dtsearch.cat
@@ -7517,6 +7518,7 @@ ${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/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
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtprintinfo.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtscreen.cat
${PLIST.nls}dt/lib/nls/msg/de_DE.UTF-8/dtsearch.cat
+31 -5
View File
@@ -17,6 +17,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <nl_types.h>
#include <string.h>
#include <X11/Xlib.h>
@@ -386,6 +388,27 @@ MakeAccel(const char *key, char *out, size_t size)
static void MenuCallback(Widget w, XtPointer data, XtPointer call);
/* dtphoto's message catalog (programs/dtphoto/dtphoto.msg, the locale's
* copy in programs/localized/<locale>/msg, under lib/nls/msg). The menus
* stay as the reference's (dtphoto.menu, docs/reference/photoshop-ui.csv):
* they are the look of the program, not its sentences. */
static nl_catd cat = (nl_catd) -1;
static const char *
Tr(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("dtphoto", NL_CAT_LOCALE);
}
if (cat == (nl_catd) -1)
return text;
return catgets(cat, 1, n, text);
}
static Widget
BuildMenu(Widget parent, Menu *m)
{
@@ -454,7 +477,8 @@ UpdateStatus(void)
snprintf(buf, sizeof buf, "%d%%", zoom);
XtVaSetValues(statusZoom, XmNlabelString,
XmStringCreateLocalized(buf), NULL);
snprintf(buf, sizeof buf, "Doc: %dK/%dK", docW * docH * 3 / 1024,
snprintf(buf, sizeof buf, Tr(3, "Doc: %dK/%dK"),
docW * docH * 3 / 1024,
docW * docH * 3 / 1024 + 900);
XtVaSetValues(statusDoc, XmNlabelString,
XmStringCreateLocalized(buf), NULL);
@@ -976,8 +1000,8 @@ FileOk(Widget w, XtPointer data, XtPointer call)
XtVaSetValues(d, XmNmessageString,
XmStringCreateLocalized(save ?
"The picture could not be saved." :
"The picture could not be opened."), NULL);
Tr(5, "The picture could not be saved.") :
Tr(4, "The picture could not be opened.")), NULL);
XtUnmanageChild(XmMessageBoxGetChild(d,
XmDIALOG_CANCEL_BUTTON));
XtManageChild(d);
@@ -1094,6 +1118,8 @@ MenuCallback(Widget w, XtPointer data, XtPointer call)
int
main(int argc, char **argv)
{
/* before the first Tr(): the catalog is opened for the locale */
(void) setlocale(LC_ALL, "");
XtAppContext app;
Widget mainw, menubar, form;
char path[512];
@@ -1162,13 +1188,13 @@ main(int argc, char **argv)
XmATTACH_FORM, XmNalignment, XmALIGNMENT_END, XmNrecomputeSize,
False, XmNwidth, 220, NULL);
XtVaSetValues(statusScratch, XmNlabelString,
XmStringCreateLocalized("Scratch: 1.2M/50M"), NULL);
XmStringCreateLocalized(Tr(2, "Scratch: 1.2M/50M")), NULL);
XtVaSetValues(top, XmNtitle, "dtphoto", NULL);
XtRealizeWidget(top);
toolShell = XtVaAppCreateShell("tools", "Dtphoto",
topLevelShellWidgetClass, dpy, XmNtitle, "Tools",
topLevelShellWidgetClass, dpy, XmNtitle, Tr(1, "Tools"),
XmNallowShellResize, True, XmNx, 8, XmNy, 64, NULL);
BuildToolbox(toolShell, dpy);
XtRealizeWidget(toolShell);
+9
View File
@@ -0,0 +1,9 @@
$ MCDE dtphoto message catalog (set 1) -- English is the source; a locale's copy lives in programs/localized/<locale>/msg/dtphoto.msg. The menus stay as the reference's (dtphoto.menu).
$
$set 1
1 Tools
2 Scratch: 1.2M/50M
3 Doc: %dK/%dK
4 The picture could not be opened.
5 The picture could not be saved.
@@ -0,0 +1,9 @@
$ MCDE dtphoto message catalog, German.
$
$set 1
1 Werkzeuge
2 Arbeitsspeicher: 1.2M/50M
3 Dok: %dK/%dK
4 Das Bild konnte nicht geöffnet werden.
5 Das Bild konnte nicht gespeichert werden.
+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 dttoolbox.cat dtlaunch.cat dtsystemsettings.cat dtcopy.cat dtcreate.cat dtfile.cat dthello.cat \
dtbar.cat dtconfig.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 \
@@ -125,6 +125,10 @@ dttoolbox.cat: $(TOP)/dttoolbox/dttoolbox.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtphoto.cat: $(TOP)/dtphoto/dtphoto.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@
dtfile.cat: $(TOP)/dtfile/dtfile.msg
$(RM) $@
LANG=C $(GENCAT) $@ $^ || $(RM) $@