|
Packit Service |
ed5168 |
cldr2json
|
|
Packit Service |
ed5168 |
=========
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
This script converts Unicode CLDR android keyboard layouts to JSON usable by
|
|
Packit Service |
ed5168 |
GNOME Shell.
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
CLDR keyboard layouts can be found at
|
|
Packit Service |
ed5168 |
<http://www.unicode.org/Public/cldr/latest/keyboards.zip>
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
Usage
|
|
Packit Service |
ed5168 |
=====
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
./cldr2json <input file or directory> <output directory>
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
example:
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
./cldr2json cldr/keyboards/android/ json_layouts/
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
Keyboard layout mapping
|
|
Packit Service |
ed5168 |
=======================
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
Unicode CLDR layout identifiers are language codes, while XKB layout
|
|
Packit Service |
ed5168 |
identifiers are... something else. The mapping between the two currently uses
|
|
Packit Service |
ed5168 |
heuristic based on the layout descriptions, in this order:
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
- if the CLDR layout description matches an XKB layout description, chose its
|
|
Packit Service |
ed5168 |
XKB identifier
|
|
Packit Service |
ed5168 |
- if one word of the CLDR layout description matches an XKB layout
|
|
Packit Service |
ed5168 |
description, chose its XKB identifier
|
|
Packit Service |
ed5168 |
- if the CLDR layout description matches one word of an XKB layout description,
|
|
Packit Service |
ed5168 |
chose its XKB identifier
|
|
Packit Service |
ed5168 |
|
|
Packit Service |
ed5168 |
That doesn't always work. For instance it fails for "en" language, that should
|
|
Packit Service |
ed5168 |
match "us" XKB identifier. For such cases, there is a mapping in
|
|
Packit Service |
ed5168 |
LOCALE_TO_XKB_OVERRIDES at the top of the script. If you discover a weird
|
|
Packit Service |
ed5168 |
mapping of if you get a "failed to find XKB mapping for <locale>" warning then
|
|
Packit Service |
ed5168 |
please consider adding an override there.
|
|
Packit Service |
ed5168 |
|