diff --git a/src/i18n/keymap_extras/convert_keymap_extras_header.js b/src/i18n/keymap_extras/convert_keymap_extras_header.js index 4a2331b8dd..e2b27b5512 100644 --- a/src/i18n/keymap_extras/convert_keymap_extras_header.js +++ b/src/i18n/keymap_extras/convert_keymap_extras_header.js @@ -307,6 +307,38 @@ function generateMissingKcBsls(kcInfo) { return bslsInfoLines; } +function generateMissingKcNuhs(kcInfo) { + // If no explicit mapping for KC_NUHS exist, as is the case for many ANSI layouts, fall + // back to the KC_BSLS mapping. + if (kcInfo.has('KC_NUHS')) { + return ''; + } + if (!kcInfo.has('KC_BSLS')) { + throw new Error( + 'The input file is missing a mapping to both KC_BSLS and KC_NUHS. At least one of them must be mapped to an locale alias!' + ); + } + const kcBslsInfo = kcInfo.get('KC_BSLS'); + const kcPipeInfo = kcInfo.get('S(KC_BSLS)'); + // Copy the KC_BSLS kc info object but replace the associated intl alias with KC_NUHS. + // Since it is pointless to repeat the US kc alias in the title, we only keep the clarification. + const kcNuhsInfo = { + ...kcBslsInfo, + intlAlias: 'KC_NUHS', + title: kcBslsInfo.clarification + }; + const shiftedNuhsInfo = { + ...kcPipeInfo, + intlAlias: 'S(KC_NUHS)', + title: kcPipeInfo.clarification + }; + kcInfo.set('KC_NUHS', kcNuhsInfo); + kcInfo.set('S(KC_NUHS)', shiftedNuhsInfo); + let nuhsInfoLines = stringify('KC_NUHS', kcNuhsInfo) + '\n'; + nuhsInfoLines += stringify('S(KC_NUHS)', shiftedNuhsInfo); + return nuhsInfoLines; +} + function generateMissingShiftedAliasKcInfo(kcInfo) { let ret = ''; for (const [shiftedKc, shiftedAlias] of shiftedKc2shiftedAlias.entries()) { @@ -374,6 +406,7 @@ fs.readFile(process.argv.at(-1), 'utf8', function (err, data) { console.log(convertedLines.join('\n')); console.log('/* Other keys */'); console.log(generateMissingKcBsls(kcInfo)); + console.log(generateMissingKcNuhs(kcInfo)); console.log(generateMissingShiftedAliasKcInfo(kcInfo)); spaceCadetKeycodes = [ 'KC_LSPO', diff --git a/src/i18n/keymap_extras/keymap_german.js b/src/i18n/keymap_extras/keymap_german.js index b1f15fcc5d..fb595a154a 100644 --- a/src/i18n/keymap_extras/keymap_german.js +++ b/src/i18n/keymap_extras/keymap_german.js @@ -168,6 +168,7 @@ export default { KC_BSLS: { name: "'\n#", title: '' }, 'S(KC_BSLS)': { name: "'", title: '' }, KC_PIPE: { name: "'", title: '' }, + KC_LCBR: { name: 'Ü', title: 'S(DE_UDIA) (capital Ü)' }, KC_COLN: { name: 'Ö', title: 'S(DE_ODIA) (capital Ö)' }, KC_DQUO: { name: 'Ä', title: 'S(DE_ADIA) (capital Ä)' }, diff --git a/src/i18n/keymap_extras/keymap_russian.js b/src/i18n/keymap_extras/keymap_russian.js index 65d6eae2cf..1941a476f1 100644 --- a/src/i18n/keymap_extras/keymap_russian.js +++ b/src/i18n/keymap_extras/keymap_russian.js @@ -143,6 +143,8 @@ export default { /* Other keys */ + KC_NUHS: { name: '/\n\\', title: '' }, + 'S(KC_NUHS)': { name: '/', title: '' }, KC_TILD: { name: 'Ё', title: 'S(RU_YO) (capital Ё)' }, KC_LCBR: { name: 'Х', title: 'S(RU_HA) (capital Х)' }, KC_RCBR: { name: 'Ъ', title: 'S(RU_HARD) (capital Ъ)' },