def to_language(locale):
    # A locale looks like en_US or fr.
    if '_' in locale:
        return to_language(translation.trans_real.to_language(locale))
    # Django returns en-us but we want to see en-US.
    elif '-' in locale:
        lang, region = locale.split('-')
        return '%s-%s' % (lang, region.upper())
    else:
        return translation.trans_real.to_language(locale)
Like django's to_language, but en_US comes out as en-US.
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/utils.py/to_language