From db3848b5a33d8a20598eb0b0b74059349f2f2095 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sat, 24 Oct 2026 09:10:16 +0200 Subject: [PATCH] feat: ship translated catalogs in the release archives and installer Release archives get Catalogs/ with every translation compiled by FlexCat (catalogs/catalogs.sh, 'make catalogs'). The installer asks which languages to install and copies them to LOCALE:Catalogs/. CI compiles the catalogs in the os3 image for the AROS targets, whose images have no FlexCat. --- .github/workflows/makefile.yml | 8 + .gitignore | 1 + ChangeLog | 21 ++ README.md | 14 +- archive/installer/Install DOpus5 | 79 +++++- .../tests/test_basedata_default_drawers.py | 24 ++ catalogs/Makefile | 246 ------------------ catalogs/catalogs.sh | 144 ++++++++++ documents/DOpus5.guide | 13 +- source/makefile | 24 +- 10 files changed, 320 insertions(+), 254 deletions(-) delete mode 100644 catalogs/Makefile create mode 100755 catalogs/catalogs.sh diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 60706e0b..f98eb9a4 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -88,6 +88,14 @@ jobs: steps: - uses: actions/checkout@v6 + # The AROS images have no FlexCat; compile the catalogs (the same files + # for every target) in the os3 image, so release-package finds them up + # to date. + - name: Build catalogs (${{ matrix.platform.name }}) + if: endsWith(matrix.platform.name, '-aros') + run: | + docker run --rm -v ${{ github.workspace }}:/work sacredbanana/amiga-compiler@sha256:7fa7056330ce0e7b31b5e497070b3380b4f672d7d6f169ac5b3003c1af483215 sh -c "cd /work/source && make ${{ matrix.platform.name }} catalogs" + - name: Build (${{ matrix.platform.name }} ${{ matrix.variant.name }}) run: | docker run --rm -v ${{ github.workspace }}:/work ${{ matrix.platform.image }} sh -c "cd /work/source && make ${{ matrix.platform.name }} all ${{ matrix.variant.flags }}" diff --git a/.gitignore b/.gitignore index 458d152d..30fb948a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ local-notes/ notes/ source/Modules/ftp/third_party/libssh2/build/ __pycache__/ +catalogs/bin/ diff --git a/ChangeLog b/ChangeLog index 649f0113..60ed277e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +[dopus5 next] Release archives carry the translated catalogs +Release packaging and installer change; version bump deferred. + +- The release archives have Catalogs/ with the compiled + catalogs of every translation (deutsch, español, français, greek, + italiano, magyar, nederlands, norsk, polski, português, svenska). + Earlier releases had none, so Opus ran in English unless catalogs + were installed by hand. +- The installer asks which translations to install, preselecting the + language it runs in and the languages already installed, and copies + them to LOCALE:Catalogs/. Not to DOpus5:Catalogs: + dopus5.library opens its catalog in the first program that opens + the library, often DOpus5:C/LoadDB or LoadDOpusLib, whose PROGDIR: + is DOpus5:C. +- catalogs/catalogs.sh compiles the .ct files with FlexCat and stages + them under their ISO-8859-1 language names; 'make + catalogs' runs it, and release-package needs FlexCat unless the + catalogs are up to date. CI compiles them in the os3 image for the + AROS targets, whose images have no FlexCat. It replaces the + hand-written catalogs/Makefile. + [dopus5 5.104] Release summary Program bumps to 5.104, library and modules to v73r8, commands to v65r6. The release adds striped lister rows, repairs the translated diff --git a/README.md b/README.md index 56a6dfab..3cfe0fcb 100644 --- a/README.md +++ b/README.md @@ -168,9 +168,17 @@ make os3 release debug=no The release archive ends up under `releases/` as `DOpus5__.lha` (or `..._dev_.lha` for the debug -variant). It holds the `DOpus5` drawer, the `Install DOpus5` script and -the `IconSets/MagicWB` drawer. `make release-package` packs an -existing build without compiling again. +variant). It holds the `DOpus5` drawer, the `Install DOpus5` script, the +`IconSets/MagicWB` drawer and `Catalogs/` with the translated +catalogs. `make release-package` packs an existing build +without compiling again. + +The catalogs are compiled from `catalogs//*.ct` with +[FlexCat](https://github.com/adtools/flexcat) into `catalogs/bin/` +(`make catalogs`, also run by `release-package`). FlexCat is +only needed when a catalog is missing or older than its `.ct` or `.cd`; +the AROS images do not have it, so compile the catalogs in the os3, os4 +or mos image first, as CI does. ### SFTP support diff --git a/archive/installer/Install DOpus5 b/archive/installer/Install DOpus5 index ac8a94dd..f67320aa 100644 --- a/archive/installer/Install DOpus5 +++ b/archive/installer/Install DOpus5 @@ -5,9 +5,10 @@ ; version 1.1 (see COPYING). ; ; The release archive holds this script, its icon, DOpus5.info, the -; DOpus5 drawer and IconSets/MagicWB. The script copies the DOpus5 -; drawer to the chosen place, with the MagicWB images and icons over the -; standard ones if the user wants them. On an upgrade it replaces the +; DOpus5 drawer, IconSets/MagicWB and Catalogs. The script copies the +; DOpus5 drawer to the chosen place, with the MagicWB images and icons +; over the standard ones if the user wants them, and the chosen +; translations to LOCALE:Catalogs. On an upgrade it replaces the ; program files and keeps the user's configuration: configuration ; drawers only receive the files they lack. ; @@ -144,6 +145,50 @@ "Your current Toolbar and FTP_image are kept as Toolbar.old and FTP_image.old; Toolbar.default is replaced.") (default 1)))) + +; -------------------------------------------------------------------- +; Translations +; -------------------------------------------------------------------- +; +; Catalogs/ holds the translated catalogs. They go to +; LOCALE:Catalogs/, not DOpus5:Catalogs: locale.library looks +; in PROGDIR:Catalogs and LOCALE:Catalogs, and dopus5.library opens its +; catalog in the program that opens it first, often DOpus5:C/LoadDB or +; LoadDOpusLib, whose PROGDIR: is DOpus5:C. Preselected: the language +; the Installer runs in, and languages that already have Opus catalogs. +; Bit #cat-n of #catalogs selects language #cat-n of P_CATALOG_LANGUAGE, +; in the order of the askoptions choices. + +(procedure P_CATALOG_LANGUAGE + (set #cat-lang + (select #cat-n "deutsch" "español" "français" "greek" "italiano" + "magyar" "nederlands" "norsk" "polski" "português" + "svenska"))) +(set #cat-count 11) + +(set #catalogs 0) +(if (= 2 (exists "Catalogs" (noreq))) + ( + (set #cat-default 0) + (set #cat-n 0) + (while (< #cat-n #cat-count) + (P_CATALOG_LANGUAGE) + (if (or (= @language #cat-lang) + (= 1 (exists (tackon (tackon "LOCALE:Catalogs" #cat-lang) "dopus.catalog") (noreq)))) + (set #cat-default (bitor #cat-default (shiftleft 1 #cat-n)))) + (set #cat-n (+ #cat-n 1))) + (set #catalogs + (askoptions + (prompt "Which translations of Directory Opus 5 should be installed?\n\nDirectory Opus uses the first language of the Locale preferences that it has a translation for.") + (help "The catalogs of each language you choose are copied to LOCALE:Catalogs/. " + "Untranslated texts are shown in English, and so is everything when no language is chosen.\n\n" + "Preselected are the language the Installer runs in and languages whose Directory Opus catalogs are already installed.") + (choices "deutsch" "español" "français" "greek" "italiano" + "magyar" "nederlands" "norsk" "polski" "português" + "svenska") + (default #cat-default))) + )) + (complete 5) @@ -319,6 +364,34 @@ (set #bank "Toolbar.default") (P_BANK) )) +; Translations +(set #cat-n 0) +(while (< #cat-n #cat-count) + (if (bitand #catalogs (shiftleft 1 #cat-n)) + ( + (P_CATALOG_LANGUAGE) + (set #cat-src (tackon "Catalogs" #cat-lang)) + (set #cat-dst (tackon "LOCALE:Catalogs" #cat-lang)) + (if (= 2 (exists #cat-src (noreq))) + ( + (if (= 0 (exists "LOCALE:Catalogs" (noreq))) + (makedir "LOCALE:Catalogs" + (prompt "Create LOCALE:Catalogs") + (help ""))) + (if (= 0 (exists #cat-dst (noreq))) + (makedir #cat-dst + (prompt "Create " #cat-dst) + (help ""))) + (copyfiles + (prompt "Install the " #cat-lang " translation in " #cat-dst) + (help "") + (source #cat-src) + (dest #cat-dst) + (all)) + )) + )) + (set #cat-n (+ #cat-n 1))) + (complete 75) diff --git a/archive/tests/test_basedata_default_drawers.py b/archive/tests/test_basedata_default_drawers.py index 451aefdb..5c46298d 100644 --- a/archive/tests/test_basedata_default_drawers.py +++ b/archive/tests/test_basedata_default_drawers.py @@ -234,6 +234,30 @@ def test_replaced_banks_exist_in_both_sets(self): self.assertIn("DOpus5/Buttons/" + bank, standard) self.assertIn(MAGICWB + "DOpus5/Buttons/" + bank, magicwb) + def test_translation_choices_are_the_shipped_languages(self): + # The release archive has Catalogs/ for the "## language" + # of every translation; the installer lists the languages twice + # (choices and P_CATALOG_LANGUAGE), and bit n of the answer must + # name the same language in both, so a language missing from + # either list, or listed in another order, is never installed. + shipped = set() + for ct in (ROOT / "catalogs").glob("*/*.ct"): + match = re.search(rb"^## language[ \t]*(\S+)", ct.read_bytes(), re.M) + self.assertIsNotNone(match, ct) + shipped.add(match.group(1).decode("latin-1")) + + select = re.search(r'\(select #cat-n((?:\s+"[^"]*")+)\)', self.script) + choices = re.search(r'\(choices((?:\s+"[^"]*")+)\)\s+\(default #cat-default\)', self.script) + count = re.search(r'\(set #cat-count (\d+)\)', self.script) + self.assertIsNotNone(select) + self.assertIsNotNone(choices) + self.assertIsNotNone(count) + + languages = re.findall(r'"([^"]*)"', select.group(1)) + self.assertEqual(languages, re.findall(r'"([^"]*)"', choices.group(1))) + self.assertEqual(len(languages), int(count.group(1))) + self.assertEqual(shipped, set(languages)) + def image_references(bank): """Images a button bank loads, relative to DOpus5: and in lower case.""" diff --git a/catalogs/Makefile b/catalogs/Makefile deleted file mode 100644 index 2008610a..00000000 --- a/catalogs/Makefile +++ /dev/null @@ -1,246 +0,0 @@ -CATCOMP= -flexcat -L= LOCALE:Catalogs/ - -all: deutsch español français greek italiano magyar nederlands norsk polski português svenska -.PHONY: $(wildcard *) - -# built-in catalog -../source/Program/string_data.h: ../source/Program/dopus.cd -../source/Library/string_data.h: ../source/Library/dopuslib.cd -../source/Modules/configopus/string_data.h: ../source/Modules/configopus/configopus.cd - -# other catalogs -deutsch: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - #$(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - #$(CATCOMP) /source/Modules/xadopus/xadopus.cd $@/xadopus.ct CATALOG $@/xadopus.catalog - -español: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - $(CATCOMP) /source/Modules/xadopus/xadopus.cd $@/xadopus.ct CATALOG $@/xadopus.catalog - -français: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - $(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - -greek: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - -italiano: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - #$(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - -magyar: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - -nederlands: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - $(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - -norsk: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - #$(CATCOMP) /source/Modules/xadopus/xadopus.cd $@/xadopus.ct CATALOG $@/xadopus.catalog - -polski: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - $(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - #$(CATCOMP) /source/Modules/xadopus/xadopus.cd $@/xadopus.ct CATALOG $@/xadopus.catalog - -português: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - #$(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog - -svenska: - $(CATCOMP) /source/Modules/cleanup/cleanup.cd $@/cleanup.ct CATALOG $@/cleanup.catalog - $(CATCOMP) /source/Modules/configopus/configopus.cd $@/configopus.ct CATALOG $@/configopus.catalog - $(CATCOMP) /source/Modules/diskcopy/diskcopy.cd $@/diskcopy.ct CATALOG $@/diskcopy.catalog - $(CATCOMP) /source/Modules/diskinfo/diskinfo.cd $@/diskinfo.ct CATALOG $@/diskinfo.catalog - $(CATCOMP) /source/Program/dopus.cd $@/dopus.ct CATALOG $@/dopus.catalog - $(CATCOMP) /source/Library/dopuslib.cd $@/dopuslib.ct CATALOG $@/dopuslib.catalog - $(CATCOMP) /source/Modules/filetype/filetype.cd $@/filetype.ct CATALOG $@/filetype.catalog - $(CATCOMP) /source/Misc/C/ViewFont/font.cd $@/font.ct CATALOG $L$@/viewfont.catalog - $(CATCOMP) /source/Modules/format/format.cd $@/format.ct CATALOG $@/format.catalog - $(CATCOMP) /source/Modules/ftp/ftp.cd $@/ftp.ct CATALOG $@/ftp.catalog - $(CATCOMP) /source/Modules/icon/icon.cd $@/icon.ct CATALOG $@/icon.catalog - $(CATCOMP) /source/Modules/join/join.cd $@/join.ct CATALOG $@/join.catalog - $(CATCOMP) /source/Modules/listerformat/listerformat.cd $@/listerformat.ct CATALOG $@/listerformat.catalog - $(CATCOMP) /source/Modules/misc/misc.cd $@/misc.ct CATALOG $@/misc.catalog - #$(CATCOMP) /source/Modules/pathformat/pathformat.cd $@/pathformat.ct CATALOG $@/pathformat.catalog - $(CATCOMP) /source/Modules/play/play.cd $@/play.ct CATALOG $@/play.catalog - $(CATCOMP) /source/Modules/print/print.cd $@/print.ct CATALOG $@/print.catalog - $(CATCOMP) /source/Modules/read/read.cd $@/read.ct CATALOG $@/read.catalog - $(CATCOMP) /source/Modules/show/show.cd $@/show.ct CATALOG $@/show.catalog diff --git a/catalogs/catalogs.sh b/catalogs/catalogs.sh new file mode 100755 index 00000000..99c186aa --- /dev/null +++ b/catalogs/catalogs.sh @@ -0,0 +1,144 @@ +#!/bin/sh +# Directory Opus 5 translated catalogs +# Copyright 2026 Dimitris Panokostas +# +# catalogs.sh build compiles every /.ct here +# with its .cd from source/ into +# //; only +# catalogs older than their .ct or .cd +# are compiled again +# catalogs.sh stage copies them to /Catalogs/, +# being the "## language" line of +# the .ct files (ISO-8859-1, spelt as +# locale.library spells the language) +# +# The catalog is named after the .cd ("XADopus.cd" -> "XADopus.catalog"), +# except font.cd, which is ViewFont's catalog. FLEXCAT names the compiler +# (default flexcat). Stage into a native Linux directory: macOS volumes, +# also through a Docker bind mount, refuse ISO-8859-1 file names. + +set -e +LC_ALL=C +export LC_ALL + +here=$(cd "$(dirname "$0")" && pwd) +source_dir=$(cd "$here/../source" && pwd) +flexcat=${FLEXCAT:-flexcat} + +usage() +{ + echo "usage: $0 build | stage " >&2 + exit 2 +} + +# .cd for translation $1 (name without .ct) +descriptor() +{ + found=$(find "$source_dir" -type f -iname "$1.cd") + case $found in + "") + echo "catalogs.sh: no $1.cd under source/" >&2 + exit 1 + ;; + *" +"*) + echo "catalogs.sh: more than one $1.cd under source/:" >&2 + echo "$found" >&2 + exit 1 + ;; + esac + echo "$found" +} + +catalog_name() +{ + name=$(basename "$1" .cd) + if [ "$name" = font ]; then + echo viewfont.catalog + else + echo "$name.catalog" + fi +} + +# "## language" of translation file $1 +language() +{ + sed -n '/^## language/{s/^## language[[:space:]]*//;s/[[:space:]]*$//;p;q;}' "$1" +} + +build() +{ + out=$1 + built=0 + for ct in "$here"/*/*.ct; do + dir=$(basename "$(dirname "$ct")") + cd_file=$(descriptor "$(basename "$ct" .ct)") + catalog="$out/$dir/$(catalog_name "$cd_file")" + if [ -f "$catalog" ] && [ ! "$ct" -nt "$catalog" ] && [ ! "$cd_file" -nt "$catalog" ]; then + continue + fi + if ! command -v "$flexcat" >/dev/null 2>&1; then + echo "catalogs.sh: $flexcat not found; build the catalogs where FlexCat is installed (make catalogs)." >&2 + exit 1 + fi + mkdir -p "$out/$dir" + # FlexCat returns 5 for warnings (untranslated strings fall back to + # the built-in English ones); anything higher is an error. Write + # to a temporary name, so a failed run is not taken as up to date. + rc=0 + "$flexcat" "$cd_file" "$ct" CATALOG "$catalog.tmp" QUIET || rc=$? + if [ "$rc" -gt 5 ] || [ ! -s "$catalog.tmp" ]; then + rm -f "$catalog.tmp" + echo "catalogs.sh: $flexcat failed ($rc) on $ct" >&2 + exit 1 + fi + mv -f "$catalog.tmp" "$catalog" + built=$((built + 1)) + done + echo "Catalogs: $built compiled into $out" +} + +stage() +{ + out=$1 + stage_dir=$2 + for dir_path in "$here"/*/; do + dir=$(basename "$dir_path") + lang= + for ct in "$dir_path"*.ct; do + [ -f "$ct" ] || continue + ct_lang=$(language "$ct") + if [ -z "$ct_lang" ]; then + echo "catalogs.sh: $ct has no ## language line" >&2 + exit 1 + fi + if [ -z "$lang" ]; then + lang=$ct_lang + elif [ "$ct_lang" != "$lang" ]; then + echo "catalogs.sh: $ct is not \"## language $lang\" like the other $dir files" >&2 + exit 1 + fi + catalog="$out/$dir/$(catalog_name "$(descriptor "$(basename "$ct" .ct)")")" + if [ ! -f "$catalog" ]; then + echo "catalogs.sh: $catalog is missing; run catalogs.sh build first" >&2 + exit 1 + fi + mkdir -p "$stage_dir/Catalogs/$lang" + cp -p "$catalog" "$stage_dir/Catalogs/$lang/" + done + done +} + +case $1 in +build) + [ $# -eq 2 ] || usage + build "$2" + ;; +stage) + [ $# -eq 3 ] || usage + stage "$2" "$3" + ;; +*) + usage + ;; +esac diff --git a/documents/DOpus5.guide b/documents/DOpus5.guide index 034e1135..25da102d 100644 --- a/documents/DOpus5.guide +++ b/documents/DOpus5.guide @@ -1,6 +1,6 @@ @database dopus5 @master dopus5.guide -@$VER: Dopus5Guide 58.21 (21.10.2026) +@$VER: Dopus5Guide 58.22 (24.10.2026) @author "Mark Anderson, Andrew Dunbar, Dr Greg Perry, Leo Davidson and Dave Clarke" @(c) "Directory Opus 5 Help Guide (c) GPSoftware 1999" @(c) "Directory Opus 5 Help Guide (c) DOPUS5 Open Source Team 2012-2026" @@ -118,6 +118,17 @@ Images and icons: MagicWB files in IconSets/MagicWB, laid out like the archive itself, for installing by hand. +Translations: + The installer asks which translations to install: deutsch, español, + français, greek, italiano, magyar, nederlands, norsk, polski, + português and svenska. It preselects the language the installer runs + in and the languages whose Directory Opus catalogs are installed + already, and copies the catalogs of each chosen language to + LOCALE:Catalogs/. Directory Opus uses the first language of + the Locale preferences it has a translation for; texts a translation + lacks are shown in English. The archive has the catalogs in Catalogs, + one drawer per language, for installing by hand. + How Directory Opus starts: The installer asks how Directory Opus should start, and offers the answer you gave last time: diff --git a/source/makefile b/source/makefile index 09180a89..65c89c51 100755 --- a/source/makefile +++ b/source/makefile @@ -120,17 +120,22 @@ ifeq ($(HOST), Linux) SYSTEM := linux endif ########################################################### -# Sets destination directory and lha command for releases +# Sets destination directory and lha command for releases. +# LHA_RAW_NAMES keeps LHa for UNIX from converting file names (it takes +# them as UTF-8 and fails on the ISO-8859-1 catalog drawer names). DEST := ../releases/ ifeq ($(SYSTEM), amiga) ARCDEST := /releases/ LHA := lha a -a -r -q +LHA_RAW_NAMES := else ifeq ($(SYSTEM), linux) ARCDEST := $(DEST) LHA := lha a -q +LHA_RAW_NAMES := --system-kanji-code=utf8 --archive-kanji-code=utf8 else ARCDEST := $(DEST) LHA := lha ao5q +LHA_RAW_NAMES := --system-kanji-code=utf8 --archive-kanji-code=utf8 endif ########################################################### # Sets base archive to use for releases @@ -138,6 +143,11 @@ BASEARC := basedata.lha RELEASE_DIR := DOpus5.$(NAME) RELEASE_ROOT := $(RELEASE_DIR)/DOpus5 RELEASE_ARCDEST := $(abspath $(ARCDEST)) +# Translated catalogs: compiled into CATALOG_BIN (needs FlexCat unless they +# are up to date), staged with their ISO-8859-1 language names outside the +# source tree, which can be a macOS volume that refuses such names. +CATALOG_BIN := ../catalogs/bin +CATALOG_STAGE := /tmp/dopus5-catalogs.$(NAME) ########################################################### # Commands REMOVE := rm -rf @@ -213,6 +223,12 @@ clean-commands: ########################################################### +.PHONY : catalogs +catalogs: + @sh ../catalogs/catalogs.sh build $(CATALOG_BIN) + +########################################################### + .PHONY : release release: all release-package @@ -228,6 +244,7 @@ release-package: exit 1; \ fi @echo " " + @sh ../catalogs/catalogs.sh build $(CATALOG_BIN) @echo ">>>>>Creating release archive: DOpus5$(VERSION)$(NAME)$(TYPE).lha" @$(REMOVE) $(RELEASE_DIR) @$(MAKEDIR) $(RELEASE_ROOT)/Libs @@ -263,6 +280,10 @@ endif @$(COPY) ../archive/$(BASEARC) $(DEST)DOpus5$(VERSION)$(NAME)$(TYPE).lha @cd $(RELEASE_DIR) && $(LHA) $(RELEASE_ARCDEST)/DOpus5$(VERSION)$(NAME)$(TYPE).lha DOpus5 "Install DOpus5" "Install DOpus5.info" @$(REMOVE) $(RELEASE_DIR) + @$(REMOVE) $(CATALOG_STAGE) + @sh ../catalogs/catalogs.sh stage $(CATALOG_BIN) $(CATALOG_STAGE) + @cd $(CATALOG_STAGE) && $(LHA) $(LHA_RAW_NAMES) $(RELEASE_ARCDEST)/DOpus5$(VERSION)$(NAME)$(TYPE).lha Catalogs + @$(REMOVE) $(CATALOG_STAGE) @echo ">>>>>Release date:" $(shell $(DATE) "+%m/%d/%Y") .PHONY : verify-aarch64-aros @@ -278,6 +299,7 @@ clean-release: cleanall @echo "++++++++++++++ clean release +++++++++++++++" @$(REMOVE) $(DEST) @$(REMOVE) bin.* + @$(REMOVE) $(CATALOG_BIN) ###########################################################