Fix localization in Utils class

Fix the localization in the Utils class by using the “gettext” instead
of the “locale” module.
This commit is contained in:
coderkun 2020-03-22 15:39:58 +01:00
parent 704fa3278a
commit 4708344d4d

View file

@ -4,7 +4,7 @@
import gi
gi.require_version('Gtk', '3.0')
import hashlib
import locale
import gettext
import os
import urllib
@ -59,7 +59,7 @@ class Utils:
def create_artists_label(album):
label = ', '.join(album.get_albumartists())
if album.get_artists():
label = locale.gettext("{} feat. {}").format(
label = gettext.gettext("{} feat. {}").format(
label,
", ".join(album.get_artists())
)
@ -70,13 +70,13 @@ class Utils:
minutes = album.get_length() // 60
seconds = album.get_length() - minutes * 60
return locale.gettext("{}:{} minutes").format(minutes, seconds)
return gettext.gettext("{}:{} minutes").format(minutes, seconds)
def create_track_title(track):
title = track.get_title()
if track.get_artists():
title = locale.gettext("{} feat. {}").format(
title = gettext.gettext("{} feat. {}").format(
title,
", ".join(track.get_artists())
)