| else: | else: | ||||
| yield line | yield line | ||||
| def find_langname(lang): | |||||
| espeak_data_path = os.path.join(os.getcwd(), "espeak-ng-data") | |||||
| for root, dirnames, filenames in os.walk(espeak_data_path): | |||||
| if lang in filenames: | |||||
| filename = os.path.join(root, lang) | |||||
| with codecs.open(filename, "r", "utf-8") as f: | |||||
| for line in f: | |||||
| line = line.replace("\n", "") | |||||
| if line.startswith("name "): | |||||
| return line.replace("name ", "") | |||||
| emoji_dict = sys.argv[1] | emoji_dict = sys.argv[1] | ||||
| lang = sys.argv[2] | lang = sys.argv[2] | ||||
| cldr_path = sys.argv[3] | cldr_path = sys.argv[3] | ||||
| entry.pronunciation = "\t{0}{1}".format(translation, "\t"*int(new_tabs)) | entry.pronunciation = "\t{0}{1}".format(translation, "\t"*int(new_tabs)) | ||||
| else: | else: | ||||
| entry.comment += " (no translation)" | entry.comment += " (no translation)" | ||||
| elif entry == "// Emoji and Other Symbol pronunciations for English": | |||||
| langname = find_langname(lang) | |||||
| entry = "// Emoji and Other Symbol pronunciations for {0}".format(langname) | |||||
| elif entry == "// 2. common/annotations/en.xml (CLDR)": | |||||
| entry = "// 2. common/annotations/{0}.xml (CLDR)".format(lang) | |||||
| print(entry) | print(entry) |