oryksaTvChatLang function

String oryksaTvChatLang(
  1. String locale
)

The language code the chat endpoint has always taken (en, pt, br, es...): pt-BR is br, any other Portuguese is pt, the rest is the language code.

Implementation

String oryksaTvChatLang(String locale) {
  final l = oryksaTvNormalizeLocale(locale);
  if (l.isEmpty) return '';
  final lang = l.split('-').first;
  if (lang == 'pt') return l == 'pt-BR' ? 'br' : 'pt';
  return lang;
}