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