Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLDR-12026 kbd: add proper azerty-optimisé #3220

Merged
230 changes: 230 additions & 0 deletions keyboards/3.0/fr-t-k0-optimise.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="fr-t-k0-optimise"
conformsTo="45">
<!--
New French
-->
<version number="1.0.0" />
<info author="Team Keyboard" name="French AZERTY optimisé" layout="AZERTY" indicator="FR" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved

<displays>
<!-- display for diacritics -->
<display output="\u0300" display="${grave}" />
<display output="\m{acute}" display="´" />
<display output="\m{grave}" display="`" />
<display output="\m{umlaut}" display="¨" />
<display output="\m{caret}" display="^" />
<display output="\m{tilde}" display="~" />

<!-- display for 'mode' keys -->
<display keyId="mark-currency" display="\u{00A4}" />
<display keyId="mark-greek" display="μ" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<display keyId="mark-euro" display="Eu" />
</displays>

<keys>
<import base="cldr" path="45/keys-Zyyy-punctuation.xml" />
<import base="cldr" path="45/keys-Zyyy-currency.xml" />

<!-- deadkeys -->
<key id="mark-acute" output="\m{acute}" />
<key id="mark-breve" output="\m{breve}" />
<key id="mark-caret" output="\m{caret}" />
<key id="mark-caron" output="\m{caron}" />
<key id="mark-cedilla" output="\m{cedilla}" />
<key id="mark-circumflex" output="\m{circumflex}" />
<key id="mark-comma" output="\m{comma}" />
<key id="mark-currency" output="\m{currency}" />
<key id="mark-dotabove" output="\m{dotabove}" />
<key id="mark-dotbelow" output="\m{dotbelow}" />
<key id="mark-doubleacute" output="\m{doubleacute}" />
<key id="mark-doublegrave" output="\m{doublegrave}" />
<key id="mark-euro" output="\m{euro}" />
<key id="mark-grave" output="\m{grave}" />
<key id="mark-macron" output="\m{macron}" />
<key id="mark-ogonek" output="\m{ogonek}" />
<key id="mark-ring" output="\m{ring}" />
<key id="mark-greek" output="\m{greek}" />
<key id="mark-solidus" output="\m{solidus}" />
<key id="mark-stroke" output="\m{stroke}" />
<key id="mark-submacron" output="\m{submacron}" />
<key id="mark-tilde" output="\m{tilde}" />
<key id="mark-umlaut" output="\m{umlaut}" />


<!-- extra keys -->
<key id="e-grave" output="è" />
<key id="e-acute" output="é" />
<key id="c-cedilla" output="ç" />
<key id="a-acute" output="á" />
<key id="a-grave" output="à" />
<key id="e-caret" output="ê" />

<!-- extra symbols -->
<key id="bullet" output="•" />
<key id="umlaut" output="¨" />
<key id="sub-2" output="₂" />
<key id="super-2" output="²" longPressKeyIds="sub-2" />
<key id="en-dash" output="–" />
<key id="plus-minus" output="±" />
<key id="vulgar-half" output="½" />
<key id="vulgar-quarter" output="¼" />
<key id="ellipsis" output="…" />
<key id="open-apos" output="‘" />
<key id="close-apos" output="’" />
<key id="open-g" output="«" />
<key id="close-g" output="»" />

<key id="theta" output="θ" /> <!-- "for Romani" -->
<key id="Theta" output="ϴ" /> <!-- "for Romani" -->
<key id="tm" output="™" />
<key id="open-double" output="“" />
<key id="close-double" output="”" />
<key id="oe" output="œ" />
<key id="Oe" output="Œ" />
<key id="registered" output="®" />
<key id="minus-sign" output="−" />
<key id="ss" output="ß" />
<key id="ininity" output="∞" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<key id="division" output="÷" />
<key id="less-equal" output="≤" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<key id="greater-equal" output="≥" />
<key id="copy" output="©" />
<key id="inverse-question" output="¿" />
<key id="inverse-bang" output="¡" />
<key id="middle-dot" output="•" />
<key id="A-grave" output="À" />
<key id="E-acute" output="É" />
<key id="E-caret" output="Ê" />
<key id="em-dash" output="—" />
<key id="open-single" output="’" />
<key id="close-single" output="’" />
<key id="u-grave" output="Ù" />
<key id="radix" output="√" />
<key id="C-cedilla" output="Ç" />
<key id="not-equal" output="≠" />
<key id="open-angle-quote" output="‹" />
<key id="close-angle-quote" output="›" />

