feat: Load language file in lang/ instead of the ini file.

This commit is contained in:
Terry Geng
2020-07-11 11:01:33 +08:00
parent e84607b8e8
commit 9e2e09e5fd
12 changed files with 123 additions and 217 deletions

View File

@ -7,7 +7,7 @@ import hashlib
from media.item import BaseItem
from media.item import item_builders, item_loaders, item_id_generators
import constants
from constants import tr_cli as tr
log = logging.getLogger("bot")
@ -147,18 +147,18 @@ class RadioItem(BaseItem):
)
def format_song_string(self, user):
return constants.tr("radio_item",
url=self.url,
title=get_radio_title(self.url), # the title of current song
name=self.title, # the title of radio station
user=user
)
return tr("radio_item",
url=self.url,
title=get_radio_title(self.url), # the title of current song
name=self.title, # the title of radio station
user=user
)
def format_current_playing(self, user):
return constants.tr("now_playing", item=self.format_song_string(user))
return tr("now_playing", item=self.format_song_string(user))
def format_title(self):
return self.title if self.title else self.url
def display_type(self):
return constants.tr("radio")
return tr("radio")