mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-21 20:37:02 -04:00
i18n.messages -> getIntlMessage
This commit is contained in:
commit
66d921620b
51 changed files with 230 additions and 225 deletions
|
@ -8,8 +8,9 @@ import "./style.css";
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Button, Forms, i18n, TextInput } from "@webpack/common";
|
||||
import { Button, Forms, TextInput } from "@webpack/common";
|
||||
|
||||
function ReasonsComponent() {
|
||||
const { reasons } = settings.use(["reasons"]);
|
||||
|
@ -87,9 +88,9 @@ export default definePlugin({
|
|||
const reasons = settings.store.reasons.length
|
||||
? settings.store.reasons
|
||||
: [
|
||||
i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT,
|
||||
i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT,
|
||||
i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES
|
||||
getIntlMessage("BAN_REASON_OPTION_SPAM_ACCOUNT"),
|
||||
getIntlMessage("BAN_REASON_OPTION_HACKED_ACCOUNT"),
|
||||
getIntlMessage("BAN_REASON_OPTION_BREAKING_RULES")
|
||||
];
|
||||
return reasons.map(s => ({ name: s, value: s }));
|
||||
},
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
*/
|
||||
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { classes } from "@utils/misc";
|
||||
import { closeModal, openModal } from "@utils/modal";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { Avatar, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, i18n, Menu, ReadStateStore, ReadStateUtils, Text, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore } from "@webpack/common";
|
||||
import { Avatar, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, Menu, ReadStateStore, ReadStateUtils, Text, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore } from "@webpack/common";
|
||||
|
||||
import { BasicChannelTabsProps, Bookmark, BookmarkFolder, BookmarkProps, CircleQuestionIcon, isBookmarkFolder, settings, switchChannel, useBookmarks } from "../util";
|
||||
import { NotificationDot } from "./ChannelTab";
|
||||
|
@ -108,7 +109,7 @@ function BookmarkFolderOpenMenu(props: BookmarkProps) {
|
|||
<Menu.MenuItem
|
||||
key="mark-as-read"
|
||||
id="mark-as-read"
|
||||
label={i18n.Messages.MARK_AS_READ}
|
||||
label={getIntlMessage("MARK_AS_READ")}
|
||||
disabled={!ReadStateStore.hasUnread(b.channelId)}
|
||||
action={() => ReadStateUtils.ackChannel(ChannelStore.getChannel(b.channelId))}
|
||||
/>
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { getUniqueUsername } from "@utils/discord";
|
||||
import { getIntlMessage, getUniqueUsername } from "@utils/discord";
|
||||
import { classes } from "@utils/misc";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { Avatar, ChannelStore, ContextMenuApi, Dots, GuildStore, i18n, PresenceStore, ReadStateStore, Text, TypingStore, useDrag, useDrop, useRef, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { Avatar, ChannelStore, ContextMenuApi, Dots, GuildStore, PresenceStore, ReadStateStore, Text, TypingStore, useDrag, useDrop, useRef, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { Channel, Guild, User } from "discord-types/general";
|
||||
|
||||
import { ChannelTabsProps, CircleQuestionIcon, closeTab, isTabSelected, moveDraggedTabs, moveToTab, openedTabs, settings } from "../util";
|
||||
|
@ -113,22 +113,22 @@ function ChannelTabContent(props: ChannelTabsProps & {
|
|||
</>
|
||||
);
|
||||
else {
|
||||
let name = `${i18n.Messages.UNKNOWN_CHANNEL} (${channelId})`;
|
||||
let name = `${getIntlMessage("UNKNOWN_CHANNEL")} (${channelId})`;
|
||||
switch (channelId) {
|
||||
case "customize-community":
|
||||
name = i18n.Messages.CHANNELS_AND_ROLES;
|
||||
name = getIntlMessage("CHANNELS_AND_ROLES");
|
||||
break;
|
||||
case "channel-browser":
|
||||
name = i18n.Messages.GUILD_SIDEBAR_CHANNEL_BROWSER;
|
||||
name = getIntlMessage("GUILD_SIDEBAR_CHANNEL_BROWSER");
|
||||
break;
|
||||
case "shop":
|
||||
name = i18n.Messages.GUILD_SHOP_CHANNEL_LABEL;
|
||||
name = getIntlMessage("GUILD_SHOP_CHANNEL_LABEL");
|
||||
break;
|
||||
case "member-safety":
|
||||
name = i18n.Messages.MEMBER_SAFETY_CHANNEL_TITLE;
|
||||
name = getIntlMessage("MEMBER_SAFETY_CHANNEL_TITLE");
|
||||
break;
|
||||
case "@home":
|
||||
name = i18n.Messages.SERVER_GUIDE;
|
||||
name = getIntlMessage("SERVER_GUIDE");
|
||||
break;
|
||||
}
|
||||
return (
|
||||
|
@ -168,7 +168,7 @@ function ChannelTabContent(props: ChannelTabsProps & {
|
|||
return (
|
||||
<>
|
||||
<ChannelIcon channel={channel} />
|
||||
{!compact && <Text className={cl("name-text")}>{channel?.name || i18n.Messages.GROUP_DM}</Text>}
|
||||
{!compact && <Text className={cl("name-text")}>{channel?.name || getIntlMessage("GROUP_DM")}</Text>}
|
||||
<NotificationDot channelIds={[channel.id]} />
|
||||
<TypingIndicator isTyping={isTyping} />
|
||||
</>
|
||||
|
@ -180,14 +180,14 @@ function ChannelTabContent(props: ChannelTabsProps & {
|
|||
return (
|
||||
<>
|
||||
<FriendsIcon />
|
||||
{!compact && <Text className={cl("name-text")}>{i18n.Messages.FRIENDS}</Text>}
|
||||
{!compact && <Text className={cl("name-text")}>{getIntlMessage("FRIENDS")}</Text>}
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<CircleQuestionIcon />
|
||||
{!compact && <Text className={cl("name-text")}>{i18n.Messages.UNKNOWN_CHANNEL}</Text>}
|
||||
{!compact && <Text className={cl("name-text")}>{getIntlMessage("UNKNOWN_CHANNEL")}</Text>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { closeModal, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
|
||||
import { Button, ChannelStore, FluxDispatcher, Forms, i18n, Menu, ReadStateStore, ReadStateUtils, Select, Text, TextInput, useState } from "@webpack/common";
|
||||
import { Button, ChannelStore, FluxDispatcher, Forms, Menu, ReadStateStore, ReadStateUtils, Select, Text, TextInput, useState } from "@webpack/common";
|
||||
|
||||
import { bookmarkFolderColors, bookmarkPlaceholderName, closeOtherTabs, closeTab, closeTabsToTheLeft, closeTabsToTheRight, createTab, hasClosedTabs, isBookmarkFolder, openedTabs, reopenClosedTab, settings, toggleCompactTab } from "../util";
|
||||
import { Bookmark, BookmarkFolder, Bookmarks, ChannelTabsProps, UseBookmarkMethods } from "../util/types";
|
||||
|
@ -177,7 +178,7 @@ export function BookmarkContextMenu({ bookmarks, index, methods }: { bookmarks:
|
|||
{bookmarkNotificationDot && !isFolder &&
|
||||
<Menu.MenuItem
|
||||
id="mark-as-read"
|
||||
label={i18n.Messages.MARK_AS_READ}
|
||||
label={getIntlMessage("MARK_AS_READ")}
|
||||
disabled={!ReadStateStore.hasUnread(bookmark.channelId)}
|
||||
action={() => ReadStateUtils.ackChannel(ChannelStore.getChannel(bookmark.channelId))}
|
||||
/>
|
||||
|
@ -287,7 +288,7 @@ export function TabContextMenu({ tab }: { tab: ChannelTabsProps; }) {
|
|||
{channel &&
|
||||
<Menu.MenuItem
|
||||
id="mark-as-read"
|
||||
label={i18n.Messages.MARK_AS_READ}
|
||||
label={getIntlMessage("MARK_AS_READ")}
|
||||
disabled={!ReadStateStore.hasUnread(channel.id)}
|
||||
action={() => ReadStateUtils.ackChannel(channel)}
|
||||
/>
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Button, Forms, i18n, Menu } from "@webpack/common";
|
||||
import { Button, Forms, Menu } from "@webpack/common";
|
||||
import { ReactElement } from "react";
|
||||
|
||||
import { preload, unload } from "./images";
|
||||
|
@ -33,7 +34,7 @@ export default definePlugin({
|
|||
|
||||
return (
|
||||
<Button size={Button.Sizes.SMALL} onClick={openQrModal}>
|
||||
{i18n.Messages.USER_SETTINGS_SCAN_QR_CODE}
|
||||
{getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")}
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
|
@ -94,21 +95,21 @@ export default definePlugin({
|
|||
insertScanQrButton: (button: ReactElement) => (
|
||||
<div className={cl("settings-btns")}>
|
||||
<Button size={Button.Sizes.SMALL} onClick={openQrModal}>
|
||||
{i18n.Messages.USER_SETTINGS_SCAN_QR_CODE}
|
||||
{getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")}
|
||||
</Button>
|
||||
{button}
|
||||
</div>
|
||||
),
|
||||
get ScanQrMenuItem() {
|
||||
return <Menu.MenuItem id="scan-qr" label={i18n.Messages.USER_SETTINGS_SCAN_QR_CODE} action={openQrModal} />;
|
||||
return <Menu.MenuItem id="scan-qr" label={getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")} action={openQrModal} />;
|
||||
},
|
||||
get ScanQrSettingsSheet() {
|
||||
return {
|
||||
section: i18n.Messages.USER_SETTINGS_SCAN_QR_CODE,
|
||||
section: getIntlMessage("USER_SETTINGS_SCAN_QR_CODE"),
|
||||
onClick: openQrModal,
|
||||
searchableTitles: [i18n.Messages.USER_SETTINGS_SCAN_QR_CODE],
|
||||
label: i18n.Messages.USER_SETTINGS_SCAN_QR_CODE,
|
||||
ariaLabel: i18n.Messages.USER_SETTINGS_SCAN_QR_CODE
|
||||
searchableTitles: [getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")],
|
||||
label: getIntlMessage("USER_SETTINGS_SCAN_QR_CODE"),
|
||||
ariaLabel: getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import {
|
||||
ModalContent,
|
||||
ModalHeader,
|
||||
|
@ -15,7 +16,6 @@ import {
|
|||
import { findByPropsLazy } from "@webpack";
|
||||
import {
|
||||
Button,
|
||||
i18n,
|
||||
RestAPI,
|
||||
Text,
|
||||
useEffect,
|
||||
|
@ -372,7 +372,7 @@ function QrModal(props: ModalProps) {
|
|||
tag="h1"
|
||||
style={{ flexGrow: 1 }}
|
||||
>
|
||||
{i18n.Messages.USER_SETTINGS_SCAN_QR_CODE}
|
||||
{getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")}
|
||||
</Text>
|
||||
</ModalHeader>
|
||||
<ModalContent scrollbarType="none">
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import {
|
||||
ModalContent,
|
||||
ModalFooter,
|
||||
|
@ -15,7 +16,6 @@ import {
|
|||
import { findByPropsLazy } from "@webpack";
|
||||
import {
|
||||
Button,
|
||||
i18n,
|
||||
RestAPI,
|
||||
Text,
|
||||
useEffect,
|
||||
|
@ -131,14 +131,14 @@ function VerifyModal({
|
|||
tag="h1"
|
||||
className={cl("device-header")}
|
||||
>
|
||||
{i18n.Messages.QR_CODE_LOGIN_SUCCESS}
|
||||
{getIntlMessage("QR_CODE_LOGIN_SUCCESS")}
|
||||
</Text>
|
||||
<Text
|
||||
variant="text-md/semibold"
|
||||
color="text-normal"
|
||||
style={{ width: "30rem" }}
|
||||
>
|
||||
{i18n.Messages.QR_CODE_LOGIN_SUCCESS_FLAVOR}
|
||||
{getIntlMessage("QR_CODE_LOGIN_SUCCESS_FLAVOR")}
|
||||
</Text>
|
||||
</>
|
||||
) : state === VerifyState.NotFound ? (
|
||||
|
@ -155,14 +155,14 @@ function VerifyModal({
|
|||
tag="h1"
|
||||
className={cl("device-header")}
|
||||
>
|
||||
{i18n.Messages.QR_CODE_NOT_FOUND}
|
||||
{getIntlMessage("QR_CODE_NOT_FOUND")}
|
||||
</Text>
|
||||
<Text
|
||||
variant="text-md/semibold"
|
||||
color="text-normal"
|
||||
style={{ width: "30rem" }}
|
||||
>
|
||||
{i18n.Messages.QR_CODE_NOT_FOUND_DESCRIPTION}
|
||||
{getIntlMessage("QR_CODE_NOT_FOUND_DESCRIPTION")}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
|
@ -179,7 +179,7 @@ function VerifyModal({
|
|||
tag="h1"
|
||||
className={cl("device-header")}
|
||||
>
|
||||
{i18n.Messages.QR_CODE_LOGIN_CONFIRM}
|
||||
{getIntlMessage("QR_CODE_LOGIN_CONFIRM")}
|
||||
</Text>
|
||||
<Text variant="text-md/semibold" color="text-danger">
|
||||
Never scan a login QR code from another user or application.
|
||||
|
@ -205,7 +205,7 @@ function VerifyModal({
|
|||
<ModalFooter className={cl("device-footer")}>
|
||||
{state === VerifyState.LoggedIn ? (
|
||||
<Button onClick={props.onClose}>
|
||||
{i18n.Messages.QR_CODE_LOGIN_FINISH_BUTTON}
|
||||
{getIntlMessage("QR_CODE_LOGIN_FINISH_BUTTON")}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
|
@ -214,8 +214,8 @@ function VerifyModal({
|
|||
onClick={props.onClose}
|
||||
>
|
||||
{state === VerifyState.NotFound
|
||||
? i18n.Messages.CLOSE
|
||||
: i18n.Messages.CANCEL}
|
||||
? getIntlMessage("CLOSE")
|
||||
: getIntlMessage("CANCEL")}
|
||||
</Button>
|
||||
)}
|
||||
</ModalFooter>
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||
import { ChannelStore, GuildStore, i18n, RelationshipStore, UserStore } from "@webpack/common";
|
||||
import { ChannelStore, GuildStore, RelationshipStore, UserStore } from "@webpack/common";
|
||||
|
||||
const { getName } = findByPropsLazy("getName", "useName", "getNickname");
|
||||
const computeChannelName = findByCodeLazy(".isThread())return'\"'.concat(");
|
||||
|
@ -39,7 +40,7 @@ export default definePlugin({
|
|||
if (message.type === MessageTypes.REPLY && message.referenced_message?.author) {
|
||||
const replyUser = UserStore.getUser(message.referenced_message.author.id);
|
||||
const replyUsername = getName(channel.guild_id, channel.id, replyUser);
|
||||
title = i18n.Messages.CHANNEL_MESSAGE_REPLY_A11Y_LABEL.format({
|
||||
title = getIntlMessage("CHANNEL_MESSAGE_REPLY_A11Y_LABEL", {
|
||||
author: username,
|
||||
repliedAuthor: replyUsername,
|
||||
});
|
||||
|
|
|
@ -8,10 +8,11 @@ import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
|||
import { CodeBlock } from "@components/CodeBlock";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { closeModal, ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Forms, i18n, Menu, Text } from "@webpack/common";
|
||||
import { Forms, Menu, Text } from "@webpack/common";
|
||||
import { Message } from "discord-types/general";
|
||||
|
||||
type CustomMessage = Message & { editHistory?: any; deleted?: any; firstEditTimestamp?: any; };
|
||||
|
@ -64,7 +65,7 @@ function openViewRawModal(obj: any, type: string, isMessage?: boolean) {
|
|||
|
||||
function makeContextCallback(name: string, action: (any) => void): NavContextMenuPatchCallback {
|
||||
return (children, props) => {
|
||||
if (props.label === i18n.Messages.CHANNEL_ACTIONS_MENU_LABEL) return; // random shit like notification settings
|
||||
if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) return; // random shit like notification settings
|
||||
|
||||
const value = props[name];
|
||||
if (!value) return;
|
||||
|
|
|
@ -9,12 +9,12 @@ import { classNameFactory } from "@api/Styles";
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Flex } from "@components/Flex";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import { openUserProfile } from "@utils/discord";
|
||||
import { getIntlMessage, openUserProfile } from "@utils/discord";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { classes } from "@utils/misc";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
|
||||
import { Clickable, Forms, i18n, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { Clickable, Forms, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
|
||||
interface WatchingProps {
|
||||
|
@ -46,7 +46,7 @@ function Watching({ userIds, guildId }: WatchingProps): JSX.Element {
|
|||
<div className={cl("content")}>
|
||||
{userIds.length ?
|
||||
(<>
|
||||
<Forms.FormTitle>{i18n.Messages.SPECTATORS.format({ numViewers: userIds.length })}</Forms.FormTitle>
|
||||
<Forms.FormTitle>{getIntlMessage("SPECTATORS", { numViewers: userIds.length })}</Forms.FormTitle>
|
||||
<Flex flexDirection="column" style={{ gap: 6 }} >
|
||||
{users.map(user => (
|
||||
<Flex flexDirection="row" style={{ gap: 6, alignContent: "center" }} className={cl("user")} >
|
||||
|
@ -54,7 +54,7 @@ function Watching({ userIds, guildId }: WatchingProps): JSX.Element {
|
|||
{getUsername(user)}
|
||||
</Flex>
|
||||
))}
|
||||
{missingUsers > 0 && <span className={cl("more_users")}>{`+${i18n.Messages.NUM_USERS.format({ num: missingUsers })}`}</span>}
|
||||
{missingUsers > 0 && <span className={cl("more_users")}>{`+${getIntlMessage("NUM_USERS", { num: missingUsers })}`}</span>}
|
||||
</Flex>
|
||||
</>)
|
||||
: (<span className={cl("no_viewers")}>No spectators</span>)}
|
||||
|
@ -121,7 +121,7 @@ export default definePlugin({
|
|||
{users.length ?
|
||||
<>
|
||||
<Forms.FormTitle tag="h3" style={{ marginTop: 8, marginBottom: 0, textTransform: "uppercase" }}>
|
||||
{i18n.Messages.SPECTATORS.format({ numViewers: userIds.length })}
|
||||
{getIntlMessage("SPECTATORS", { numViewers: userIds.length })}
|
||||
</Forms.FormTitle>
|
||||
<UserSummaryItem
|
||||
users={users}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue