Skip to content

Commit

Permalink
Add source lang code auto match
Browse files Browse the repository at this point in the history
  • Loading branch information
BingLingGroup committed Jul 31, 2019
1 parent f0ab2e1 commit 8a60f05
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions autosub/cmdline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,16 @@ def validate_aovp_args(args): # pylint: disable=too-many-branches, too-many-ret
)

else:
if args.src_language is None:
if not args.src_language:
print(
_("Source language not provided. "
"Use Speech language instead.")
)
args.src_language = args.speech_language
if not args.best_match:
args.best_match = {'src'}
elif 'src' not in args.best_match:
args.best_match.add('src')

is_src_matched = False
is_dst_matched = False
Expand Down Expand Up @@ -344,7 +348,7 @@ def validate_aovp_args(args): # pylint: disable=too-many-branches, too-many-ret
"Run with \"-lsc\"/\"--list-translation-codes\" "
"to see all supported languages. "
"Or use \"-bm\"/\"--best-match\" to get a best match.").format(
src=args.speech_language)
src=args.src_language)
)

if not is_dst_matched:
Expand Down Expand Up @@ -375,7 +379,7 @@ def validate_aovp_args(args): # pylint: disable=too-many-branches, too-many-ret
"Run with \"-lsc\"/\"--list-translation-codes\" "
"to see all supported languages. "
"Or use \"-bm\"/\"--best-match\" to get a best match.").format(
dst=args.speech_language)
dst=args.dst_language)
)

if args.dst_language == args.speech_language \
Expand Down

0 comments on commit 8a60f05

Please sign in to comment.