SE UI save-as: add "Three letter (ISO 639-2/B)" option - fix #11035#11040
Conversation
Adds the bibliographic ISO 639-2 form (fre/ger/dut/...) alongside the existing terminology form (fra/deu/nld/...) for the language- code suffix in both the Settings dialog and Batch Convert. Many media servers (Jellyfin in particular) expect the bibliographic codes, and the previous Subtitle Edit only emitted terminology codes, forcing users to rename every saved file. libse: - Iso639Dash2LanguageCode gains a BibliographicCode property, constructor parameter defaults to the terminology code so the API stays compatible. All 184 entries now pass it explicitly so the data is self-documenting; 20 languages get a distinct /B value, the rest repeat the /T code. - New GetThreeLetterBibliographicCodeFromTwoLetterCode lookup. - GetTwoLetterCodeFromThreeLetterCode now accepts either form, so "fre" and "fra" both resolve to "fr". UI: - New SaveAsLanguageAppendType.ThreeLetterLanguageCodeBibliographic enum value (existing ThreeLEtterLanguageCode kept under the same enum-member name so persisted settings round-trip). - Renamed labels for clarity: "Three letter (ISO 639-2/T)" and added "Three letter (ISO 639-2/B)". - Settings dialog dropdown gains the new entry plus the matching enum<->label mappers. - MainViewModel's SaveAs filename builder handles the new case and strips a pre-existing .fre/.ger/etc. suffix to avoid double- suffixing on re-save. - BatchConvertSettingsViewModel dropdown gains the new entry; BatchConverter's filename builder handles the new branch including converting an already-3-letter LanguageCode (/T) to the /B form. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds support for the ISO 639-2/B (bibliographic) three-letter language code form alongside the existing 639-2/T (terminology) form for the language-code filename suffix, so media servers like Jellyfin that expect codes such as fre/ger/dut are properly served. The change touches the libse data model (adding a BibliographicCode per language entry plus a new lookup), and the UI plumbing in Save As (MainViewModel), Batch Convert, and the Settings dropdown. The persisted enum-member name ThreeLEtterLanguageCode is preserved for setting round-trip; the user-facing label is renamed to Three letter (ISO 639-2/T) and a sibling Three letter (ISO 639-2/B) is added.
Changes:
- Extend
Iso639Dash2LanguageCodewith aBibliographicCodefield/optional ctor arg, populate all 184 entries, addGetThreeLetterBibliographicCodeFromTwoLetterCode, and makeGetTwoLetterCodeFromThreeLetterCodeaccept either /T or /B input. - Add a new
SaveAsLanguageAppendType.ThreeLetterLanguageCodeBibliographicenum value, localization strings, and Settings/Batch dropdown entries with corresponding enum⇄label mappers. - Update Save As (MainViewModel) and BatchConverter filename builders to emit the /B code and to strip pre-existing /B suffixes to avoid double-suffixing on re-save.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/libse/Common/Iso639Dash2LanguageCode.cs | Adds BibliographicCode property/constructor arg, populates all 184 entries, adds new lookup, and extends 3→2 lookup to match /B too. |
| src/ui/Logic/Config/SaveAsLanguageAppendType.cs | New ThreeLetterLanguageCodeBibliographic enum member with comment noting why the older typo enum name is preserved. |
| src/ui/Logic/Config/Language/LanguageGeneral.cs | Renames ThreeLetterLanguageCode label to Three letter (ISO 639-2/T) and adds sibling /B string. |
| src/ui/Logic/Config/Language/Options/LanguageSettings.cs | Same label rename + new /B string for the Settings dialog dropdown. |
| src/ui/Features/Options/Settings/SettingsViewModel.cs | Adds the new option to the Save As dropdown and to both directions of the enum⇄label mappers. |
| src/ui/Features/Tools/BatchConvert/BatchConvertSettingsViewModel.cs | Adds the new option to the Batch Convert language post-fix dropdown. |
| src/ui/Features/Tools/BatchConvert/BatchConverter.cs | Adds a /B branch in MakeOutputFileName that handles 2/3/long input codes via the new lookup. |
| src/ui/Features/Main/MainViewModel.cs | Strips any pre-existing /B suffix before re-appending and writes the /B code when the new enum is selected. |
Summary
Adds the ISO 639-2/B (bibliographic) three-letter language code form alongside the existing ISO 639-2/T (terminology) form for the language-code filename suffix in both the Settings dialog and Batch Convert.
Many media servers — Jellyfin in particular — expect the bibliographic codes (
fre,ger,dut,chi,cze,gre, ...), and Subtitle Edit only emitted the terminology codes (fra,deu,nld,zho,ces,ell, ...), forcing users to rename every saved file. The existing label "Three-letter language code" is now renamed to "Three letter (ISO 639-2/T)" for clarity, and a sibling "Three letter (ISO 639-2/B)" entry is added.What changed
libse —
Iso639Dash2LanguageCodeBibliographicCodeproperty + optional constructor arg (defaults toThreeLetterCode, so the API stays compatible).GetThreeLetterBibliographicCodeFromTwoLetterCodelookup.GetTwoLetterCodeFromThreeLetterCodenow accepts either /T or /B, so"fre"and"fra"both resolve to"fr".UI
SaveAsLanguageAppendType.ThreeLetterLanguageCodeBibliographicenum value. The existingThreeLEtterLanguageCodeenum-member name is kept so persisted settings round-trip.LanguageGeneral.ThreeLetterLanguageCode/LanguageSettings.SaveAsAppendLanguageCodeThreeLetterlabels become "Three letter (ISO 639-2/T)"; new sibling strings for /B.MainViewModel'sSaveAsfilename builder handles the new case and also strips a pre-existing.fre/.ger/etc. suffix, so re-saving doesn't double-suffix.BatchConvertSettingsViewModeldropdown +BatchConverter's filename builder both handle the new branch (with the right 3-letter→3-letter conversion when the incomingLanguageCodeis already in /T form).The 20 languages where /B differs from /T (per the LoC ISO 639-2 list): Albanian alb/sqi, Armenian arm/hye, Basque baq/eus, Burmese bur/mya, Chinese chi/zho, Czech cze/ces, Dutch dut/nld, French fre/fra, Georgian geo/kat, German ger/deu, Greek gre/ell, Icelandic ice/isl, Macedonian mac/mkd, Malay may/msa, Maori mao/mri, Persian per/fas, Romanian rum/ron, Slovak slo/slk, Tibetan tib/bod, Welsh wel/cym.
Test plan
.fre.srt(not.fra.srt)..ger.srt. Re-save → still.ger.srt, not.ger.ger.srt..eng.srt(BibliographicCode defaults to terminology)..fra.srt, not.fre.fra.srt(suffix is stripped first)..fra.srtetc. (enum value unchanged, persisted setting round-trips).dotnet test tests/libse/LibSETests.csproj— 343/343 passing.dotnet test tests/UI/UITests.csproj— 188/188 passing.🤖 Generated with Claude Code