fix (babel): Fix missing localisations.
This commit is contained in:
@@ -230,7 +230,7 @@ class BabelCog(LionCog):
|
||||
supported = self.bot.translator.supported_locales
|
||||
formatted = []
|
||||
for locale in supported:
|
||||
name = locale_names.get(locale, None)
|
||||
name = locale_names.get(locale.replace('_', '-'), None)
|
||||
if name:
|
||||
localestr = f"{locale} ({t(name)})"
|
||||
else:
|
||||
|
||||
@@ -35,6 +35,7 @@ class LocaleMap(Enum):
|
||||
turkish = 'tr'
|
||||
ukrainian = 'uk'
|
||||
vietnamese = 'vi'
|
||||
hebrew = 'he-IL'
|
||||
|
||||
|
||||
locale_names = {
|
||||
@@ -68,4 +69,6 @@ locale_names = {
|
||||
'tr': _p('localenames|locale:tr', "Turkish"),
|
||||
'uk': _p('localenames|locale:uk', "Ukrainian"),
|
||||
'vi': _p('localenames|locale:vi', "Vietnamese"),
|
||||
'he': _p('localenames|locale:he', "Hebrew"),
|
||||
'he-IL': _p('localenames|locale:he_IL', "Hebrew (Israel)"),
|
||||
}
|
||||
|
||||
@@ -142,14 +142,22 @@ class Timer:
|
||||
if not hook:
|
||||
# Attempt to create and save webhook
|
||||
# TODO: Localise
|
||||
t = self.bot.translator.t
|
||||
ctx_locale.set(self.locale.value)
|
||||
try:
|
||||
if channel.permissions_for(channel.guild.me).manage_webhooks:
|
||||
avatar = self.bot.user.avatar
|
||||
avatar_data = (await avatar.to_file()).fp.read() if avatar else None
|
||||
webhook = await channel.create_webhook(
|
||||
avatar=avatar_data,
|
||||
name=f"{self.bot.user.name} Pomodoro",
|
||||
reason="Pomodoro Notifications"
|
||||
name=t(_p(
|
||||
'timer|webhook|name',
|
||||
"{bot_name} Pomodoro"
|
||||
)).format(bot_name=self.bot.user.name),
|
||||
reason=t(_p(
|
||||
'timer|webhook|audit_reason',
|
||||
"Pomodoro Notifications"
|
||||
))
|
||||
)
|
||||
hook = await self.bot.core.data.LionHook.create(
|
||||
channelid=channel.id,
|
||||
@@ -157,9 +165,10 @@ class Timer:
|
||||
webhookid=webhook.id
|
||||
)
|
||||
elif channel.permissions_for(channel.guild.me).send_messages:
|
||||
await channel.send(
|
||||
"I require the `manage_webhooks` permission to send pomodoro notifications here!"
|
||||
)
|
||||
await channel.send(t(_p(
|
||||
'timer|webhook|error:insufficient_permissions',
|
||||
"I require the `MANAGE_WEBHOOKS` permission to send pomodoro notifications here!"
|
||||
)))
|
||||
except discord.HTTPException:
|
||||
logger.warning(
|
||||
"Unexpected Exception caught while creating timer notification webhook "
|
||||
|
||||
Reference in New Issue
Block a user