@@ -13,6 +13,7 @@ const extensionId = 'write-your-python-program';
1313const python3ConfigKey = 'python3Cmd' ;
1414const verboseConfigKey = 'verbose' ;
1515const debugConfigKey = 'debug' ;
16+ const languageKey = 'language' ;
1617const disableTypecheckingConfigKey = 'disableTypechecking' ;
1718const isWindows = process . platform === "win32" ;
1819const exeExt = isWindows ? ".exe" : "" ;
@@ -217,6 +218,19 @@ function disableTypechecking(context: vscode.ExtensionContext): boolean {
217218 return ! ! config [ disableTypecheckingConfigKey ] ;
218219}
219220
221+ function getLanguage ( context : vscode . ExtensionContext ) : 'en' | 'de' | undefined {
222+ const config = vscode . workspace . getConfiguration ( extensionId ) ;
223+ const lang = config [ languageKey ] ;
224+ if ( lang === 'english' ) {
225+ return 'en' ;
226+ } else if ( lang === 'german' ) {
227+ return 'de' ;
228+ } else {
229+ return undefined ;
230+ }
231+ }
232+
233+
220234async function fixPylanceConfig (
221235 context : vscode . ExtensionContext ,
222236 folder ?: vscode . WorkspaceFolder
@@ -413,7 +427,6 @@ export async function activate(context: vscode.ExtensionContext) {
413427 "run" ,
414428 "▶ RUN" ,
415429 async ( cmdId ) => {
416- await fixPylanceConfig ( context ) ;
417430 const file =
418431 ( vscode . window . activeTextEditor ) ?
419432 vscode . window . activeTextEditor . document . fileName :
@@ -426,6 +439,7 @@ export async function activate(context: vscode.ExtensionContext) {
426439 vscode . window . showWarningMessage ( 'Not a python file' ) ;
427440 return ;
428441 }
442+ await fixPylanceConfig ( context ) ;
429443 await vscode . window . activeTextEditor ?. document . save ( ) ;
430444 const pyCmd = getPythonCmd ( pyExt ) ;
431445 let verboseOpt = "" ;
@@ -437,14 +451,19 @@ export async function activate(context: vscode.ExtensionContext) {
437451 if ( verboseOpt !== "" ) {
438452 verboseOpt = " " + verboseOpt + " --no-clear" ;
439453 }
454+ const lang = getLanguage ( context ) ;
455+ let langOpt = "" ;
456+ if ( lang ) {
457+ langOpt = " --lang " + lang ;
458+ }
440459 const disableOpt = disableTypechecking ( context ) ? " --no-typechecking" : "" ;
441460 if ( pyCmd . kind !== "error" ) {
442461 const pythonCmd = commandListToArgument ( pyCmd . cmd ) ;
443462 const cmdTerm = await startTerminal (
444463 terminals [ cmdId ] ?. terminal ,
445464 "WYPP - RUN" ,
446465 pythonCmd + " " + fileToCommandArgument ( runProg ) + verboseOpt +
447- disableOpt +
466+ disableOpt + langOpt +
448467 " --interactive " +
449468 " --change-directory " +
450469 fileToCommandArgument ( file )
0 commit comments