File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -567,17 +567,21 @@ async function resolveNlsConfiguration() {
567567 // valid after we have received the app ready event. This is why the
568568 // code is here.
569569
570- // The ternary and ts-ignore can both be removed once Electron
571- // officially adopts the getPreferredSystemLanguages API.
572- // Ref https://github.com/microsoft/vscode/issues/159813
573- // and https://github.com/electron/electron/pull/36035
574570 /**
575571 * @type string
576572 */
577- // @ts -ignore API not yet available in the official Electron
578- let appLocale = ( ( product . quality === 'insider' || product . quality === 'exploration' ) && app ?. getPreferredSystemLanguages ( ) ?. length ) ?
579- // @ts -ignore API not yet available in the official Electron
580- app . getPreferredSystemLanguages ( ) [ 0 ] : app . getLocale ( ) ;
573+ let appLocale = app . getLocale ( ) ;
574+
575+ // This if statement can be simplified once
576+ // VS Code moves to Electron 22.
577+ // Ref https://github.com/microsoft/vscode/issues/159813
578+ // and https://github.com/electron/electron/pull/36035
579+ if ( ( product . quality === 'insider' || product . quality === 'exploration' )
580+ && 'getPreferredSystemLanguages' in app
581+ && typeof app . getPreferredSystemLanguages === 'function'
582+ && app . getPreferredSystemLanguages ( ) . length ) {
583+ appLocale = app . getPreferredSystemLanguages ( ) [ 0 ] ;
584+ }
581585 if ( ! appLocale ) {
582586 nlsConfiguration = { locale : 'en' , availableLanguages : { } } ;
583587 } else {
You can’t perform that action at this time.
0 commit comments