<key id="infinity" output="∞" />
<key id="E-grave" output="È" />
<key id="U-grave" output="Ù" />
<key id="nb-hyphen" output="‑" />
<key id="multiplication" output="×" />
<key id="ezh" output="ʒ" />
<key id="Ezh" output="Ʒ" />
<key id="ae" output="æ" />
<key id="Ae" output="Æ" />
<key id="permille" output="‰" />
<key id="dbl-dagger" output="‡" />
<key id="dagger" output="†" />
<key id="asym-equal" output="≃" />
<key id="Ss" output="ẞ" />
<!-- interestingly, this key has no output by itself, but is U+00A4 when preceded by the currency mark. -->
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<key id="altshifte" output="\m{altshifte}"/>
</keys>

<layers formId="iso">
<layer modifiers="none">
<row
keys="at a-grave e-acute e-grave e-caret open-paren close-paren open-apos close-apos open-g close-g apos mark-caret" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<row keys="a z e r t y u i o p hyphen plus" />
<row keys="q s d f g h j k l m slash asterisk" />
<row keys="open-angle w x c v b n period comma colon semi-colon" />
<row keys="space" />
</layer>

<layer modifiers="shift">
<row keys="hash 1 2 3 4 5 6 7 8 9 0 double-quote mark-umlaut" />
<row keys="A Z E R T Y U I O P en-dash plus-minus" />
<row keys="Q S D F G H J K L M backslash vulgar-half" />
<row keys="close-angle W X C V B N question bang ellipsis equal" />
<row keys="space" />
</layer>
<!-- layer is for AltGr - for now we use ctrl alt -->
<layer modifiers="ctrl alt">
<row
keys="mark-breve section mark-acute mark-grave amp open-square close-square mark-macron underscore open-double close-double degree mark-caron" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<row
keys="ae pound euro registered open-curly close-curly u-grave mark-dotabove oe percent minus-sign dagger" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dot above dead key has a special case that I don't think is captured here – it should produce a dotless i (U+0131) when followed with a lowercase i.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO but that is easy to do in this format

<row
keys="theta ss dollar mark-currency mark-greek mark-euro gap mark-solidus pipe infinity division multiplication" />
<row
keys="less-equal ezh copy c-cedilla mark-cedilla mark-stroke mark-tilde inverse-question inverse-bang middle-dot asym-equal" />
<row keys="space" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
</layer>

<layer modifiers="ctrl alt shift">
<row
keys="mark-circumflex A-grave E-acute E-grave E-caret mark-doubleacute mark-doublegrave gap em-dash open-angle-quote close-angle-quote mark-ring gap" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
<row keys="Ae gap altshifte gap tm gap U-grave mark-dotbelow Oe permille nb-hyphen dbl-dagger" />
<row keys="Theta Ss gap gap gap mark-submacron gap gap gap gap radix vulgar-quarter" />
<row
keys="greater-equal Ezh gap C-cedilla mark-ogonek gap gap gap mark-comma gap not-equal" />
<row keys="space" />
srl295 marked this conversation as resolved.
Show resolved Hide resolved
</layer>
</layers>

<variables>
<!-- spacing accents as string variables -->
<string id="grave" value="`" />
<string id="caret" value="^" />
<string id="umlaut" value="¨" />
<string id="tilde" value="~" />

<!-- sets representing vowels and accented vowels. -->
<!-- There's an extra space between the lower and upper case for visual separation -->
<!-- but, there are only 10 vowels in the following four sets -->
<!-- plus space at end for the visible version -->
<set id="vowel" value="a e i o u A E I O U" />

<!-- currency key from/to -->
<!-- currency key from/to -->
<set id="currfrom" value="e r t y p s d f g h k l m w c b n A R T P S D F L M C B"/>
<set id="currto" value="₠ ₽ ₸ ¥ ₱ ₪ ₫ ƒ ₲ ₴ ₭ ₺ ₥ ₩ ¢ ₿ ₦ ₳ ₹ ₮ ₧ ₷ ₯ ₣ ₤ ℳ ₡ ﺀ"/>

<!-- greek from/to: deviating from spec, uppercase final sigma (X) is encoded as another Σ -->
<set id="greekfrom" value="a z e r u i o p s d g h j k l m x b n A Z E R U I O P S D G H J K L M X B N" />
<set id="greekto" value="α ζ ε ρ θ ι ο π σ δ γ η ξ κ λ μ ς β ν Α Ζ Ε Ρ Θ Ι Ο Π Σ Δ Γ Η Ξ Κ Λ Μ Σ Β Ν" />

<!-- euro key from/to -->
<set id="eurofrom" value="a e t i o s d g j ‘ ’ « » ' E T I D G J 7 8 9 0"/>
<set id="euroto" value="ª ə þ ı º ſ ð ŋ ij ‚ ‘ „ ‟ ’ Ə Þ İ Đ Ŋ IJ › ‹ » «"/>
</variables>

