[DOCS] {lang} and {subt} subtitle language tag
Posted: 03 Jan 2023, 02:44
{lang} and {subt} can be used to add the language code to the file name. The subtitle language is auto-detected from the file name (e.g. .eng language suffix) or the text content of the subtitle file via statistical language identification.
2-letter language code
3-letter language code
3-letter language code (Bibliographic)
Language name
{subt} is a formatted String with leading . dot and ISO 639-2/B language code. {subt} will additionally match the subtitle type tag (e.g. forced, SDH, etc) from the original file name.
{lang} and {subt} are defined only for subtitle files.
e.g.
Multiple Subtitles per Subtitles Language and Subtitle Tag
If you have multiple subtitles for the same language and tag, then {lang} and {subt} will generate the same file path for each file, and thus only allow one file per subtitle language and tag. If you want to keep multiple subtitles per subtitle language and tag, then you need to customize your format to yield a unique file path for each unique subtitle file.
e.g. match the trailing _1 pattern from the original file name:
e.g. add {di} duplicate index to the file name:
Alternatively, you can write your own custom code. See my multiple/duplicate subtitles naming scheme for one possible example that uses the {model} binding to add subtitle indices per language if needed.
2-letter language code
Format: Select all
{ '.' + lang.ISO2 }
Code: Select all
.nl
Format: Select all
{ '.' + lang.ISO3 }
Code: Select all
.nld
Format: Select all
{ '.' + lang.ISO3B }
Code: Select all
.dut
Format: Select all
{ '.' + lang.name }
Code: Select all
.Dutch
{subt} is a formatted String with leading . dot and ISO 639-2/B language code. {subt} will additionally match the subtitle type tag (e.g. forced, SDH, etc) from the original file name.
Format: Select all
{ subt }
Code: Select all
.eng.srt
.eng-forced.srt
.eng-HI.srt
.eng-CC.srt
.eng-SDH.srt
{lang} and {subt} are defined only for subtitle files.
e.g.
Format: Select all
{ ny }{ subt }
Code: Select all
Avatar (2009).mkv
Avatar (2009).eng.srt
Avatar (2009).eng-forced.srt
Multiple Subtitles per Subtitles Language and Subtitle Tag
If you have multiple subtitles for the same language and tag, then {lang} and {subt} will generate the same file path for each file, and thus only allow one file per subtitle language and tag. If you want to keep multiple subtitles per subtitle language and tag, then you need to customize your format to yield a unique file path for each unique subtitle file.
Code: Select all
Subs/English_1.srt
Subs/English_2.srt
Subs/English_3.srt
Format: Select all
{ subt }{ fn.match(/[._-][0-9]$/) }
Format: Select all
{ subt }{ dc > 1 ? '_' + di : null }