Update some strings
This commit is contained in:
parent
218d09a5a3
commit
cea9b1c7ba
13 changed files with 54 additions and 37 deletions
|
|
@ -3,6 +3,7 @@
|
|||
"ARE_YOU_SURE_TO_CLEAR_DATA": "Are you sure you wish to clear the data of {name}?",
|
||||
"ARE_YOU_SURE_TO_DELETE_PLUGIN": "Are you sure you wish to delete {name}? This will clear all of the plugin's data.",
|
||||
"ARE_YOU_SURE_TO_DELETE_THEME": "Are you sure you wish to delete {name}?",
|
||||
"ASSET_BROWSER": "Asset Browser",
|
||||
"BRAND": "Brand",
|
||||
"BUNNY": "Bunny",
|
||||
"BUNNY_URL": "Bunny URL",
|
||||
|
|
@ -20,10 +21,14 @@
|
|||
"COMMAND_EVAL_OPT_CODE": "The code to evaluate.",
|
||||
"COMMAND_PLUGINS_DESC": "Send list of installed plugins.",
|
||||
"COMMAND_PLUGINS_OPT_EPHEMERALLY": "Send plugins list ephemerally.",
|
||||
"COMPONENT": "Component",
|
||||
"CONFIRMATION_LINK_IS_A_TYPE": "This link is a **{urlType, select, plugin {Plugin} theme {Theme} other {Add-on}}**, would you like to install it?",
|
||||
"CONNECT_TO_DEBUG_WEBSOCKET": "Connect to debug websocket",
|
||||
"CONNECT_TO_REACT_DEVTOOLS": "Connect to React DevTools",
|
||||
"COPIED_TO_CLIPBOARD": "Copied plugin URL to clipboard",
|
||||
"COPY_URL": "Copy URL",
|
||||
"DEBUG": "Debug",
|
||||
"DEBUGGER_URL": "Debugger URL",
|
||||
"DELETE": "Delete",
|
||||
"DEVELOPER": "Developer",
|
||||
"DEVELOPER_SETTINGS": "Developer Settings",
|
||||
|
|
@ -31,26 +36,31 @@
|
|||
"DISABLE_UPDATES": "Disable updates",
|
||||
"DISCORD_SERVER": "Discord Server",
|
||||
"ENABLE_UPDATES": "Enable updates",
|
||||
"ERROR_BOUNDARY_TOOLS_LABEL": "ErrorBoundary Tools",
|
||||
"GENERAL": "General",
|
||||
"GITHUB": "GitHub",
|
||||
"HOLD_UP": "Hold Up",
|
||||
"INFO": "Info",
|
||||
"INSTALL": "Install",
|
||||
"INSTALL_ADDON": "Install Add-on",
|
||||
"INSTALL_PLUGIN": "Install Plugin",
|
||||
"INSTALL_THEME": "Install Theme",
|
||||
"INSTALL_TITLE": "Install {title}",
|
||||
"LINKS": "Links",
|
||||
"LOAD_FROM_CUSTOM_URL": "Load from custom url",
|
||||
"LOAD_FROM_CUSTOM_URL_DEC": "Load Bunny from a custom endpoint.",
|
||||
"LOAD_REACT_DEVTOOLS": "Load React DevTools",
|
||||
"LOADER": "Loader",
|
||||
"MACHINE_ID": "Machine ID",
|
||||
"MANUFACTURER": "Manufacturer",
|
||||
"MESSAGE": "Message",
|
||||
"MODAL_THEME_REFETCHED": "Theme refetched",
|
||||
"MODAL_THEME_REFETCHED_DESC": "A reload is required to see the changes. Do you want to reload now?",
|
||||
"MODAL_UNPROXIED_PLUGIN_DESC": "The plugin you are trying to install has not been proxied/verified by staffs. Are you sure you want to continue?",
|
||||
"MODAL_UNPROXIED_PLUGIN_HEADER": "Unproxied Plugin",
|
||||
"MODEL": "Model",
|
||||
"OPEN_IN_BROWSER": "Open in Browser",
|
||||
"OPERATING_SYSTEM": "Operating System",
|
||||
"OVERFLOW_PLUGIN_SETTINGS": "Plugin settings",
|
||||
"PHONE_MODEL": "Model",
|
||||
"PLATFORM": "Platform",
|
||||
"PLUGINS": "Plugins",
|
||||
"REFETCH": "Refetch",
|
||||
|
|
@ -61,20 +71,22 @@
|
|||
"RELOAD_IN_SAFE_MODE": "Reload in Safe Mode",
|
||||
"RELOAD_IN_SAFE_MODE_DESC": "This will reload Discord without loading addons",
|
||||
"RETRY": "Retry",
|
||||
"RETRY_RENDER": "Retry Render",
|
||||
"SAFE_MODE": "Safe Mode",
|
||||
"SAFE_MODE_NOTICE_PLUGINS": "You are in Safe Mode, so plugins cannot be loaded. Disable any misbehaving plugins, then return to Normal Mode from the General settings page.",
|
||||
"SAFE_MODE_NOTICE_THEMES": "You are in Safe Mode, meaning themes have been temporarily disabled.",
|
||||
"SAFE_MODE_NOTICE_THEMES_EXTEND": "If a theme appears to be causing the issue, you can press below to disable it persistently.",
|
||||
"SAFE_MODE_NOTICE_THEMES": "You are in Safe Mode, meaning themes have been temporarily disabled.{enabled, select, true { If a theme appears to be causing the issue, you can press below to disable it persistently.}}",
|
||||
"SEARCH": "Search",
|
||||
"STACK_TRACE": "Stack Trace",
|
||||
"SUCCESSFULLY_INSTALLED": "Successfully installed",
|
||||
"THEME_REFETCH_FAILED": "Failed to refetch theme!",
|
||||
"THEME_REFETCH_SUCCESSFUL": "Successfully refetched theme.",
|
||||
"THEMES": "Themes",
|
||||
"THEMES_RELOAD_FOR_CHANGES": "Reload the app to fully apply changes!",
|
||||
"TOASTS_INSTALLED_PLUGIN": "Installed plugin",
|
||||
"TOASTS_SUCCESSFULLY_INSTALLED": "Successfully installed",
|
||||
"TOASTS_COPIED_TO_CLIPBOARD": "Copied plugin URL to clipboard",
|
||||
"UH_OH": "Uh oh.",
|
||||
"UNINSTALL": "Uninstall",
|
||||
"UNINSTALL_TITLE": "Uninstall {title}",
|
||||
"URL_PLACEHOLDER": "https://example.com",
|
||||
"VERSION": "Version",
|
||||
"VERSIONS": "Versions"
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { findByName } from "@lib/metro/filters";
|
||||
import { PrimitiveType } from "intl-messageformat";
|
||||
|
||||
import langDefault from "./default.json";
|
||||
|
||||
|
|
@ -12,9 +13,9 @@ export const Strings = new Proxy({}, {
|
|||
}
|
||||
}) as Record<I18nKey, string>;
|
||||
|
||||
type FRet<T> = T extends string ? string : string | T | (string | T)[];
|
||||
type FormatStringRet<T> = T extends PrimitiveType ? string : string | T | (string | T)[];
|
||||
|
||||
export function formatString<T = void>(key: I18nKey, val: Record<string, T>): FRet<T> {
|
||||
export function formatString<T = void>(key: I18nKey, val: Record<string, T>): FormatStringRet<T> {
|
||||
const str = Strings[key];
|
||||
// @ts-ignore
|
||||
return new IntlMessageFormat(str).format(val);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function typeFromUrl(url: string) {
|
|||
function installWithToast(type: "plugin" | "theme", url: string) {
|
||||
(type === "plugin" ? installPlugin : installTheme)(url)
|
||||
.then(() => {
|
||||
showToast(Strings.TOASTS_SUCCESSFULLY_INSTALLED, getAssetIDByName("Check"));
|
||||
showToast(Strings.SUCCESSFULLY_INSTALLED, getAssetIDByName("Check"));
|
||||
})
|
||||
.catch((e: Error) => {
|
||||
showToast(e.message, getAssetIDByName("Small"));
|
||||
|
|
@ -49,7 +49,7 @@ export default () => {
|
|||
if (!urlType) return;
|
||||
|
||||
options.push({
|
||||
label: formatString("INSTALL_TITLE", { urlType }),
|
||||
label: Strings.INSTALL_ADDON,
|
||||
onPress: () => installWithToast(urlType, url),
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { formatString, Strings } from "@core/i18n";
|
||||
import { Strings } from "@core/i18n";
|
||||
import { CardWrapper } from "@core/ui/components/Card";
|
||||
import { getAssetIDByName } from "@lib/api/assets";
|
||||
import { useProxy } from "@lib/api/storage";
|
||||
|
|
@ -14,6 +14,7 @@ import { FlatList, View } from "react-native";
|
|||
|
||||
interface AddonPageProps<T> {
|
||||
title: string;
|
||||
floatingButtonText: string;
|
||||
fetchFunction: (url: string) => Promise<void>;
|
||||
items: Record<string, T & { id: string; }>;
|
||||
safeModeMessage: string;
|
||||
|
|
@ -38,7 +39,7 @@ function getItemsByQuery<T extends { id?: string; }>(items: T[], query: string):
|
|||
const reanimated = findByProps("useSharedValue");
|
||||
const { FloatingActionButton } = findByProps("FloatingActionButton");
|
||||
|
||||
export default function AddonPage<T>({ title, fetchFunction, items, safeModeMessage, safeModeExtras, card: CardComponent }: AddonPageProps<T>) {
|
||||
export default function AddonPage<T>({ title, floatingButtonText, fetchFunction, items, safeModeMessage, safeModeExtras, card: CardComponent }: AddonPageProps<T>) {
|
||||
useProxy(settings);
|
||||
useProxy(items);
|
||||
|
||||
|
|
@ -73,16 +74,16 @@ export default function AddonPage<T>({ title, fetchFunction, items, safeModeMess
|
|||
renderItem={({ item, index }) => <CardComponent item={item} index={index} />}
|
||||
/>
|
||||
<FloatingActionButton
|
||||
text={formatString("INSTALL_TITLE", { title })}
|
||||
text={floatingButtonText}
|
||||
icon={getAssetIDByName("DownloadIcon")}
|
||||
state={{ collapseText }}
|
||||
onPress={() => {
|
||||
// from ./InstallButton.tsx
|
||||
clipboard.getString().then(content =>
|
||||
showInputAlert({
|
||||
title: formatString("INSTALL_TITLE", { title }),
|
||||
title: floatingButtonText,
|
||||
initialValue: content.match(HTTP_REGEX_MULTI)?.[0] ?? "",
|
||||
placeholder: "https://example.com/",
|
||||
placeholder: Strings.URL_PLACEHOLDER,
|
||||
onConfirm: (input: string) => fetchFunction(input),
|
||||
confirmText: Strings.INSTALL,
|
||||
cancelText: Strings.CANCEL,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export default function InstallButton({ alertTitle, installFunction: fetchFuncti
|
|||
showInputAlert({
|
||||
title: alertTitle,
|
||||
initialValue: content.match(HTTP_REGEX_MULTI)?.[0] ?? "",
|
||||
placeholder: "https://example.com/",
|
||||
placeholder: Strings.URL_PLACEHOLDER,
|
||||
onConfirm: (input: string) => fetchFunction(input),
|
||||
confirmText: Strings.INSTALL,
|
||||
cancelText: Strings.CANCEL,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export default function AssetBrowser() {
|
|||
<Search
|
||||
style={{ margin: 10 }}
|
||||
onChangeText={(v: string) => setSearch(v)}
|
||||
placeholder="Search"
|
||||
/>
|
||||
<FlatList
|
||||
data={Object.values(all).filter(a => a.name.includes(search) || a.id.toString() === search)}
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@ export default function Developer() {
|
|||
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 38 }}>
|
||||
<Stack style={{ paddingVertical: 24, paddingHorizontal: 12 }} spacing={24}>
|
||||
<TextInput
|
||||
label="Debugger URL"
|
||||
label={Strings.DEBUGGER_URL}
|
||||
placeholder="127.0.0.1:9090"
|
||||
size="md"
|
||||
leadingIcon={() => <FormText style={styles.leadingText}>ws://</FormText>}
|
||||
defaultValue={settings.debuggerUrl}
|
||||
onChange={(v: string) => settings.debuggerUrl = v}
|
||||
/>
|
||||
<TableRowGroup title="Debug">
|
||||
<TableRowGroup title={Strings.DEBUG}>
|
||||
<TableRow
|
||||
label={Strings.CONNECT_TO_DEBUG_WEBSOCKET}
|
||||
icon={<TableRow.Icon source={getAssetIDByName("copy")} />}
|
||||
|
|
@ -64,8 +64,8 @@ export default function Developer() {
|
|||
{isLoaderConfigSupported() && <>
|
||||
<TableRowGroup title="Loader config">
|
||||
<TableSwitchRow
|
||||
label="Load from custom url"
|
||||
subLabel={"Load Bunny from a custom endpoint."}
|
||||
label={Strings.LOAD_FROM_CUSTOM_URL}
|
||||
subLabel={Strings.LOAD_FROM_CUSTOM_URL_DEC}
|
||||
icon={<TableRow.Icon source={getAssetIDByName("copy")} />}
|
||||
value={loaderConfig.customLoadUrl.enabled}
|
||||
onValueChange={(v: boolean) => {
|
||||
|
|
@ -80,8 +80,8 @@ export default function Developer() {
|
|||
label={Strings.BUNNY_URL}
|
||||
/>} />}
|
||||
{isReactDevToolsPreloaded() && <TableSwitchRow
|
||||
label="Load React DevTools"
|
||||
subLabel={`Version: ${getReactDevToolsVersion()}`}
|
||||
label={Strings.LOAD_REACT_DEVTOOLS}
|
||||
subLabel={`${Strings.VERSION}: ${getReactDevToolsVersion()}`}
|
||||
icon={<TableRow.Icon source={getAssetIDByName("ic_badge_staff")} />}
|
||||
value={loaderConfig.loadReactDevTools}
|
||||
onValueChange={(v: boolean) => {
|
||||
|
|
@ -93,17 +93,17 @@ export default function Developer() {
|
|||
<TableRowGroup title="Other">
|
||||
<TableRow
|
||||
arrow
|
||||
label="Asset Browser"
|
||||
label={Strings.ASSET_BROWSER}
|
||||
icon={<TableRow.Icon source={getAssetIDByName("ic_image")} />}
|
||||
trailing={TableRow.Arrow}
|
||||
onPress={() => navigation.push("VendettaCustomPage", {
|
||||
title: "Asset Browser",
|
||||
title: Strings.ASSET_BROWSER,
|
||||
render: AssetBrowser,
|
||||
})}
|
||||
/>
|
||||
<TableRow
|
||||
arrow
|
||||
label="ErrorBoundary Tools"
|
||||
label={Strings.ERROR_BOUNDARY_TOOLS_LABEL}
|
||||
icon={<TableRow.Icon source={getAssetIDByName("ic_warning_24px")} />}
|
||||
onPress={() => showSimpleActionSheet({
|
||||
key: "ErrorBoundaryTools",
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export default function General() {
|
|||
icon: "ic_settings_boost_24px"
|
||||
},
|
||||
{
|
||||
label: Strings.PHONE_MODEL,
|
||||
label: Strings.MODEL,
|
||||
version: debugInfo.device.model,
|
||||
icon: "ic_phonelink_24px"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export default function Plugins() {
|
|||
return (
|
||||
<AddonPage<BunnyPlugin>
|
||||
title={Strings.PLUGINS}
|
||||
floatingButtonText={Strings.INSTALL_PLUGIN}
|
||||
fetchFunction={installPlugin}
|
||||
items={plugins}
|
||||
safeModeMessage={Strings.SAFE_MODE_NOTICE_PLUGINS}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Strings } from "@core/i18n";
|
||||
import { formatString, Strings } from "@core/i18n";
|
||||
import AddonPage from "@core/ui/components/AddonPage";
|
||||
import ThemeCard from "@core/ui/components/ThemeCard";
|
||||
import { useProxy } from "@lib/api/storage";
|
||||
|
|
@ -13,9 +13,10 @@ export default function Themes() {
|
|||
return (
|
||||
<AddonPage<Theme>
|
||||
title={Strings.THEMES}
|
||||
floatingButtonText={Strings.INSTALL_THEME}
|
||||
fetchFunction={installTheme}
|
||||
items={themes}
|
||||
safeModeMessage={`${Strings.SAFE_MODE_NOTICE_THEMES}${settings.safeMode?.currentThemeId ? ` ${Strings.SAFE_MODE_NOTICE_THEMES_EXTEND}` : ""}`}
|
||||
safeModeMessage={formatString("SAFE_MODE_NOTICE_THEMES", { enabled: Boolean(settings.safeMode?.currentThemeId) })}
|
||||
safeModeExtras={settings.safeMode?.currentThemeId ? <Button
|
||||
text={Strings.DISABLE_THEME}
|
||||
color={ButtonColors.BRAND}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { Strings } from "@core/i18n";
|
||||
import { DeviceManager } from "@lib/api/native/modules";
|
||||
import { after } from "@lib/api/patcher";
|
||||
import { _toggleSafeMode } from "@lib/debug";
|
||||
|
|
@ -61,9 +62,9 @@ interface Button {
|
|||
}
|
||||
|
||||
const tabs: Tab[] = [
|
||||
{ id: "message", title: "Message" },
|
||||
{ id: "stack", title: "Stack Trace" },
|
||||
{ id: "componentStack", title: "Component", trimWhitespace: true },
|
||||
{ id: "message", title: Strings.MESSAGE },
|
||||
{ id: "stack", title: Strings.STACK_TRACE },
|
||||
{ id: "componentStack", title: Strings.COMPONENT, trimWhitespace: true },
|
||||
];
|
||||
|
||||
export default () => after("render", ErrorBoundary.prototype, function (this: any, _, ret) {
|
||||
|
|
@ -76,9 +77,9 @@ export default () => after("render", ErrorBoundary.prototype, function (this: an
|
|||
|
||||
// This is in the patch and not outside of it so that we can use `this`, e.g. for setting state
|
||||
const buttons: Button[] = [
|
||||
{ text: "Restart Discord", onPress: this.handleReload },
|
||||
...!settings.safeMode?.enabled ? [{ text: "Restart in Safe Mode", onPress: _toggleSafeMode }] : [],
|
||||
{ text: "Retry Render", color: ButtonColors.RED, onPress: () => this.setState({ info: null, error: null }) },
|
||||
{ text: Strings.RELOAD_DISCORD, onPress: this.handleReload },
|
||||
...!settings.safeMode?.enabled ? [{ text: Strings.RELOAD_IN_SAFE_MODE, onPress: _toggleSafeMode }] : [],
|
||||
{ text: Strings.RETRY_RENDER, color: ButtonColors.RED, onPress: () => this.setState({ info: null, error: null }) },
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { NavigationNative } from "@lib/metro/common";
|
||||
import { findByProps } from "@lib/metro/filters";
|
||||
import { ErrorBoundary } from "@lib/ui/components";
|
||||
import { RowConfig } from "@lib/ui/settings";
|
||||
|
||||
const tabsNavigationRef = findByProps("getRootNavigationRef");
|
||||
|
|
@ -12,7 +13,7 @@ export const CustomPageRenderer = React.memo(() => {
|
|||
|
||||
React.useEffect(() => void navigation.setOptions({ ...args }), []);
|
||||
|
||||
return <PageComponent />;
|
||||
return <ErrorBoundary><PageComponent /></ErrorBoundary>;
|
||||
});
|
||||
|
||||
export function wrapOnPress(
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export const showToast = (content: string, asset?: number) => toasts.open({
|
|||
icon: asset,
|
||||
});
|
||||
|
||||
showToast.showCopyToClipboard = (message = Strings.TOASTS_COPIED_TO_CLIPBOARD) => {
|
||||
showToast.showCopyToClipboard = (message = Strings.COPIED_TO_CLIPBOARD) => {
|
||||
// On Android, only show toast for 12 and lower
|
||||
if (Platform.OS !== "android" || Platform.Version <= 32) {
|
||||
showToast(message, getAssetIDByName("toast_copy_link"));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue