Skip to content

Commit a52cb85

Browse files
authored
Merge pull request #272 from SubtitleEdit/plugin-shared-and-american-to-british
Add Plugin-Shared library + AmericanToBritish & BritishToAmerican plugins
2 parents fa7acb9 + 9b5cc80 commit a52cb85

31 files changed

Lines changed: 2666 additions & 0 deletions
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Build AmericanToBritish (SE5)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'se5/AmericanToBritish/**'
8+
- 'se5/Plugin-Shared/**'
9+
- '.github/workflows/american-to-british.yml'
10+
pull_request:
11+
paths:
12+
- 'se5/AmericanToBritish/**'
13+
- 'se5/Plugin-Shared/**'
14+
- '.github/workflows/american-to-british.yml'
15+
workflow_dispatch:
16+
inputs:
17+
tag:
18+
description: 'Release tag to publish the zips under (e.g. se5-american-to-british-v1.0). Leave empty to build artifacts only.'
19+
required: false
20+
type: string
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- rid: win-x64
30+
os: windows
31+
exe: AmericanToBritish.exe
32+
- rid: win-arm64
33+
os: windows
34+
exe: AmericanToBritish.exe
35+
- rid: linux-x64
36+
os: linux
37+
exe: AmericanToBritish
38+
- rid: linux-arm64
39+
os: linux
40+
exe: AmericanToBritish
41+
- rid: osx-x64
42+
os: macos
43+
exe: AmericanToBritish
44+
- rid: osx-arm64
45+
os: macos
46+
exe: AmericanToBritish
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Setup .NET 8
53+
uses: actions/setup-dotnet@v4
54+
with:
55+
dotnet-version: '8.0.x'
56+
57+
- name: Publish self-contained (${{ matrix.rid }})
58+
working-directory: se5/AmericanToBritish
59+
run: |
60+
dotnet publish AmericanToBritish.csproj \
61+
-c Release \
62+
-r ${{ matrix.rid }} \
63+
--self-contained true \
64+
-p:DebugType=None \
65+
-p:DebugSymbols=false \
66+
-o staging/AmericanToBritish
67+
68+
- name: Rewrite plugin.json for ${{ matrix.os }}
69+
working-directory: se5/AmericanToBritish
70+
run: |
71+
jq '
72+
del(.runtime, .entry) |
73+
.executables = { "${{ matrix.os }}": "${{ matrix.exe }}" }
74+
' plugin.json > staging/AmericanToBritish/plugin.json
75+
76+
- name: Package zip
77+
working-directory: se5/AmericanToBritish/staging
78+
run: zip -r "$GITHUB_WORKSPACE/AmericanToBritish-${{ matrix.rid }}.zip" AmericanToBritish
79+
80+
- name: Upload artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: AmericanToBritish-${{ matrix.rid }}
84+
path: AmericanToBritish-${{ matrix.rid }}.zip
85+
86+
release:
87+
name: Publish GitHub Release
88+
needs: build
89+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != ''
90+
runs-on: ubuntu-latest
91+
permissions:
92+
contents: write
93+
steps:
94+
- name: Download all zips
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: dist
98+
pattern: AmericanToBritish-*
99+
merge-multiple: true
100+
101+
- name: Create release and upload zips
102+
env:
103+
GH_TOKEN: ${{ github.token }}
104+
run: |
105+
gh release create "${{ github.event.inputs.tag }}" dist/AmericanToBritish-*.zip \
106+
--repo "${{ github.repository }}" \
107+
--target "${{ github.sha }}" \
108+
--title "AmericanToBritish ${{ github.event.inputs.tag }}" \
109+
--notes "Self-contained AmericanToBritish plugin builds for win/linux/osx (x64 + arm64)."
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Build BritishToAmerican (SE5)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'se5/BritishToAmerican/**'
8+
- 'se5/Plugin-Shared/**'
9+
- '.github/workflows/british-to-american.yml'
10+
pull_request:
11+
paths:
12+
- 'se5/BritishToAmerican/**'
13+
- 'se5/Plugin-Shared/**'
14+
- '.github/workflows/british-to-american.yml'
15+
workflow_dispatch:
16+
inputs:
17+
tag:
18+
description: 'Release tag to publish the zips under (e.g. se5-british-to-american-v1.0). Leave empty to build artifacts only.'
19+
required: false
20+
type: string
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- rid: win-x64
30+
os: windows
31+
exe: BritishToAmerican.exe
32+
- rid: win-arm64
33+
os: windows
34+
exe: BritishToAmerican.exe
35+
- rid: linux-x64
36+
os: linux
37+
exe: BritishToAmerican
38+
- rid: linux-arm64
39+
os: linux
40+
exe: BritishToAmerican
41+
- rid: osx-x64
42+
os: macos
43+
exe: BritishToAmerican
44+
- rid: osx-arm64
45+
os: macos
46+
exe: BritishToAmerican
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Setup .NET 8
53+
uses: actions/setup-dotnet@v4
54+
with:
55+
dotnet-version: '8.0.x'
56+
57+
- name: Publish self-contained (${{ matrix.rid }})
58+
working-directory: se5/BritishToAmerican
59+
run: |
60+
dotnet publish BritishToAmerican.csproj \
61+
-c Release \
62+
-r ${{ matrix.rid }} \
63+
--self-contained true \
64+
-p:DebugType=None \
65+
-p:DebugSymbols=false \
66+
-o staging/BritishToAmerican
67+
68+
- name: Rewrite plugin.json for ${{ matrix.os }}
69+
working-directory: se5/BritishToAmerican
70+
run: |
71+
jq '
72+
del(.runtime, .entry) |
73+
.executables = { "${{ matrix.os }}": "${{ matrix.exe }}" }
74+
' plugin.json > staging/BritishToAmerican/plugin.json
75+
76+
- name: Package zip
77+
working-directory: se5/BritishToAmerican/staging
78+
run: zip -r "$GITHUB_WORKSPACE/BritishToAmerican-${{ matrix.rid }}.zip" BritishToAmerican
79+
80+
- name: Upload artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: BritishToAmerican-${{ matrix.rid }}
84+
path: BritishToAmerican-${{ matrix.rid }}.zip
85+
86+
release:
87+
name: Publish GitHub Release
88+
needs: build
89+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != ''
90+
runs-on: ubuntu-latest
91+
permissions:
92+
contents: write
93+
steps:
94+
- name: Download all zips
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: dist
98+
pattern: BritishToAmerican-*
99+
merge-multiple: true
100+
101+
- name: Create release and upload zips
102+
env:
103+
GH_TOKEN: ${{ github.token }}
104+
run: |
105+
gh release create "${{ github.event.inputs.tag }}" dist/BritishToAmerican-*.zip \
106+
--repo "${{ github.repository }}" \
107+
--target "${{ github.sha }}" \
108+
--title "BritishToAmerican ${{ github.event.inputs.tag }}" \
109+
--notes "Self-contained BritishToAmerican plugin builds for win/linux/osx (x64 + arm64)."

