Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ local-notes/
notes/
source/Modules/ftp/third_party/libssh2/build/
__pycache__/
catalogs/bin/
21 changes: 21 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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/<language> 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/<language>. 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 <target>
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
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,17 @@ make os3 release debug=no

The release archive ends up under `releases/` as
`DOpus5_<rev>_<platform>.lha` (or `..._dev_<platform>.lha` for the debug
variant). It holds the `DOpus5` drawer, the `Install DOpus5` script and
the `IconSets/MagicWB` drawer. `make <platform> 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/<language>` with the translated
catalogs. `make <platform> release-package` packs an existing build
without compiling again.

The catalogs are compiled from `catalogs/<language>/*.ct` with
[FlexCat](https://github.com/adtools/flexcat) into `catalogs/bin/`
(`make <platform> 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

Expand Down
79 changes: 76 additions & 3 deletions archive/installer/Install DOpus5
Original file line number Diff line number Diff line change
Expand Up @@ -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.
;
Expand Down Expand Up @@ -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/<language> holds the translated catalogs. They go to
; LOCALE:Catalogs/<language>, 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/<language>. "
"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)


Expand Down Expand Up @@ -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)


Expand Down
24 changes: 24 additions & 0 deletions archive/tests/test_basedata_default_drawers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<language> 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."""
Expand Down
Loading
Loading