<transforms type="simple">
<transformGroup>
<!-- use sets for those that fit neatly into sets -->
<transform from="\m{caret}($[vowel])" to="$1\u{0302}" />
<transform from="\m{umlaut}($[vowel])" to="$1\u{0308}" />

<!-- curr/greek/euro layer for hardware -->
<transform from="\m{currency}($[currfrom])" to="$[1:currto]" />
<transform from="\m{greek}($[greekfrom])" to="$[1:greekto]" />
<transform from="\m{euro}($[eurofrom])" to="$[1:euroto]" />

<!-- these are harder to see because they are from AltGr and AltGr+Shift layers -->
<transform from="\m{currency}®" to="₨"/> <!-- AltGr-R -->
<transform from="\m{currency}%" to="₰"/> <!-- AltGr-P -->
<transform from="\m{currency}\|" to="₾"/> <!-- AltGr-L - note pipe is escaped -->
<transform from="\m{currency}∞" to="₼"/> <!-- AltGr-M -->
<transform from="\m{currency}ç" to="₢"/> <!-- AltGr-C -->
<transform from="\m{currency}\m{altshifte}" to="¤"/> <!-- AltGr-Shift-E -->
<transform from="\m{currency}Ç" to="₵"/> <!-- AltGr-Shift-C (Cedi sign) -->

<!-- tilde is on a subset, not all vowels, + n -->
<transform from="\m{tilde}a" to="ã" />
<transform from="\m{tilde}A" to="Ã" />
<transform from="\m{tilde}n" to="ñ" />
<transform from="\m{tilde}N" to="Ñ" />
<transform from="\m{tilde}o" to="õ" />
<transform from="\m{tilde}O" to="Õ" />
</transformGroup>
<transformGroup>
<!-- catch-all: drop any marker that didn't otherwise match before a char -->
<transform from="\m{.}(.)" to="$1" />
<!-- also drop any doubled marker -->
<!-- (not currently working) <transform from="\m{.}(\m{.})" to="$1" /> -->
</transformGroup>
</transforms>
</keyboard3>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--
See CLDR-12026 for the real new azerty keyboard
-->
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="fr-t-k0-azerty" conformsTo="45">
<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3" locale="fr-t-k0-test" conformsTo="45">
<locales>
<locale id="br" /> <!-- example of including Breton -->
</locales>
Expand Down
16 changes: 16 additions & 0 deletions keyboards/test/fr-t-k0-optimise-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboardTest3 SYSTEM "../dtd/ldmlKeyboardTest3.dtd">
<keyboardTest3 conformsTo="techpreview">
<info keyboard="fr-t-k0-optimise.xml" author="Team Keyboard" name="fr-test" />
<repertoire name="simple-repertoire" chars="[a b c d e \u{22}]" type="simple" /> <!-- verify that these outputs are all available from simple keys on any layer, for all form factors -->
<repertoire name="chars-repertoire" chars="[á é ó]" type="gesture" /> <!-- verify that these outputs are all available from simple or gesture keys on any layer, for touch -->
<tests name="key-tests">
<test name="key-test">
<startContext to="abc\u0022..."/>
<!-- tests by pressing key ids -->
<keystroke key="s"/>
<check result="abc\u0022...s" />
<!-- TODO -->
</test>
</tests>
</keyboardTest3>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboardTest3 SYSTEM "../dtd/ldmlKeyboardTest3.dtd">
<keyboardTest3 conformsTo="techpreview">
<info keyboard="fr-t-k0-azerty.xml" author="Team Keyboard" name="fr-test" />
<info keyboard="fr-t-k0-test.xml" author="Team Keyboard" name="fr-test" />
<repertoire name="simple-repertoire" chars="[a b c d e \u{22}]" type="simple" /> <!-- verify that these outputs are all available from simple keys on any layer, for all form factors -->
<repertoire name="chars-repertoire" chars="[á é ó]" type="gesture" /> <!-- verify that these outputs are all available from simple or gesture keys on any layer, for touch -->
<tests name="key-tests">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ private static Map<DtdType, ElementAttributeInfo> makeElementAttributeInfoMap(
addElementAttributeInfo(
result,
DtdType.keyboard3,
canonicalCommonDirectory + "/../keyboards/3.0/fr-t-k0-azerty.xml");
canonicalCommonDirectory + "/../keyboards/3.0/fr-t-k0-test.xml");
addElementAttributeInfo(
result,
DtdType.keyboardTest3,
canonicalCommonDirectory + "/../keyboards/test/fr-t-k0-azerty-test.xml");
canonicalCommonDirectory + "/../keyboards/test/fr-t-k0-test-test.xml");
return result;
}

Expand Down
Loading