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')
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
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")
def convert_language_code(lc): """ Convert an Amara language code to a YouTube one """ return unilangs.LanguageCode(lc, 'unisubs').encode('youtube')
def convert_language_code(lc): """ Convert an Amara language code to a YouTube/Vimeo one """ return unilangs.LanguageCode(lc, 'internal').encode('youtube_with_mapping')