se5-plugins.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
{
22
"plugins": [
3+
{
4+
"name": "British to American",
5+
"description": "Converts British English spellings to American English in the subtitle. Shows a checkable preview of every proposed change.",
6+
"version": "1.0.0",
7+
"author": "Subtitle Edit",
8+
"url": "https://github.com/SubtitleEdit/plugins/tree/main/se5/BritishToAmerican",
9+
"date": "2026-05-17",
10+
"minSeVersion": "5.0.0",
11+
"downloads": {
12+
"win-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-win-x64.zip",
13+
"win-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-win-arm64.zip",
14+
"linux-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-linux-x64.zip",
15+
"linux-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-linux-arm64.zip",
16+
"osx-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-osx-x64.zip",
17+
"osx-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-osx-arm64.zip"
18+
}
19+
},
20+
{
21+
"name": "American to British",
22+
"description": "Converts American English spellings to British English in the subtitle. Shows a checkable preview of every proposed change.",
23+
"version": "1.0.0",
24+
"author": "Subtitle Edit",
25+
"url": "https://github.com/SubtitleEdit/plugins/tree/main/se5/AmericanToBritish",
26+
"date": "2026-05-17",
27+
"minSeVersion": "5.0.0",
28+
"downloads": {
29+
"win-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-win-x64.zip",
30+
"win-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-win-arm64.zip",
31+
"linux-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-linux-x64.zip",
32+
"linux-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-linux-arm64.zip",
33+
"osx-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-osx-x64.zip",
34+
"osx-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-osx-arm64.zip"
35+
}
36+
},
337
{
438
"name": "Typewriter effect",
539
"description": "Splits each subtitle line into short timed parts that progressively reveal the text, character by character.",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<AssemblyName>AmericanToBritish</AssemblyName>
9+
<RootNamespace>SubtitleEdit.Plugins.AmericanToBritish</RootNamespace>
10+
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
11+
<ApplicationManifest>app.manifest</ApplicationManifest>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\Plugin-Shared\Plugin-Shared.csproj" />
16+
</ItemGroup>
17+
18+
</Project>

se5/AmericanToBritish/App.axaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
x:Class="SubtitleEdit.Plugins.AmericanToBritish.App"
4+
RequestedThemeVariant="Default">
5+
<Application.Styles>
6+
<FluentTheme />
7+
</Application.Styles>
8+
</Application>

se5/AmericanToBritish/App.axaml.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Avalonia;
2+
using Avalonia.Controls;
3+
using Avalonia.Markup.Xaml;
4+
using SubtitleEdit.Plugins.Shared;
5+
6+
namespace SubtitleEdit.Plugins.AmericanToBritish;
7+
8+
public partial class App : PluginApp
9+
{
10+
public override void Initialize() => AvaloniaXamlLoader.Load(this);
11+
12+
protected override Window CreateMainWindow(PluginRequest request) => new MainWindow(request);
13+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using CommunityToolkit.Mvvm.ComponentModel;
2+
3+
namespace SubtitleEdit.Plugins.AmericanToBritish;
4+
5+
public partial class ChangeProposal : ObservableObject
6+
{
7+
[ObservableProperty] private bool _include = true;
8+
9+
public int LineIndex { get; }
10+
public string LineNumber => (LineIndex + 1).ToString();
11+
public string OriginalText { get; }
12+
public string ConvertedText { get; }
13+
14+
public ChangeProposal(int lineIndex, string originalText, string convertedText)
15+
{
16+
LineIndex = lineIndex;
17+
OriginalText = originalText;
18+
ConvertedText = convertedText;
19+
}
20+
}

0 commit comments

Comments
 (0)