Skip to content

SE UI save-as: add "Three letter (ISO 639-2/B)" option - fix #11035#11040

Merged
niksedk merged 1 commit into
mainfrom
iso-639-2b-bibliographic-codes
May 18, 2026
Merged

SE UI save-as: add "Three letter (ISO 639-2/B)" option - fix #11035#11040
niksedk merged 1 commit into
mainfrom
iso-639-2b-bibliographic-codes

Conversation

@niksedk
Copy link
Copy Markdown
Member

@niksedk niksedk commented May 18, 2026

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 — Iso639Dash2LanguageCode

  • New BibliographicCode property + optional constructor arg (defaults to ThreeLetterCode, so the API stays compatible).
  • All 184 entries pass the 4th arg explicitly so the data is self-documenting — 20 languages get a distinct /B value, the other 164 repeat the /T code.
  • New GetThreeLetterBibliographicCodeFromTwoLetterCode lookup.
  • GetTwoLetterCodeFromThreeLetterCode now accepts either /T or /B, so "fre" and "fra" both resolve to "fr".

UI

  • New SaveAsLanguageAppendType.ThreeLetterLanguageCodeBibliographic enum value. The existing ThreeLEtterLanguageCode enum-member name is kept so persisted settings round-trip.
  • LanguageGeneral.ThreeLetterLanguageCode / LanguageSettings.SaveAsAppendLanguageCodeThreeLetter labels become "Three letter (ISO 639-2/T)"; new sibling strings for /B.
  • Settings dropdown gains the new entry + enum⇄label mappers.
  • MainViewModel's SaveAs filename builder handles the new case and also strips a pre-existing .fre/.ger/etc. suffix, so re-saving doesn't double-suffix.
  • BatchConvertSettingsViewModel dropdown + BatchConverter's filename builder both handle the new branch (with the right 3-letter→3-letter conversion when the incoming LanguageCode is 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

  • Options > Settings: target language post-fix dropdown shows Three letter (ISO 639-2/T) and Three letter (ISO 639-2/B); selection persists across restart.
  • Save As with /B selected on a French file → name ends .fre.srt (not .fra.srt).
  • Save As with /B selected on a German file → .ger.srt. Re-save → still .ger.srt, not .ger.ger.srt.
  • Save As on a language without a /B-form (e.g. English) → .eng.srt (BibliographicCode defaults to terminology).
  • Switch back to /T → next Save As writes .fra.srt, not .fre.fra.srt (suffix is stripped first).
  • Batch Convert > Settings: post-fix dropdown shows the new option; running a batch with /B emits the bibliographic codes.
  • Existing users with the old "Three-letter" preference selected still see .fra.srt etc. (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

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Iso639Dash2LanguageCode with a BibliographicCode field/optional ctor arg, populate all 184 entries, add GetThreeLetterBibliographicCodeFromTwoLetterCode, and make GetTwoLetterCodeFromThreeLetterCode accept either /T or /B input.
  • Add a new SaveAsLanguageAppendType.ThreeLetterLanguageCodeBibliographic enum 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.

@niksedk niksedk merged commit 9f7b35e into main May 18, 2026
5 of 7 checks passed
@niksedk niksedk deleted the iso-639-2b-bibliographic-codes branch May 18, 2026 19:53
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.

2 participants