mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 02:17: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
|
@ -9,13 +9,16 @@ import "./styles.css";
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { canonicalizeMatch } from "@utils/patches";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findComponentLazy } from "@webpack";
|
||||
import { ChannelStore, GuildMemberStore, i18n, Text, Tooltip } from "@webpack/common";
|
||||
import { ChannelStore, GuildMemberStore, Text, Tooltip } from "@webpack/common";
|
||||
import { Message } from "discord-types/general";
|
||||
import { FunctionComponent, ReactNode } from "react";
|
||||
|
||||
const CountDown = findComponentLazy(m => m.prototype?.render?.toString().includes(".MAX_AGE_NEVER"));
|
||||
const countDownFilter = canonicalizeMatch("#{intl::MAX_AGE_NEVER}");
|
||||
const CountDown = findComponentLazy(m => m.prototype?.render?.toString().includes(countDownFilter));
|
||||
|
||||
const enum DisplayStyle {
|
||||
Tooltip = "tooltip",
|
||||
|
@ -48,9 +51,14 @@ function renderTimeout(message: Message, inline: boolean) {
|
|||
/>
|
||||
);
|
||||
|
||||
getIntlMessage("GUILD_ENABLE_COMMUNICATION_TIME_REMAINING", {
|
||||
username: message.author.username,
|
||||
countdown
|
||||
});
|
||||
|
||||
return inline
|
||||
? countdown()
|
||||
: i18n.Messages.GUILD_ENABLE_COMMUNICATION_TIME_REMAINING.format({
|
||||
: getIntlMessage("GUILD_ENABLE_COMMUNICATION_TIME_REMAINING", {
|
||||
username: message.author.username,
|
||||
countdown
|
||||
});
|
||||
|
@ -65,10 +73,10 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: ".GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY",
|
||||
find: "#{intl::GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY}",
|
||||
replacement: [
|
||||
{
|
||||
match: /(\i)\.Tooltip,{(text:.{0,30}\.Messages\.GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY)/,
|
||||
match: /(\i)\.Tooltip,{(text:.{0,30}#{intl::GUILD_COMMUNICATION_DISABLED_ICON_TOOLTIP_BODY}\))/,
|
||||
replace: "$self.TooltipWrapper,{message:arguments[0].message,$2"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue