File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -687,15 +687,21 @@ def detect(self, content):
687687
688688 def translate (self , content , source = None , target = "eng" ):
689689 # print(source, target)
690- if target not in get_translation_languages ():
691- return None
690+ l_languages = get_translation_languages ()
691+ if source :
692+ if source not in l_languages :
693+ return None , None
694+ if target not in l_languages :
695+ return None , None
692696 translation = None
693697 if content :
694698 if not source :
695699 source = self .detect (content )
696700 # print(source, content)
697701 if source :
698702 if source != target :
703+ if source not in l_languages :
704+ return None , None
699705 try :
700706 source_iso1 = convert_iso3_code (source )
701707 target_iso1 = convert_iso3_code (target )
You can’t perform that action at this time.
0 commit comments