Esempio n. 1
0
def convert_language_code(lc, enable_language_mapping):
    """
    Convert an Amara language code to a YouTube one
    """
    if enable_language_mapping:
        return unilangs.LanguageCode(lc, 'internal').encode('youtube_with_mapping')
    return unilangs.LanguageCode(lc, 'internal').encode('youtube')
Esempio n. 2
0
def convert_language_code(lc):
    """
    Convert from a YouTube language code to an Amara one
    """
    try:
        return unilangs.LanguageCode(lc, 'youtube_with_mapping').encode('unisubs')
    except KeyError:
        # Error looking up the youtube language code.  Return none and we'll
        # skip importing the subtitles.
        return None
Esempio n. 3
0
def get_youtube_language_code(language_code):
    """Convert the language for a SubtitleVersion to a youtube code
    """
    lc = unilangs.LanguageCode(language_code.lower(), "unisubs")
    return lc.encode("youtube")
Esempio n. 4
0
def convert_language_code(lc):
    """
    Convert an Amara language code to a YouTube one
    """
    return unilangs.LanguageCode(lc, 'unisubs').encode('youtube')
Esempio n. 5
0
def convert_language_code(lc):
    """
    Convert an Amara language code to a YouTube/Vimeo one
    """
    return unilangs.LanguageCode(lc, 'internal').encode('youtube_with_mapping')