<commit_before>"""Script to print list of all crowdin language codes for project."""

from crowdin_bot import api

NS_DICT = {
    'ns': "urn:oasis:names:tc:xliff:document:1.2"
}

def get_project_languages():
    """Get list of crowdin language codes.

    Returns:
        (list) list of project crowdin language codes
    """
    info_xml = api.api_call_xml("info")
    languages = info_xml.find('languages')
    translatable_languages = []
    for language in languages:
        # Check it's not the incontext pseudo language
        if language.find("can_translate").text == "1":
            translatable_languages.append(language.find('code').text)
    return translatable_languages

if __name__ == "__main__":
    print('\n'.join(get_project_languages()))<commit_msg>Modify crowdin_bot to only include languages that have >0 translations<commit_after>"""Script to print list of all crowdin language codes for project."""

from crowdin_bot import api

NS_DICT = {
    'ns': "urn:oasis:names:tc:xliff:document:1.2"
}

def get_project_languages():
    """Get list of crowdin language codes.

    Returns:
        (list) list of project crowdin language codes
    """
    active_languages = []
    trans_status = api.api_call_json("status")
    for language in trans_status:
        # Check language has actually had some translation done
        if int(language["words_approved"]) > 0:
            active_languages.append(language["code"])
    return active_languages

if __name__ == "__main__":
    for language in get_project_languages():
        print(language)
{'fraction_non_alphanumeric': 0.10593490746649649, 'fraction_numerical': 0.004467134652201659, 'mean_word_length': 3.680597014925373, 'pattern_counts': {'":': 3, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4744534', 'n_tokens_mistral': 463, 'n_tokens_neox': 462, 'n_words': 131}