Use localized name for macOS keyboard layout

This commit is contained in:
Peng Lyu 2019-06-20 11:30:12 -07:00
parent 247d61f4f1
commit 03ae320030
19 changed files with 37 additions and 28 deletions

View file

@ -37,7 +37,7 @@
"keytar": "4.2.1",
"minimist": "1.2.0",
"native-is-elevated": "^0.2.1",
"native-keymap": "1.2.5",
"native-keymap": "1.2.6",
"native-watchdog": "1.0.0",
"node-pty": "0.9.0-beta17",
"onigasm-umd": "^2.2.2",

View file

@ -132,7 +132,7 @@ export class KeyboardLayoutPickerAction extends Action {
// Offer to "Auto Detect"
const autoDetectMode: IQuickPickItem = {
label: nls.localize('autoDetect', "Auto Detect"),
description: isAutoDetect ? `(Current: ${parseKeyboardLayout(currentLayout).label})` : undefined,
description: isAutoDetect ? `Current: ${parseKeyboardLayout(currentLayout).label}` : undefined,
picked: isAutoDetect ? true : undefined
};

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.German', lang: 'de' },
{ id: 'com.apple.keylayout.German', lang: 'de', localizedName: 'German' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.USExtended', lang: 'en' },
{ id: 'com.apple.keylayout.USExtended', lang: 'en', localizedName: 'ABC - Extended' },
[],
{
KeyA: ['a', 'A', '¯', '̄', 4],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.USInternational-PC', lang: 'en' },
{ id: 'com.apple.keylayout.USInternational-PC', lang: 'en', localizedName: 'U.S. International - PC' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -8,7 +8,7 @@ import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.British', lang: 'en' },
{ id: 'com.apple.keylayout.British', lang: 'en', localizedName: 'British' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -7,15 +7,15 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.US', lang: 'en' },
{ id: 'com.apple.keylayout.US', lang: 'en', localizedName: 'U.S.' },
[
{ id: 'com.apple.keylayout.ABC', lang: 'en' },
{ id: 'com.sogou.inputmethod.sogou.pinyin', lang: 'zh-Hans' },
{ id: 'com.apple.inputmethod.Kotoeri.Roman', lang: 'en' },
{ id: 'com.apple.inputmethod.Kotoeri.Japanese', lang: 'ja' },
{ id: 'com.apple.keylayout.Australian', lang: 'en' },
{ id: 'com.apple.keylayout.Canadian', lang: 'en' },
{ id: 'com.apple.keylayout.Brazilian', lang: 'pt' },
{ id: 'com.apple.keylayout.ABC', lang: 'en', localizedName: 'ABC' },
{ id: 'com.sogou.inputmethod.sogou.pinyin', lang: 'zh-Hans', localizedName: 'Pinyin - Simplified' },
{ id: 'com.apple.inputmethod.Kotoeri.Roman', lang: 'en', localizedName: 'Romaji' },
{ id: 'com.apple.inputmethod.Kotoeri.Japanese', lang: 'ja', localizedName: 'Hiragana' },
{ id: 'com.apple.keylayout.Australian', lang: 'en', localizedName: 'Australian' },
{ id: 'com.apple.keylayout.Canadian', lang: 'en', localizedName: 'Canadian English' },
{ id: 'com.apple.keylayout.Brazilian', lang: 'pt', localizedName: 'Brazilian' },
],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.Spanish-ISO', lang: 'es' },
{ id: 'com.apple.keylayout.Spanish-ISO', lang: 'es', localizedName: 'Spanish - ISO' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.French', lang: 'fr' },
{ id: 'com.apple.keylayout.French', lang: 'fr', localizedName: 'French' },
[],
{
KeyA: ['q', 'Q', '‡', 'Ω', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.Italian-Pro', lang: 'it' },
{ id: 'com.apple.keylayout.Italian-Pro', lang: 'it', localizedName: 'Italian' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.google.inputmethod.Japanese.Roman', lang: 'en' },
{ id: 'com.google.inputmethod.Japanese.Roman', lang: 'en', localizedName: 'Alphanumeric (Google)' },
[],
{
KeyA: ['a', 'A', '¯', '̄', 4],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.inputmethod.Kotoeri.Japanese', lang: 'ja' },
{ id: 'com.apple.inputmethod.Kotoeri.Japanese', lang: 'ja', localizedName: 'Hiragana' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -8,7 +8,7 @@ import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.inputmethod.Korean.2SetKorean', lang: 'ko' },
{ id: 'com.apple.inputmethod.Korean.2SetKorean', lang: 'ko', localizedName: '2-Set Korean' },
[],
{
KeyA: ['ㅁ', 'ㅁ', 'a', 'A', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.PolishPro', lang: 'pl' },
{ id: 'com.apple.keylayout.PolishPro', lang: 'pl', localizedName: 'Polish - Pro' },
[],
{
KeyA: ['a', 'A', 'ą', 'Ą', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.Russian', lang: 'ru' },
{ id: 'com.apple.keylayout.Russian', lang: 'ru', localizedName: 'Russian' },
[],
{
KeyA: ['ф', 'Ф', 'ƒ', 'ƒ', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.keylayout.Swedish-Pro', lang: 'sv' },
{ id: 'com.apple.keylayout.Swedish-Pro', lang: 'sv', localizedName: 'Swedish - Pro' },
[],
{
KeyA: ['a', 'A', '', '◊', 0],

View file

@ -7,7 +7,7 @@ import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/bro
import { KeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout(new KeymapInfo(
{ id: 'com.apple.inputmethod.SCIM.ITABC', lang: 'zh-Hans' },
{ id: 'com.apple.inputmethod.SCIM.ITABC', lang: 'zh-Hans', localizedName: '搜狗拼音' },
[],
{
KeyA: ['a', 'A', 'å', 'Å', 0],

View file

@ -78,11 +78,13 @@ export interface ILinuxKeyboardLayoutInfo {
"IKeyboardLayoutInfo" : {
"id" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"lang": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
"localizedName": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
export interface IMacKeyboardLayoutInfo {
id: string;
lang: string;
localizedName?: string;
}
export type IKeyboardLayoutInfo = IWindowsKeyboardLayoutInfo | ILinuxKeyboardLayoutInfo | IMacKeyboardLayoutInfo;
@ -137,6 +139,13 @@ export function parseKeyboardLayout(layout: IKeyboardLayoutInfo | null): { label
if ((<IMacKeyboardLayoutInfo>layout).id) {
let macLayout = <IMacKeyboardLayoutInfo>layout;
if (macLayout.localizedName) {
return {
label: macLayout.localizedName,
description: ''
};
}
if (/^com\.apple\.keylayout\./.test(macLayout.id)) {
return {
label: macLayout.id.replace(/^com\.apple\.keylayout\./, '').replace(/-/, ' '),

View file

@ -5951,10 +5951,10 @@ native-is-elevated@^0.2.1:
resolved "https://registry.yarnpkg.com/native-is-elevated/-/native-is-elevated-0.2.1.tgz#70a2123a8575b9f624a3ef465d98cb74ae017385"
integrity sha1-cKISOoV1ufYko+9GXZjLdK4Bc4U=
native-keymap@1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/native-keymap/-/native-keymap-1.2.5.tgz#1035a9417b9a9340cf8097763a43c76d588165a5"
integrity sha1-EDWpQXuak0DPgJd2OkPHbViBZaU=
native-keymap@1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/native-keymap/-/native-keymap-1.2.6.tgz#93d1b4c4ae0e9136bc14538cafe02c0bbe95bebf"
integrity sha512-8hEr6wNkb7OmGPFLFk1cAsnOt2Y3F4mtBffr8uOyX0kKOjr2JVetSt9TKjk0xyJw/B/HcEgMhXmjFKzGN+9JjA==
native-watchdog@1.0.0:
version "1.0.0"