mirror of https://github.com/jitsi/jitsi-meet
feat(transcribing): configurable transcription language (#9684)
* configurable transcription language * merge conflict * set default config value * fix lintpull/9686/head jitsi-meet_6165
parent
6f44368647
commit
e45cab9a80
@ -0,0 +1,30 @@ |
||||
// @flow
|
||||
|
||||
import i18next from 'i18next'; |
||||
|
||||
import JITSI_TO_BCP47_MAP from './jitsiToBCP47LocaleMap.json'; |
||||
|
||||
const DEFAULT_TRANSCRIBER_LANG = 'en-US'; |
||||
|
||||
|
||||
/** |
||||
* Determine which language to use for transcribing. |
||||
* |
||||
* @param {*} config - Application config. |
||||
* @returns {string} |
||||
*/ |
||||
export function determineTranscriptionLanguage(config: Object) { |
||||
|
||||
const { preferredTranscribeLanguage, transcribeWithAppLanguage = true } = config; |
||||
|
||||
// Depending on the config either use the language that the app automatically detected or the hardcoded
|
||||
// config value.
|
||||
const jitsiLocale = transcribeWithAppLanguage ? i18next.language : preferredTranscribeLanguage; |
||||
|
||||
// Jitsi uses custom language tags, but the transcriber expects BCP-47 compliant tags. We use a mapping file
|
||||
// to convert them.
|
||||
// Not all languages that the app might detect are supported by the transcriber in which case use the default.
|
||||
const { [jitsiLocale]: bcp47Locale = DEFAULT_TRANSCRIBER_LANG } = JITSI_TO_BCP47_MAP; |
||||
|
||||
return bcp47Locale; |
||||
} |
@ -0,0 +1,51 @@ |
||||
{ |
||||
"en": "en-US", |
||||
"af": "af-ZA", |
||||
"ar": "ar-EG", |
||||
"bg": "bg-BG", |
||||
"ca": "ca-ES", |
||||
"cs": "cs-CZ", |
||||
"da": "da-DK", |
||||
"de": "de-DE", |
||||
"el": "el-GR", |
||||
"enGB": "en-GB", |
||||
"es": "es-ES", |
||||
"esUS": "es-US", |
||||
"et": "et-EE", |
||||
"eu": "eu-ES", |
||||
"fi": "fi-FI", |
||||
"fr": "fr-FR", |
||||
"frCA": "fr-CA", |
||||
"he": "iw-IL", |
||||
"hi": "hi-IN", |
||||
"mr": "mr-IN", |
||||
"hr": "hr-HR", |
||||
"hu": "hu-HU", |
||||
"hy": "hy-AM", |
||||
"id": "id-ID", |
||||
"it": "it-IT", |
||||
"ja": "ja-JP", |
||||
"ko": "ko-KR", |
||||
"lt": "lt-LT", |
||||
"ml": "ml-IN", |
||||
"lv": "lv-LV", |
||||
"nl": "nl-NL", |
||||
"fa": "fa-IR", |
||||
"pl": "pl-PL", |
||||
"pt": "pt-PT", |
||||
"ptBR": "pt-BR", |
||||
"ru": "ru-RU", |
||||
"ro": "ro-RO", |
||||
"sk": "sk-SK", |
||||
"sl": "sl-SL", |
||||
"sr": "sr-RS", |
||||
"sq": "sq-AL", |
||||
"sv": "sv-SE", |
||||
"te": "te-IN", |
||||
"th": "th-TH", |
||||
"tr": "tr-TR", |
||||
"uk": "uk-UA", |
||||
"vi": "vi-VN", |
||||
"zhCN": "zh (cmn-Hans-CN)", |
||||
"zhTW": "zh-TW (cmn-Hant-TW)" |
||||
} |
Loading…
Reference in new issue