[Core] Guild scoped I18n (#3896)

* Guild I18n

Never again!

* Finish off guild scoped i18n

* Black formatting

* Added guild only flags.

* Fix missing import.

* Added listing of guild i18n settings

* Added API support

* Added API support... properly!

* Added API support... for realsies!

* Auto-translate create_cases instances

You're welcome cog creators! Jack talked me into this!

* Fix get_regional_format to actually return properly

* Cleanup `set showsettings`

* Style pass

* Update redbot/core/core_commands.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/events.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/core_commands.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Fix missing import

* Improve caching

* Removal of unneeded function

* Fix some naming

* IDFK anymore...

* Reformat

* Update redbot/core/settings_caches.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/settings_caches.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/settings_caches.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Remove line number

* Fix global sets

* Set contextual locale manually where needed

* Reports cog is wonderful...

* Update redbot/core/core_commands.py

Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>

* Set contextual locale manually where needed in Mutes cog

* s

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
This commit is contained in:
Kowlin
2020-10-26 17:59:11 +01:00
committed by GitHub
parent 7bb6e60c52
commit 2413c6abd3
13 changed files with 341 additions and 36 deletions

View File

@@ -11,7 +11,7 @@ from redbot.core.utils import AsyncIter
from redbot.core.utils.chat_formatting import pagify, box
from redbot.core.utils.antispam import AntiSpam
from redbot.core.bot import Red
from redbot.core.i18n import Translator, cog_i18n
from redbot.core.i18n import Translator, cog_i18n, set_contextual_locales_from_guild
from redbot.core.utils.predicates import MessagePredicate
from redbot.core.utils.tunnel import Tunnel
@@ -346,8 +346,10 @@ class Reports(commands.Cog):
if t is None:
return
guild = t[0][0]
tun = t[1]["tun"]
if payload.user_id in [x.id for x in tun.members]:
await set_contextual_locales_from_guild(self.bot, guild)
await tun.react_close(
uid=payload.user_id, message=_("{closer} has closed the correspondence")
)
@@ -365,6 +367,7 @@ class Reports(commands.Cog):
to_remove.append(k)
continue
await set_contextual_locales_from_guild(self.bot, guild)
topic = _("Re: ticket# {ticket_number} in {guild.name}").format(
ticket_number=ticket_number, guild=guild
)
@@ -376,6 +379,7 @@ class Reports(commands.Cog):
for key in to_remove:
if tun := self.tunnel_store.pop(key, None):
guild, ticket = key
await set_contextual_locales_from_guild(self.bot, guild)
await tun["tun"].close_because_disabled(
_(
"Correspondence about ticket# {ticket_number} in "