diff --git a/.github/workflows/american-to-british.yml b/.github/workflows/american-to-british.yml new file mode 100644 index 0000000..793c4e5 --- /dev/null +++ b/.github/workflows/american-to-british.yml @@ -0,0 +1,109 @@ +name: Build AmericanToBritish (SE5) + +on: + push: + branches: [main] + paths: + - 'se5/AmericanToBritish/**' + - 'se5/Plugin-Shared/**' + - '.github/workflows/american-to-british.yml' + pull_request: + paths: + - 'se5/AmericanToBritish/**' + - 'se5/Plugin-Shared/**' + - '.github/workflows/american-to-british.yml' + workflow_dispatch: + inputs: + tag: + description: 'Release tag to publish the zips under (e.g. se5-american-to-british-v1.0). Leave empty to build artifacts only.' + required: false + type: string + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - rid: win-x64 + os: windows + exe: AmericanToBritish.exe + - rid: win-arm64 + os: windows + exe: AmericanToBritish.exe + - rid: linux-x64 + os: linux + exe: AmericanToBritish + - rid: linux-arm64 + os: linux + exe: AmericanToBritish + - rid: osx-x64 + os: macos + exe: AmericanToBritish + - rid: osx-arm64 + os: macos + exe: AmericanToBritish + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Publish self-contained (${{ matrix.rid }}) + working-directory: se5/AmericanToBritish + run: | + dotnet publish AmericanToBritish.csproj \ + -c Release \ + -r ${{ matrix.rid }} \ + --self-contained true \ + -p:DebugType=None \ + -p:DebugSymbols=false \ + -o staging/AmericanToBritish + + - name: Rewrite plugin.json for ${{ matrix.os }} + working-directory: se5/AmericanToBritish + run: | + jq ' + del(.runtime, .entry) | + .executables = { "${{ matrix.os }}": "${{ matrix.exe }}" } + ' plugin.json > staging/AmericanToBritish/plugin.json + + - name: Package zip + working-directory: se5/AmericanToBritish/staging + run: zip -r "$GITHUB_WORKSPACE/AmericanToBritish-${{ matrix.rid }}.zip" AmericanToBritish + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: AmericanToBritish-${{ matrix.rid }} + path: AmericanToBritish-${{ matrix.rid }}.zip + + release: + name: Publish GitHub Release + needs: build + if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download all zips + uses: actions/download-artifact@v4 + with: + path: dist + pattern: AmericanToBritish-* + merge-multiple: true + + - name: Create release and upload zips + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "${{ github.event.inputs.tag }}" dist/AmericanToBritish-*.zip \ + --repo "${{ github.repository }}" \ + --target "${{ github.sha }}" \ + --title "AmericanToBritish ${{ github.event.inputs.tag }}" \ + --notes "Self-contained AmericanToBritish plugin builds for win/linux/osx (x64 + arm64)." diff --git a/.github/workflows/british-to-american.yml b/.github/workflows/british-to-american.yml new file mode 100644 index 0000000..4498981 --- /dev/null +++ b/.github/workflows/british-to-american.yml @@ -0,0 +1,109 @@ +name: Build BritishToAmerican (SE5) + +on: + push: + branches: [main] + paths: + - 'se5/BritishToAmerican/**' + - 'se5/Plugin-Shared/**' + - '.github/workflows/british-to-american.yml' + pull_request: + paths: + - 'se5/BritishToAmerican/**' + - 'se5/Plugin-Shared/**' + - '.github/workflows/british-to-american.yml' + workflow_dispatch: + inputs: + tag: + description: 'Release tag to publish the zips under (e.g. se5-british-to-american-v1.0). Leave empty to build artifacts only.' + required: false + type: string + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - rid: win-x64 + os: windows + exe: BritishToAmerican.exe + - rid: win-arm64 + os: windows + exe: BritishToAmerican.exe + - rid: linux-x64 + os: linux + exe: BritishToAmerican + - rid: linux-arm64 + os: linux + exe: BritishToAmerican + - rid: osx-x64 + os: macos + exe: BritishToAmerican + - rid: osx-arm64 + os: macos + exe: BritishToAmerican + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Publish self-contained (${{ matrix.rid }}) + working-directory: se5/BritishToAmerican + run: | + dotnet publish BritishToAmerican.csproj \ + -c Release \ + -r ${{ matrix.rid }} \ + --self-contained true \ + -p:DebugType=None \ + -p:DebugSymbols=false \ + -o staging/BritishToAmerican + + - name: Rewrite plugin.json for ${{ matrix.os }} + working-directory: se5/BritishToAmerican + run: | + jq ' + del(.runtime, .entry) | + .executables = { "${{ matrix.os }}": "${{ matrix.exe }}" } + ' plugin.json > staging/BritishToAmerican/plugin.json + + - name: Package zip + working-directory: se5/BritishToAmerican/staging + run: zip -r "$GITHUB_WORKSPACE/BritishToAmerican-${{ matrix.rid }}.zip" BritishToAmerican + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: BritishToAmerican-${{ matrix.rid }} + path: BritishToAmerican-${{ matrix.rid }}.zip + + release: + name: Publish GitHub Release + needs: build + if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download all zips + uses: actions/download-artifact@v4 + with: + path: dist + pattern: BritishToAmerican-* + merge-multiple: true + + - name: Create release and upload zips + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "${{ github.event.inputs.tag }}" dist/BritishToAmerican-*.zip \ + --repo "${{ github.repository }}" \ + --target "${{ github.sha }}" \ + --title "BritishToAmerican ${{ github.event.inputs.tag }}" \ + --notes "Self-contained BritishToAmerican plugin builds for win/linux/osx (x64 + arm64)." diff --git a/se5-plugins.json b/se5-plugins.json index c34c129..5340b4b 100644 --- a/se5-plugins.json +++ b/se5-plugins.json @@ -1,5 +1,39 @@ { "plugins": [ + { + "name": "British to American", + "description": "Converts British English spellings to American English in the subtitle. Shows a checkable preview of every proposed change.", + "version": "1.0.0", + "author": "Subtitle Edit", + "url": "https://github.com/SubtitleEdit/plugins/tree/main/se5/BritishToAmerican", + "date": "2026-05-17", + "minSeVersion": "5.0.0", + "downloads": { + "win-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-win-x64.zip", + "win-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-win-arm64.zip", + "linux-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-linux-x64.zip", + "linux-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-linux-arm64.zip", + "osx-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-osx-x64.zip", + "osx-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-british-to-american-v1.0/BritishToAmerican-osx-arm64.zip" + } + }, + { + "name": "American to British", + "description": "Converts American English spellings to British English in the subtitle. Shows a checkable preview of every proposed change.", + "version": "1.0.0", + "author": "Subtitle Edit", + "url": "https://github.com/SubtitleEdit/plugins/tree/main/se5/AmericanToBritish", + "date": "2026-05-17", + "minSeVersion": "5.0.0", + "downloads": { + "win-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-win-x64.zip", + "win-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-win-arm64.zip", + "linux-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-linux-x64.zip", + "linux-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-linux-arm64.zip", + "osx-x64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-osx-x64.zip", + "osx-arm64": "https://github.com/SubtitleEdit/plugins/releases/download/se5-american-to-british-v1.0/AmericanToBritish-osx-arm64.zip" + } + }, { "name": "Typewriter effect", "description": "Splits each subtitle line into short timed parts that progressively reveal the text, character by character.", diff --git a/se5/AmericanToBritish/AmericanToBritish.csproj b/se5/AmericanToBritish/AmericanToBritish.csproj new file mode 100644 index 0000000..af1d4d4 --- /dev/null +++ b/se5/AmericanToBritish/AmericanToBritish.csproj @@ -0,0 +1,18 @@ + + + + WinExe + net8.0 + enable + enable + AmericanToBritish + SubtitleEdit.Plugins.AmericanToBritish + true + app.manifest + + + + + + + diff --git a/se5/AmericanToBritish/App.axaml b/se5/AmericanToBritish/App.axaml new file mode 100644 index 0000000..68b469f --- /dev/null +++ b/se5/AmericanToBritish/App.axaml @@ -0,0 +1,8 @@ + + + + + diff --git a/se5/AmericanToBritish/App.axaml.cs b/se5/AmericanToBritish/App.axaml.cs new file mode 100644 index 0000000..1afdd50 --- /dev/null +++ b/se5/AmericanToBritish/App.axaml.cs @@ -0,0 +1,13 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; +using SubtitleEdit.Plugins.Shared; + +namespace SubtitleEdit.Plugins.AmericanToBritish; + +public partial class App : PluginApp +{ + public override void Initialize() => AvaloniaXamlLoader.Load(this); + + protected override Window CreateMainWindow(PluginRequest request) => new MainWindow(request); +} diff --git a/se5/AmericanToBritish/ChangeProposal.cs b/se5/AmericanToBritish/ChangeProposal.cs new file mode 100644 index 0000000..2b2581a --- /dev/null +++ b/se5/AmericanToBritish/ChangeProposal.cs @@ -0,0 +1,20 @@ +using CommunityToolkit.Mvvm.ComponentModel; + +namespace SubtitleEdit.Plugins.AmericanToBritish; + +public partial class ChangeProposal : ObservableObject +{ + [ObservableProperty] private bool _include = true; + + public int LineIndex { get; } + public string LineNumber => (LineIndex + 1).ToString(); + public string OriginalText { get; } + public string ConvertedText { get; } + + public ChangeProposal(int lineIndex, string originalText, string convertedText) + { + LineIndex = lineIndex; + OriginalText = originalText; + ConvertedText = convertedText; + } +} diff --git a/se5/AmericanToBritish/MainWindow.axaml b/se5/AmericanToBritish/MainWindow.axaml new file mode 100644 index 0000000..d2912c7 --- /dev/null +++ b/se5/AmericanToBritish/MainWindow.axaml @@ -0,0 +1,95 @@ + + + + + +