tools/emoji: split the CLDR path and language in the command line arguments

This commit is contained in:
Reece H. Dunn
2017-06-03 18:24:38 +01:00
parent ace26f50ad
commit ef25dae11a
+7 -2
View File
@@ -50,11 +50,16 @@ def read_emoji(filename, encoding="utf-8"):
else: else:
yield line yield line
emoji_dict = sys.argv[1]
lang = sys.argv[2]
cldr_path = sys.argv[3]
annotations = {} annotations = {}
for cp, name in read_annotations(sys.argv[2]): filename = os.path.join(cldr_path, "common", "annotations", "{0}.xml".format(lang))
for cp, name in read_annotations(filename):
annotations[cp] = name annotations[cp] = name
for entry in read_emoji(sys.argv[1]): for entry in read_emoji(emoji_dict):
if isinstance(entry, Emoji): if isinstance(entry, Emoji):
translation = annotations.get(entry.emoji, None) translation = annotations.get(entry.emoji, None)
if translation: if translation: