Skip to content

Commit

Permalink
feat(developer): ldml scancodes 🙀
Browse files Browse the repository at this point in the history
For: #9403

- read implied imports for scancodes
  • Loading branch information
srl295 committed Sep 22, 2023
1 parent 5ddc8c8 commit 6a54ebd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ export class LDMLKeyboardXMLSourceFileReader {
if (!source.keyboard3.keys.import) {
source.keyboard3.keys.import = [];
}
if (!source.keyboard3.forms) {
source.keyboard3.forms = {
form: [],
};
}
if (!source.keyboard3.forms.import) {
source.keyboard3.forms.import = [];
}
}
boxXmlArray(source?.keyboard3, 'layers');
boxXmlArray(source?.keyboard3?.displays, 'display');
Expand Down Expand Up @@ -152,6 +160,14 @@ export class LDMLKeyboardXMLSourceFileReader {
})) {
return false;
}
} else if (subtag === 'forms') {
// <import base="cldr" path="techpreview/scanCodes-implied.xml"/>
if (!this.resolveOneImport(obj, subtag, {
base: constants.cldr_import_base,
path: constants.cldr_implied_forms_import
})) {
return false;
}
}
return true;
}
Expand Down
1 change: 1 addition & 0 deletions core/include/ldml/keyboardprocessor_ldml.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#pragma once

#define LDML_BKSP_FLAGS_ERROR 0x1
#define LDML_CLDR_IMPLIED_FORMS_IMPORT "techpreview/scanCodes-implied.xml"
#define LDML_CLDR_IMPLIED_KEYS_IMPORT "techpreview/keys-Latn-implied.xml"
#define LDML_CLDR_IMPORT_BASE "cldr"
#define LDML_CLDR_VERSION_LATEST "techpreview"
Expand Down
4 changes: 4 additions & 0 deletions core/include/ldml/keyboardprocessor_ldml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class Constants {
* implied keys file
*/
readonly cldr_implied_keys_import = `${this.cldr_version_techpreview}/keys-Latn-implied.xml`;
/**
* implied scancodes file
*/
readonly cldr_implied_forms_import = `${this.cldr_version_techpreview}/scanCodes-implied.xml`;
/**
* Length of a raw section header, in bytes
*/
Expand Down

0 comments on commit 6a54ebd

Please sign in to comment.