* feat(i18n): Add translation keys and implement localization for 80+ plugins
- Add comprehensive translation keys to i18n/en-US/vencord.json
- Update all plugins to use t() function from @utils/translation
- Replace hardcoded strings with translation function calls
- Support plural forms with _one/_other suffixes
- Use Translate component for strings with embedded JSX
Plugins translated include:
- Core: reviewDB, translate, voiceMessages, messageLogger
- UI: showHiddenChannels, customRPC, clientTheme, permissionsViewer
- Utility: betterSessions, betterSettings, memberCount, betterFolders
- Social: relationshipNotifier, messageLatency, whoReacted
- Media: imageZoom, viewIcons, viewRaw, decor, fakeNitro
- And 60+ more plugins
All changes pass TypeScript compilation.
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* feat(i18n): Add equicord.json for equicordplugins localization
- Create i18n/en-US/equicord.json with messageLoggerEnhanced translation keys
- Create empty equicord.json files for all other locales (Crowdin will handle translations)
- Build system automatically picks up all JSON files in i18n/{locale}/
* Update i18n/en-US/vencord.json
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* feat(i18n): Add translations to 200 equicordplugins
- Translate all user-facing strings in equicordplugins to use t() function
- Add translation keys to i18n/en-US/equicord.json
- Plugin names remain static strings for build system compatibility
- Settings descriptions, tooltips, context menus, and UI strings now translatable
* FileUpload: add sharex file support (#771)
* FileUpload: add sharex file support
Quick note, the settings seem to split pacal case with spaces for some reason,
so `ShareX` renders as `Share X`. This is stupid and im upset and I dont think
theres anything I can do about it
* FileUpload: use Headers object to construct HTTP headers
* Update vencord.json
---------
Co-authored-by: Mishal <91066601+mishalhossin@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Key <keircn@proton.me>
Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
148 lines
4.9 KiB
TypeScript
148 lines
4.9 KiB
TypeScript
/*
|
|
* Vencord, a Discord client mod
|
|
* Copyright (c) 2024 Vendicated and contributors
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
import "./styles.css";
|
|
|
|
import { playAudio } from "@api/AudioPlayer";
|
|
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
|
import { definePluginSettings } from "@api/Settings";
|
|
import { Button } from "@components/Button";
|
|
import { Devs } from "@utils/constants";
|
|
import { classNameFactory } from "@utils/css";
|
|
import { t } from "@utils/translation";
|
|
import definePlugin, { OptionType } from "@utils/types";
|
|
import { findComponentByCodeLazy } from "@webpack";
|
|
import { ChannelActions, Constants, GuildStore, IconUtils, MediaEngineStore, Menu, RestAPI, SearchableSelect, SelectedChannelStore, TextInput, Toasts } from "@webpack/common";
|
|
|
|
const cl = classNameFactory("vc-exitsounds-");
|
|
|
|
const PlayIcon = findComponentByCodeLazy("4.96v14.08c0");
|
|
|
|
function GuildSelector() {
|
|
const { soundGuildId } = settings.use(["soundGuildId"]);
|
|
const options = Object.values(GuildStore.getGuilds()).map(g => ({
|
|
value: g.id,
|
|
label: g.name
|
|
}));
|
|
|
|
return (
|
|
<SearchableSelect
|
|
options={options}
|
|
value={options.find(o => o.value === soundGuildId)}
|
|
placeholder={t("exitSounds.ui.selectServer")}
|
|
maxVisibleItems={6}
|
|
closeOnSelect={true}
|
|
onChange={v => settings.store.soundGuildId = v}
|
|
renderOptionPrefix={o => {
|
|
const guild = GuildStore.getGuild(o?.value);
|
|
if (!guild?.icon) return null;
|
|
return (
|
|
<img
|
|
className={cl("guild-icon")}
|
|
src={IconUtils.getGuildIconURL({ id: guild.id, icon: guild.icon, size: 32 })!}
|
|
/>
|
|
);
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function SoundIdInput() {
|
|
const { soundId } = settings.use(["soundId"]);
|
|
|
|
return (
|
|
<div className={cl("input-row")}>
|
|
<div className={cl("input-wrapper")}>
|
|
<TextInput
|
|
value={soundId}
|
|
onChange={v => settings.store.soundId = v}
|
|
placeholder={t("exitSounds.ui.enterSoundId")}
|
|
/>
|
|
</div>
|
|
<Button
|
|
onClick={() => playAudio(`https://${window.GLOBAL_ENV.CDN_HOST}/soundboard-sounds/${soundId}`, { volume: 50 })}
|
|
disabled={!soundId}
|
|
>
|
|
<PlayIcon color="currentColor" />
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const settings = definePluginSettings({
|
|
soundGuildId: {
|
|
type: OptionType.COMPONENT,
|
|
description: t("exitSounds.settings.soundGuildId"),
|
|
component: GuildSelector
|
|
},
|
|
soundId: {
|
|
type: OptionType.COMPONENT,
|
|
description: t("exitSounds.settings.soundId"),
|
|
component: SoundIdInput
|
|
}
|
|
});
|
|
|
|
const SoundButtonContext: NavContextMenuPatchCallback = (children, { sound }: { sound: { soundId: string; guildId: string; }; }) => {
|
|
children.splice(1, 0,
|
|
<Menu.MenuGroup>
|
|
<Menu.MenuItem
|
|
id="set-global-exit-sound"
|
|
label={t("exitSounds.ui.setGlobalExitSound")}
|
|
action={() => {
|
|
settings.store.soundGuildId = sound.guildId;
|
|
settings.store.soundId = sound.soundId;
|
|
}}
|
|
/>
|
|
</Menu.MenuGroup>
|
|
);
|
|
};
|
|
|
|
let original: typeof ChannelActions.selectVoiceChannel;
|
|
|
|
export default definePlugin({
|
|
name: "ExitSounds",
|
|
description: t("exitSounds.description"),
|
|
authors: [Devs.prism],
|
|
dependencies: ["AudioPlayerAPI"],
|
|
settings,
|
|
|
|
contextMenus: {
|
|
"sound-button-context": SoundButtonContext
|
|
},
|
|
|
|
start() {
|
|
original = ChannelActions.selectVoiceChannel;
|
|
ChannelActions.selectVoiceChannel = async (id: string | null, ...args: unknown[]) => {
|
|
const { soundGuildId, soundId } = settings.store;
|
|
const voiceId = SelectedChannelStore.getVoiceChannelId();
|
|
|
|
if (soundGuildId && soundId && voiceId !== id && !MediaEngineStore.isDeaf()) {
|
|
try {
|
|
await RestAPI.post({
|
|
url: Constants.Endpoints.SEND_SOUNDBOARD_SOUND(voiceId),
|
|
body: {
|
|
sound_id: soundId,
|
|
source_guild_id: soundGuildId
|
|
}
|
|
});
|
|
await new Promise(r => setTimeout(r, 500));
|
|
} catch {
|
|
Toasts.show({
|
|
message: t("exitSounds.toasts.somethingWentWrong"),
|
|
id: Toasts.genId(),
|
|
type: Toasts.Type.FAILURE
|
|
});
|
|
}
|
|
}
|
|
|
|
return original(id, ...args);
|
|
};
|
|
},
|
|
|
|
stop() {
|
|
ChannelActions.selectVoiceChannel = original;
|
|
}
|
|
});
|