From 4b175514aab91a9b531458241d0599da0fd23c0b Mon Sep 17 00:00:00 2001 From: evykassirer Date: Tue, 22 Nov 2022 16:14:20 -0800 Subject: [PATCH] emoji: Remove variation selector when generating emoji. Fixes #23625. The U+FE0F character was appearing in the data supplied by emoji-datasource-google, but isn't in the CLDR data. By removing that variation selector character, all remaining emoji (that were previously marked as "not found in custom emoji name maps, but also not found in CLDR data. Skipping.") are now supported. --- frontend_tests/node_tests/emoji_picker.js | 8 ++++---- tools/setup/emoji/emoji_names.py | 20 ++++++++++++++++++-- tools/setup/emoji/generate_emoji_names | 3 +++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/frontend_tests/node_tests/emoji_picker.js b/frontend_tests/node_tests/emoji_picker.js index 4dfd13e081..5aeb4541e7 100644 --- a/frontend_tests/node_tests/emoji_picker.js +++ b/frontend_tests/node_tests/emoji_picker.js @@ -21,7 +21,7 @@ run_test("initialize", () => { const complete_emoji_catalog = _.sortBy(emoji_picker.complete_emoji_catalog, "name"); assert.equal(complete_emoji_catalog.length, 11); - assert.equal(emoji.emojis_by_name.size, 1817); + assert.equal(emoji.emojis_by_name.size, 1827); let total_emoji_in_categories = 0; @@ -44,12 +44,12 @@ run_test("initialize", () => { const zulip_emoji_count = 1; assert_emoji_category(complete_emoji_catalog.pop(), "fa-car", 195); assert_emoji_category(complete_emoji_catalog.pop(), "fa-hashtag", 221); - assert_emoji_category(complete_emoji_catalog.pop(), "fa-smile-o", 162); + assert_emoji_category(complete_emoji_catalog.pop(), "fa-smile-o", 163); assert_emoji_category(complete_emoji_catalog.pop(), "fa-star-o", popular_emoji_count); - assert_emoji_category(complete_emoji_catalog.pop(), "fa-thumbs-o-up", 353); + assert_emoji_category(complete_emoji_catalog.pop(), "fa-thumbs-o-up", 361); assert_emoji_category(complete_emoji_catalog.pop(), "fa-lightbulb-o", 255); assert_emoji_category(complete_emoji_catalog.pop(), "fa-cutlery", 132); - assert_emoji_category(complete_emoji_catalog.pop(), "fa-flag", 268); + assert_emoji_category(complete_emoji_catalog.pop(), "fa-flag", 269); assert_emoji_category(complete_emoji_catalog.pop(), "fa-cog", 1); assert_emoji_category(complete_emoji_catalog.pop(), "fa-leaf", 144); assert_emoji_category(complete_emoji_catalog.pop(), "fa-soccer-ball-o", 86); diff --git a/tools/setup/emoji/emoji_names.py b/tools/setup/emoji/emoji_names.py index 7578df7008..d61a38fe8e 100644 --- a/tools/setup/emoji/emoji_names.py +++ b/tools/setup/emoji/emoji_names.py @@ -524,7 +524,11 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "1f3ca-200d-2640": {"canonical_name": "woman_swimming", "aliases": []}, "1f3ca-200d-2642": {"canonical_name": "man_swimming", "aliases": []}, "1f3ca": {"canonical_name": "swim", "aliases": []}, + "1f3cb-fe0f-200d-2640-fe0f": {"canonical_name": "woman_lifting_weights", "aliases": []}, + "1f3cb-fe0f-200d-2642-fe0f": {"canonical_name": "man_lifting_weights", "aliases": []}, "1f3cb": {"canonical_name": "lift", "aliases": ["work_out", "weight_lift", "gym"]}, + "1f3cc-fe0f-200d-2640-fe0f": {"canonical_name": "woman_golfing", "aliases": []}, + "1f3cc-fe0f-200d-2642-fe0f": {"canonical_name": "man_golfing", "aliases": []}, "1f3cc": {"canonical_name": "golf", "aliases": []}, "1f3cd": {"canonical_name": "motorcycle", "aliases": []}, "1f3ce": {"canonical_name": "racecar", "aliases": []}, @@ -563,6 +567,10 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "1f3ef": {"canonical_name": "shiro", "aliases": []}, "1f3f0": {"canonical_name": "castle", "aliases": []}, "1f3f3-200d-1f308": {"canonical_name": "rainbow_flag", "aliases": []}, + "1f3f3-fe0f-200d-26a7-fe0f": { + "canonical_name": "transgender_flag", + "aliases": ["light_blue", "pink"], + }, "1f3f3": {"canonical_name": "white_flag", "aliases": ["surrender"]}, "1f3f4-200d-2620": {"canonical_name": "pirate_flag", "aliases": ["jolly_roger", "plunder"]}, "1f3f4-e0067-e0062-e0065-e006e-e0067-e007f": {"canonical_name": "flag_england", "aliases": []}, @@ -642,6 +650,10 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "1f43e": {"canonical_name": "paw_prints", "aliases": ["paws"]}, "1f43f": {"canonical_name": "chipmunk", "aliases": []}, "1f440": {"canonical_name": "eyes", "aliases": ["looking"]}, + "1f441-fe0f-200d-1f5e8-fe0f": { + "canonical_name": "eye_in_speech_bubble", + "aliases": ["speech", "witness"], + }, "1f441": {"canonical_name": "eye", "aliases": []}, "1f442": {"canonical_name": "ear", "aliases": []}, "1f443": {"canonical_name": "nose", "aliases": []}, @@ -1046,6 +1058,8 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "1f570": {"canonical_name": "mantelpiece_clock", "aliases": []}, "1f573": {"canonical_name": "hole", "aliases": []}, "1f574": {"canonical_name": "levitating", "aliases": ["hover"]}, + "1f575-fe0f-200d-2640-fe0f": {"canonical_name": "woman_detective", "aliases": []}, + "1f575-fe0f-200d-2642-fe0f": {"canonical_name": "man_detective", "aliases": []}, "1f575": {"canonical_name": "detective", "aliases": ["spy", "sleuth", "agent", "sneaky"]}, "1f576": {"canonical_name": "dark_sunglasses", "aliases": []}, "1f577": {"canonical_name": "spider", "aliases": []}, @@ -1580,7 +1594,7 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "1f9c8": {"canonical_name": "butter", "aliases": ["dairy"]}, "1f9c9": {"canonical_name": "mate", "aliases": []}, "1f9ca": {"canonical_name": "ice", "aliases": ["ice_cube", "iceberg"]}, - "1f9cb": {"canonical_name": "bubble_tea", "aliases": ["bubble"]}, + "1f9cb": {"canonical_name": "bubble_tea", "aliases": []}, "1f9cc": {"canonical_name": "troll", "aliases": ["fairy_tale", "fantasy", "monster"]}, "1f9cd-200d-2640": {"canonical_name": "woman_standing", "aliases": []}, "1f9cd-200d-2642": {"canonical_name": "man_standing", "aliases": []}, @@ -1950,7 +1964,7 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "269c": {"canonical_name": "fleur_de_lis", "aliases": []}, "26a0": {"canonical_name": "warning", "aliases": ["caution", "danger"]}, "26a1": {"canonical_name": "high_voltage", "aliases": ["zap"]}, - "26a7": {"canonical_name": "transgender_symbol", "aliases": ["transgender"]}, + "26a7": {"canonical_name": "transgender_symbol", "aliases": []}, "26aa": {"canonical_name": "white_circle", "aliases": []}, "26ab": {"canonical_name": "black_circle", "aliases": []}, "26b0": {"canonical_name": "coffin", "aliases": ["burial", "grave"]}, @@ -1978,6 +1992,8 @@ EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = { "26f5": {"canonical_name": "boat", "aliases": ["sailboat"]}, "26f7": {"canonical_name": "skier", "aliases": []}, "26f8": {"canonical_name": "ice_skate", "aliases": []}, + "26f9-fe0f-200d-2640-fe0f": {"canonical_name": "woman_bouncing_ball", "aliases": []}, + "26f9-fe0f-200d-2642-fe0f": {"canonical_name": "man_bouncing_ball", "aliases": []}, "26f9": {"canonical_name": "ball", "aliases": ["sports"]}, "26fa": {"canonical_name": "tent", "aliases": ["camping"]}, "26fd": {"canonical_name": "fuel_pump", "aliases": ["gas_pump", "petrol_pump"]}, diff --git a/tools/setup/emoji/generate_emoji_names b/tools/setup/emoji/generate_emoji_names index 9b75e924fa..2e825c2d6c 100755 --- a/tools/setup/emoji/generate_emoji_names +++ b/tools/setup/emoji/generate_emoji_names @@ -139,6 +139,9 @@ def main() -> None: emoji = "".join( chr(int(h, 16)) for h in (emoji_dict["non_qualified"] or emoji_dict["unified"]).split("-") + # We have to do this check because of this upstream bug: + # https://github.com/iamcal/emoji-data/pull/217 + if h != "FE0F" ) if emoji not in CLDR_DATA: print(