Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/smoke/src/areas/workbench/localization.test.ts
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Logger, Application } from '../../../../automation';
7
import { installAllHandlers } from '../../utils';
8
9
export function setup(logger: Logger) {
10
11
describe('Localization', () => {
12
13
// Shared before/after handling
14
installAllHandlers(logger, opts => {
15
opts.verbose = true; // enable verbose logging for tracing
16
opts.snapshots = true; // enable network tab in devtools for tracing since we install an extension
17
return opts;
18
});
19
20
it('starts with "DE" locale and verifies title and viewlets text is in German', async function () {
21
const app = this.app as Application;
22
23
await app.workbench.extensions.installExtension('ms-ceintl.vscode-language-pack-de', false);
24
await app.restart({ extraArgs: ['--locale=DE'] });
25
26
const result = await app.workbench.localization.getLocalizedStrings();
27
const localeInfo = await app.workbench.localization.getLocaleInfo();
28
29
if (localeInfo.locale === undefined || localeInfo.locale.toLowerCase() !== 'de') {
30
throw new Error(`The requested locale for VS Code was not German. The received value is: ${localeInfo.locale === undefined ? 'not set' : localeInfo.locale}`);
31
}
32
33
if (localeInfo.language.toLowerCase() !== 'de') {
34
throw new Error(`The UI language is not German. It is ${localeInfo.language}`);
35
}
36
37
if (result.open.toLowerCase() !== 'öffnen' || result.close.toLowerCase() !== 'schließen' || result.find.toLowerCase() !== 'finden') {
38
throw new Error(`Received wrong German localized strings: ${JSON.stringify(result, undefined, 0)}`);
39
}
40
});
41
});
42
}
43
44