Skip to main content

benecaster_transcription_language

Filter Premium transcription

Overrides, for one episode, the language hint the Transcription Service add-on sends to the provider, and the language it records when the job completes. A whole show in another language needs no code: each show chooses its Transcription language on its Transcription settings tab. This filter is for what that setting cannot express, such as one interview recorded in another language.

$language is the show’s hint: the show’s Transcription language, which defaults to the site-wide Language on Settings → Transcription, or '' for Auto-detect. The filter runs last, after the show’s setting, and it runs both when the request is built and when the job completes, so answer the same both times.

Return '' for no hint, or a code the current provider lists, in that provider’s own spelling. Most codes are ISO 639-1, but AssemblyAI writes en_uk, Deepgram es-419 and en-GB, and Rev.ai cmn for Mandarin. Any other value is ignored and the show’s hint is used, because the provider’s API would refuse the job.

Parameters

Name Type Default Description
$language string — The show's language hint (its Transcription language, else the site-wide Language), or '' for Auto-detect
$show_id int — ID of the episode's show
$episode_id int — ID of the episode being transcribed

Returns: string

Example

add_filter( 'benecaster_transcription_language', function ( string $language, int $show_id, int $episode_id ): string {
    // One interview recorded in Spanish on an English show. 'es' is the same code on all
    // four built-in providers; a regional code is not (AssemblyAI 'en_uk', Deepgram 'es-419', Rev.ai 'en-gb').
    return 456 === $episode_id ? 'es' : $language;
}, 10, 3 );

Notes

Rev.ai cannot detect a language: returning '' under Rev.ai transcribes as English. The episode's recorded language is your answer when the job completes, else the language the provider detected, as a lower-case tag (en_uk becomes en-gb). Walkthrough: Set a different transcription language for one episode.

Need this built rather than just documented? See our services →