fix language exception error message

This commit is contained in:
sigma67 2022-09-22 18:07:26 +02:00
commit 889b29b530
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0

View file

@ -102,10 +102,10 @@ class YTMusic(BrowsingMixin, SearchMixin, WatchMixin, ExploreMixin, LibraryMixin
self.context = initialize_context()
self.context['context']['client']['hl'] = language
locale_dir = os.path.abspath(os.path.dirname(__file__)) + os.sep + 'locales'
supported_languages = [f for f in os.listdir(locale_dir)]
supported_languages = [f for f in next(os.walk(locale_dir))[1]]
if language not in supported_languages:
raise Exception("Language not supported. Supported languages are "
', '.join(supported_languages))
raise Exception("Language not supported. Supported languages are " +
(', '.join(supported_languages)) + ".")
self.language = language
try:
locale.setlocale(locale.LC_ALL, self.language)