Merge pull request #379 from devchat-ai/fix_lang_zh

Fix language handling for Simplified Chinese
This commit is contained in:
boob.yang 2023-12-26 11:54:11 +08:00 committed by GitHub
commit 71a244dd30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,10 @@ regOutMessage({ command: 'ideLanguage', lang: "" }); // Placeholder for the lang
// Implement the handler function to get the current IDE language setting
export async function getIdeLanguage(panel: vscode.WebviewPanel | vscode.WebviewView): Promise<void> {
// Get the current IDE language setting
const ideLanguage = vscode.env.language;
let ideLanguage = vscode.env.language;
if (ideLanguage.startsWith("zh-")) {
ideLanguage = "zh";
}
// 'en' stands for English, 'zh' stands for Simplified Chinese
// Construct the message with the language information

View File

@ -33,7 +33,7 @@ const functionRegistry: any = {
"/ide_language": {
"keys": [],
"handler": async () => {
const language = vscode.env.language;
const language = vscode.env.language.startsWith("zh-") ? "zh" : "en";
// 'en' stands for English, 'zh' stands for Simplified Chinese
return language;
}