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 1, 2024
1 parent f6bdf64 commit d8e773d
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 30 deletions.
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
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/import-minimal.xml
Original file line number Diff line number Diff line change
@@ -1,5 +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 locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
</keyboard3>
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/import-minimal1.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
<keys>

Expand Down
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/import-minimal2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
<keys>
<key id="a" output="å"/> <!-- override -->
Expand Down
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/import-symbols.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="und" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="Test Minimal Keyboard"/>
<keys>
<import base="cldr" path="techpreview/keys-Zyyy-punctuation.xml"/>
Expand Down
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/invalid-import-base.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="mt" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
Expand Down
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/invalid-import-path.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="mt" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
Expand Down
2 changes: 1 addition & 1 deletion common/web/types/test/fixtures/invalid-import-readfail.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="mt" conformsTo="45">
<info author="srl295" indicator="🙀" layout="qwerty" name="TestKbd"/>

<keys>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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 locale="mt" conformsTo="45">
<info name="TestKbd" author="srl295" indicator="🙀" layout="qwerty" />


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
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 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,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboardTest3 SYSTEM "../../../../../resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboardTest3.dtd">
<keyboardTest3 conformsTo="techpreview">
<keyboardTest3 conformsTo="45">
<!--
Read by:
- common/web/types/test/ldml-keyboard/test-ldml-keyboard-testdata-reader.ts
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 d8e773d

Please sign in to comment.