Skip to content

Add Plugin-Shared library + AmericanToBritish & BritishToAmerican plugins#272

Merged
niksedk merged 2 commits into
mainfrom
plugin-shared-and-american-to-british
May 17, 2026
Merged

Add Plugin-Shared library + AmericanToBritish & BritishToAmerican plugins#272
niksedk merged 2 commits into
mainfrom
plugin-shared-and-american-to-british

Conversation

@niksedk
Copy link
Copy Markdown
Member

@niksedk niksedk commented May 17, 2026

Summary

`se5/Plugin-Shared/` (new library)

Small Avalonia 11 / .NET 8 class library that SE5 plugins reference instead of copy-pasting boilerplate.

  • `PluginContract.cs` — request / response / subtitle DTOs.
  • `PluginApp` — `Application` base that reads `request.theme` and sets `RequestedThemeVariant` so plugins automatically match SE's Dark / Light theme.
  • `PluginBootstrap.Run(args)` — parses the request JSON from the first command-line argument, starts Avalonia with classic desktop lifetime, writes the response on exit, returns 0. Each plugin's `Program.cs` becomes a single line.
  • `SubRipParser` — lifted out of TypewriterEffect.
  • `WindowExtensions.BringToForeground()` — the `Topmost`-toggle pattern used to force the plugin window in front of SE on macOS.
  • `EnglishVariantConverter` (new) — the US↔BR regex word-list engine, with a `Direction` enum.
  • `WordList.xml` (embedded resource) — the ~1000-pair word list, originally in AmericanToBritish.

Word-list review + growth

  • Bug fix: `anticlockwise` / `counterclockwise` was reversed (anticlockwise is the British form). Swapped.
  • +225 entries (1013 → 1238 pairs), mostly the ~50 most common `-ize`/`-ise` verbs missing from the original list (memorize, scrutinize, finalize, modernize, summarize, specialize, sympathize, moisturize, prioritize, normalize, legalize, visualize, terrorize, traumatize, hospitalize, humanize, stabilize, mobilize, neutralize, synthesize, utilize, etc.) with all four conjugations each. Also added math/maths, fetus/foetus (+ fetal, fetuses), and a small set of unambiguous vocab (truck/lorry, elevator/lift, apartment/flat, sidewalk/pavement, flashlight/torch, gasoline/petrol, eggplant/aubergine, zucchini/courgette, diaper/nappy).

`se5/AmericanToBritish/` (new plugin)

Faithful port of the SE4 American to British converter (regex word list with lowercase / UPPERCASE / Titlecase variants + the `color`-in-``-tag revert). UI is a clean Avalonia preview window:

  • Title + scope summary ("Convert American to British English spellings in the X selected line(s)…").
  • A list of every proposed change — each row has a checkbox, line number, the original text (muted), and the converted text (SemiBold).
  • Select all / Select none buttons, a live "X of Y change(s) selected" summary, Cancel, and an accent-styled Apply (disabled when nothing is checked).
  • Empty list ⇒ a centered "No American-to-British conversions found in the selected lines." instead of an empty box.
  • Theme variant comes straight from `request.theme`.

`se5/BritishToAmerican/` (new plugin)

Mirror of AmericanToBritish using `Direction = BrToUs`. Same UI shell, same shared converter, same word list.

Build + index

  • `.github/workflows/american-to-british.yml` and `british-to-american.yml` mirror `typewriter.yml`: matrix self-contained publish for the six supported RIDs, plugin.json rewritten per-platform with the `executables` block, six zips uploaded as artifacts, and a GitHub release on manual dispatch with a tag. Both `paths` filters watch `se5/Plugin-Shared/**` too.
  • `se5-plugins.json` extended with AmericanToBritish + BritishToAmerican entries pointing at the planned `se5-american-to-british-v1.0` / `se5-british-to-american-v1.0` release assets via per-platform `downloads` maps.

Out of scope (next PR)

  • Retrofitting TypewriterEffect onto Plugin-Shared.
  • WordCensor plugin.
  • OneDrive Load / Save — separate effort.

