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
commit 4708344d4d

View file

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