mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-14 09:03:03 -04:00
Fix all plugins for new i18n lib (#2993)
This commit is contained in:
parent
5216bcca1e
commit
00f82e96bd
89 changed files with 351 additions and 238 deletions
|
@ -18,8 +18,9 @@
|
|||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Constants, GuildStore, i18n, RestAPI } from "@webpack/common";
|
||||
import { Constants, GuildStore, RestAPI } from "@webpack/common";
|
||||
|
||||
function showDisableInvites(guildId: string) {
|
||||
// @ts-ignore
|
||||
|
@ -43,15 +44,15 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION",
|
||||
find: "#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}",
|
||||
group: true,
|
||||
replacement: [
|
||||
{
|
||||
match: /children:\i\.\i\.\i\.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION/,
|
||||
match: /children:\i\.\i\.string\(\i\.\i#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}\)/,
|
||||
replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})",
|
||||
},
|
||||
{
|
||||
match: /\.INVITES_DISABLED\)(?=.+?\.Messages\.INVITES_PERMANENTLY_DISABLED_TIP.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
|
||||
match: /\.INVITES_DISABLED\)(?=.+?#{intl::INVITES_PERMANENTLY_DISABLED_TIP}.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
|
||||
replace: "$&,setChecked=$2"
|
||||
}
|
||||
]
|
||||
|
@ -61,7 +62,7 @@ export default definePlugin({
|
|||
renderInvitesLabel: ErrorBoundary.wrap(({ guildId, setChecked }) => {
|
||||
return (
|
||||
<div>
|
||||
{i18n.Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}
|
||||
{getIntlMessage("GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION")}
|
||||
{showDisableInvites(guildId) && <a role="button" onClick={() => {
|
||||
setChecked(true);
|
||||
disableInvites(guildId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue