Skip to content

Commit

Permalink
chore(common): ldml update out of techpreview 🙀
Browse files Browse the repository at this point in the history
- updates to support techpreview -> 45

Fixes: #10900
  • Loading branch information
srl295 committed Mar 3, 2024
1 parent a0a5728 commit 8975a38
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 56 deletions.
4 changes: 2 additions & 2 deletions common/web/types/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ builder_parse "$@"
function compile_schemas() {
# We need the schema files at runtime and bundled, so always copy it for all actions except `clean`
local schemas=(
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard3.schema.json"
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboardtest3.schema.json"
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/45/ldml-keyboard3.schema.json"
"$KEYMAN_ROOT/resources/standards-data/ldml-keyboards/45/ldml-keyboardtest3.schema.json"
"$KEYMAN_ROOT/common/schemas/kvks/kvks.schema.json"
"$KEYMAN_ROOT/common/schemas/kpj/kpj.schema.json"
"$KEYMAN_ROOT/common/schemas/kpj-9.0/kpj-9.0.schema.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ export class LDMLKeyboardXMLSourceFileReader {
}
// then, the implied imports
if (subtag === 'keys') {
// <import base="cldr" path="techpreview/keys-Latn-implied.xml"/>
// <import base="cldr" path="45/keys-Latn-implied.xml"/>
if (!this.resolveOneImport(obj, subtag, {
base: constants.cldr_import_base,
path: constants.cldr_implied_keys_import
}, true)) {
return false;
}
} else if (subtag === 'forms') {
// <import base="cldr" path="techpreview/scanCodes-implied.xml"/>
// <import base="cldr" path="45/scanCodes-implied.xml"/>
if (!this.resolveOneImport(obj, subtag, {
base: constants.cldr_import_base,
path: constants.cldr_implied_forms_import
Expand Down
4 changes: 2 additions & 2 deletions common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Conforms to techpreview
// Conforms to 45
//
// The interfaces in this file are designed with reference to the mapped
// structures produced by xml2js when passed a LDML keyboard .xml file.
Expand Down Expand Up @@ -40,7 +40,7 @@ export interface LKImport {
*/
base: string;
/**
* path to imported resource, of the form `techpreview/*.xml`
* path to imported resource, of the form `45/*.xml`
*/
path: string;
};
Expand Down
3 changes: 1 addition & 2 deletions common/web/types/test/fixtures/import-minimal.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="und" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
</keyboard3>
3 changes: 1 addition & 2 deletions common/web/types/test/fixtures/import-minimal1.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="und" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
<keys>

Expand Down
3 changes: 1 addition & 2 deletions common/web/types/test/fixtures/import-minimal2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="und" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
<keys>
<key id="a" output="å"/> <!-- override -->
Expand Down
5 changes: 2 additions & 3 deletions common/web/types/test/fixtures/import-symbols.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="und" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
<keys>
<import base="cldr" path="techpreview/keys-Zyyy-punctuation.xml"/>
<import base="cldr" path="45/keys-Zyyy-punctuation.xml"/>
<key id="zz" output="zz"/>
<key id="hash" output="##"/> <!-- override -->
</keys>
Expand Down
7 changes: 1 addition & 6 deletions common/web/types/test/fixtures/invalid-conforms-to.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
DOCTYPE keyboard SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd"
Disabling doctype for this invalid file, not used by compiler, and avoids complaints in IDEs etc.
-->
<keyboard3 locale="mt" conformsTo="nothing-anyone-ever-heard-of"> <!-- invalid -->
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="mt" conformsTo="nothing-anyone-ever-heard-of"> <!-- invalid -->
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
Expand Down
3 changes: 1 addition & 2 deletions common/web/types/test/fixtures/invalid-import-base.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="mt" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="mt" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
Expand Down
5 changes: 2 additions & 3 deletions common/web/types/test/fixtures/invalid-import-path.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="mt" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="mt" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
<import base="cldr" path="techpreview/too/many/slashes/leading/to/nothing-Zxxx-does-not-exist.xml"/> <!-- invalid -->
<import base="cldr" path="45/too/many/slashes/leading/to/nothing-Zxxx-does-not-exist.xml"/> <!-- invalid -->
<key id="hmaqtugha" output="ħ" />
<key id="that" output="ថា" />
</keys>
Expand Down
5 changes: 2 additions & 3 deletions common/web/types/test/fixtures/invalid-import-readfail.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="mt" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="mt" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
<import base="cldr" path="techpreview/none-Zxxx-does-not-exist.xml"/> <!-- invalid -->
<import base="cldr" path="45/none-Zxxx-does-not-exist.xml"/> <!-- invalid -->
<key id="hmaqtugha" output="ħ" />
<key id="that" output="ថា" />
</keys>
Expand Down
5 changes: 2 additions & 3 deletions common/web/types/test/fixtures/invalid-import-wrongroot.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd">
<keyboard3 locale="mt" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="mt" conformsTo="45">
<info name="TestKbd" author="srl295" indicator="🙀" layout="qwerty" />


Expand All @@ -10,7 +9,7 @@
</keys>

<flicks>
<import base="cldr" path="techpreview/keys-Zyyy-punctuation.xml"/> <!-- wrong root! -->
<import base="cldr" path="45/keys-Zyyy-punctuation.xml"/> <!-- wrong root! -->
<flick id="test">
<flickSegment directions="n nw" keyId="hmaqtugha" />
</flick>
Expand Down
7 changes: 1 addition & 6 deletions common/web/types/test/fixtures/invalid-structure-per-dtd.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
DOCTYPE keyboard SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd"
Disabling doctype for this invalid file, not used by compiler, and avoids complaints in IDEs etc.
-->
<keyboard3 locale="mt" conformsTo="techpreview">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="mt" conformsTo="45">
</keyboard3>
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/test-fr.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboardTest3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboardTest3.dtd">
<!DOCTYPE keyboardTest3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/45/dtd/ldmlKeyboardTest3.dtd">
<keyboardTest3 conformsTo="techpreview">
<!--
Read by:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('ldml keyboard xml reader tests', function () {
callback: (data, source) => {
assert.ok(source);
assert.ok(source.keyboardTest3);
assert.equal(source.keyboardTest3.conformsTo, constants.cldr_version_latest);
assert.equal(source.keyboardTest3.conformsTo, constants.cldr_test_version_latest);

assert.deepEqual(source.keyboardTest3.info, {
keyboard: 'fr-t-k0-azerty.xml',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('ldml keyboard xml reader tests', function () {
instancePath: '/keyboard3/conformsTo',
keyword: 'enum',
message: `must be equal to one of the allowed values`,
params: 'allowedValues="techpreview"',
params: 'allowedValues="45"',
})],
},
{
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('ldml keyboard xml reader tests', function () {
errors: [
CommonTypesMessages.Error_ImportInvalidPath({
base: null,
path: 'techpreview/too/many/slashes/leading/to/nothing-Zxxx-does-not-exist.xml',
path: '45/too/many/slashes/leading/to/nothing-Zxxx-does-not-exist.xml',
subtag: null,
}),
],
Expand All @@ -124,7 +124,7 @@ describe('ldml keyboard xml reader tests', function () {
errors: [
CommonTypesMessages.Error_ImportReadFail({
base: null,
path: 'techpreview/none-Zxxx-does-not-exist.xml',
path: '45/none-Zxxx-does-not-exist.xml',
subtag: null,
}),
],
Expand All @@ -135,7 +135,7 @@ describe('ldml keyboard xml reader tests', function () {
errors: [
CommonTypesMessages.Error_ImportWrongRoot({
base: null,
path: 'techpreview/keys-Zyyy-punctuation.xml',
path: '45/keys-Zyyy-punctuation.xml',
subtag: 'flicks',
}),
],
Expand Down
7 changes: 3 additions & 4 deletions core/include/ldml/keyman_core_ldml.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
#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_IMPLIED_FORMS_IMPORT "45/scanCodes-implied.xml"
#define LDML_CLDR_IMPLIED_KEYS_IMPORT "45/keys-Latn-implied.xml"
#define LDML_CLDR_IMPORT_BASE "cldr"
#define LDML_CLDR_VERSION_LATEST "techpreview"
#define LDML_CLDR_VERSION_TECHPREVIEW "techpreview"
#define LDML_CLDR_VERSION_LATEST "45"
#define LDML_ELEM_FLAGS_ORDER_BITSHIFT 0x10
#define LDML_ELEM_FLAGS_ORDER_MASK 0xFF0000
#define LDML_ELEM_FLAGS_PREBASE 0x8
Expand Down
12 changes: 4 additions & 8 deletions core/include/ldml/keyman_core_ldml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,21 @@ class Constants {
*/
readonly version = '1.0';
/**
* The techpreview CLDR version
* The current CLDR version
*/
readonly cldr_version_techpreview = 'techpreview';
/**
* The latest CLDR version
*/
readonly cldr_version_latest = this.cldr_version_techpreview;
readonly cldr_version_latest = '45';
/**
* import base
*/
readonly cldr_import_base = 'cldr';
/**
* implied keys file
*/
readonly cldr_implied_keys_import = `${this.cldr_version_techpreview}/keys-Latn-implied.xml`;
readonly cldr_implied_keys_import = `${this.cldr_version_latest}/keys-Latn-implied.xml`;
/**
* implied scancodes file
*/
readonly cldr_implied_forms_import = `${this.cldr_version_techpreview}/scanCodes-implied.xml`;
readonly cldr_implied_forms_import = `${this.cldr_version_latest}/scanCodes-implied.xml`;
/**
* Length of a raw section header, in bytes
*/
Expand Down

0 comments on commit 8975a38

Please sign in to comment.