mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
Add en as fallback osLocale (#175039)
This commit is contained in:
parent
492e7d5e33
commit
7b6b6869e8
|
@ -103,10 +103,12 @@ let osLocale = undefined;
|
|||
// Ref https://github.com/microsoft/vscode/issues/159813
|
||||
// and https://github.com/electron/electron/pull/36035
|
||||
if ('getPreferredSystemLanguages' in app
|
||||
&& typeof app.getPreferredSystemLanguages === 'function'
|
||||
&& app.getPreferredSystemLanguages().length) {
|
||||
&& typeof app.getPreferredSystemLanguages === 'function') {
|
||||
// Use the most preferred OS language for language recommendation.
|
||||
osLocale = app.getPreferredSystemLanguages()[0];
|
||||
// The API might return an empty array on Linux, such as when
|
||||
// the 'C' locale is the user's only configured locale.
|
||||
// No matter the OS, if the array is empty, default back to 'en'.
|
||||
osLocale = app.getPreferredSystemLanguages()?.[0] ?? 'en';
|
||||
if (osLocale) {
|
||||
osLocale = processZhLocale(osLocale.toLowerCase());
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@ import { installAllHandlers } from '../../utils';
|
|||
|
||||
export function setup(logger: Logger) {
|
||||
|
||||
// BUG: app.getPreferredSystemLanguages() doesn't seem to return anything here on Linux: https://github.com/microsoft/vscode/blob/3ba29f37d6b9f3f2257b48f2b90f0699ea581be4/src/main.js#L100-L113
|
||||
// but it should when we move to Electron 22 so we can re-enable this test then.
|
||||
(process.platform === 'linux' ? describe.skip : describe)('Localization', () => {
|
||||
describe('Localization', () => {
|
||||
// Shared before/after handling
|
||||
installAllHandlers(logger);
|
||||
|
||||
|
|
Loading…
Reference in a new issue