Test plan

  • CI matrix builds pass on all six RIDs for both plugins.
  • After merge, dispatch each workflow with the appropriate tag to publish the releases.
  • In SE: install both via Get plugins online... → run AmericanToBritish on a subtitle with US spellings → preview shows changes → Apply → status shows count.
  • Same for BritishToAmerican on a subtitle with UK spellings.
  • Confirm both windows match SE's theme.

🤖 Generated with Claude Code

niksedk and others added 2 commits May 17, 2026 16:12
Plugin-Shared is a small Avalonia 11 / .NET 8 library that future SE5
plugins can reference instead of copy-pasting boilerplate:

- PluginContract.cs - request/response/subtitle DTOs (was inlined in
  Haxor and TypewriterEffect).
- PluginApp - Application base that reads request.theme and sets
  RequestedThemeVariant so plugins match SE's Dark/Light theme.
- PluginBootstrap.Run<TApp>(args) - parses the request JSON from the
  first command-line argument, starts Avalonia, writes the response
  on exit, returns 0.
- SubRipParser - lifted out of TypewriterEffect.
- WindowExtensions.BringToForeground() - the Topmost-toggle pattern
  used to force the plugin window in front of SE on macOS.

AmericanToBritish is the first plugin to use it: ports the SE4
converter (regex word list with case variants + the colour-in-font-tag
revert), bundles the ~1000-pair WordList.xml as an embedded resource,
and shows a checkable preview list of every proposed change before
applying. Apply only the checked ones; Cancel does nothing. UI uses
the shared Plugin-Shared boot + theme.

Workflow .github/workflows/american-to-british.yml mirrors
typewriter.yml: matrix self-contained publish for the six supported
RIDs, plugin.json rewritten with per-OS executables block per zip,
and a GitHub release on manual dispatch with a tag.

se5-plugins.json updated to advertise AmericanToBritish via the
per-platform downloads map pointing at the planned
se5-american-to-british-v1.0 release tag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Plugin-Shared changes:
- Move WordList.xml and the converter (now EnglishVariantConverter
  with a Direction enum) into Plugin-Shared so both directions reuse
  one word list. Embedded as a resource of the shared library.
- Word list fix: "anticlockwise" / "counterclockwise" was reversed
  (anticlockwise is the British form). Swapped.
- Word list growth: +225 entries, taking it from 1013 to 1238 pairs.
  Adds the ~50 most common -ize/-ise verbs missing from the list
  (memorize, scrutinize, finalize, modernize, summarize, specialize,
  sympathize, moisturize, prioritize, normalize, legalize, visualize,
  terrorize, traumatize, hospitalize, humanize, stabilize, mobilize,
  neutralize, etc.) with all four conjugations each (base, -d, -s,
  -ing), plus math/maths, fetus/foetus (and fetal, fetuses), and a
  handful of unambiguous vocab pairs (truck/lorry, elevator/lift,
  apartment/flat, sidewalk/pavement, flashlight/torch, gasoline/petrol,
  eggplant/aubergine, zucchini/courgette, diaper/nappy).

BritishToAmerican plugin: mirror of AmericanToBritish using the same
shared converter with Direction = BrToUs. Same preview UI (checkbox
per change, line number, before/after, select all/none, accent Apply,
"Not supported on this platform" empty state).

AmericanToBritish:
- Drop local WordList.xml and the converter, switch MainWindow to use
  EnglishVariantConverter with Direction = UsToBr.

Workflow .github/workflows/british-to-american.yml mirrors the AmTBr
one; se5-plugins.json gets a BritishToAmerican entry pointing at the
planned se5-british-to-american-v1.0 release.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@niksedk niksedk changed the title Add Plugin-Shared library + AmericanToBritish SE5 plugin Add Plugin-Shared library + AmericanToBritish & BritishToAmerican plugins May 17, 2026
@niksedk niksedk merged commit a52cb85 into main May 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant