import * as vscode from 'vscode' ; export const english = 'en-US' ; export const supportedLanguages = [ 'cs-CZ' , 'de-DE' , english , 'es-ES' , 'fr-FR' , 'hu-HU' , 'it-IT' , 'ja-JP' , 'ko-KR' , 'nl-NL' , 'pl-PL' , 'pt-BR' , 'pt-PT' , 'ru-RU' , 'sv-SE' , 'tr-TR' , 'zh-CN' , 'zh-TW' ] ; export function getScriptResourcesLanguage ( vscodeLang = vscode . env . language ) { try { const parts = vscodeLang . split ( '-' ) ; const language = parts [ 0 ] ; let locale = parts [ 1 ] ; let supportedLanguage ; if ( ! locale ) { const regExp = new RegExp ( `^${ language }$` , 'i' ) ; supportedLanguage = supportedLanguages . find ( f => regExp . test ( f ) ) ; } if ( ! supportedLanguage ) { locale = locale || '[a-z]*' ; const regExp = new RegExp ( `^${ language }(-${ locale })?$` , 'i' ) ; supportedLanguage = supportedLanguages . find ( f => regExp . test ( f ) ) ; } if ( supportedLanguage ) { return supportedLanguage ; } } catch { } return english ; }