diff --git a/src/core/i18n/default.json b/src/core/i18n/default.json index 4249051..58ccaa2 100644 --- a/src/core/i18n/default.json +++ b/src/core/i18n/default.json @@ -1,5 +1,7 @@ { "ABOUT": "About", + "PLUGIN_REFETCH_SUCCESSFUL": "Successfully refetched plugin!", + "PLUGIN_REFETCH_FAILED": "Failed to refetch plugin!", "ACTIONS": "Actions", "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.", @@ -63,6 +65,7 @@ "OPEN_IN_BROWSER": "Open in Browser", "OPERATING_SYSTEM": "Operating System", "OVERFLOW_PLUGIN_SETTINGS": "Plugin settings", + "TOASTS_PLUGIN_UPDATE": "{update, select, true {Enabled} false {Disabled}} updates for {name}.", "PLATFORM": "Platform", "PLUGINS": "Plugins", "REFETCH": "Refetch", diff --git a/src/core/ui/components/PluginCard.tsx b/src/core/ui/components/PluginCard.tsx index 35e8c18..52384b2 100644 --- a/src/core/ui/components/PluginCard.tsx +++ b/src/core/ui/components/PluginCard.tsx @@ -66,9 +66,9 @@ export default function PluginCard({ item: plugin, index }: CardWrapper { stopThenStart(plugin, () => { fetchPlugin(plugin.id).then(async () => { - showToast("Successfully refetched plugin.", getAssetIDByName("toast_image_saved")); + showToast(Strings.PLUGIN_REFETCH_SUCCESSFUL, getAssetIDByName("toast_image_saved")); }).catch(() => { - showToast("Failed to refetch plugin!", getAssetIDByName("Small")); + showToast(Strings.PLUGIN_REFETCH_FAILED, getAssetIDByName("Small")); }); }); }, @@ -86,7 +86,7 @@ export default function PluginCard({ item: plugin, index }: CardWrapper { plugin.update = !plugin.update; - showToast(`${plugin.update ? "Enabled" : "Disabled"} updates for ${plugin.manifest.name}.`, getAssetIDByName("toast_image_saved")); + showToast(formatString("TOASTS_PLUGIN_UPDATE", { update: plugin.update, name: plugin.manifest.name }), getAssetIDByName("toast_image_saved")); } }, { diff --git a/src/lib/ui/safeMode.tsx b/src/lib/ui/safeMode.tsx index 025ce96..65c29d3 100644 --- a/src/lib/ui/safeMode.tsx +++ b/src/lib/ui/safeMode.tsx @@ -49,7 +49,7 @@ const styles = createThemedStyleSheet({ interface Tab { id: string; - title: string; + title: () => string; trimWhitespace?: boolean; } @@ -62,9 +62,9 @@ interface Button { } const tabs: Tab[] = [ - { id: "message", title: Strings.MESSAGE }, - { id: "stack", title: Strings.STACK_TRACE }, - { id: "componentStack", title: Strings.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) { @@ -96,7 +96,7 @@ export default () => after("render", ErrorBoundary.prototype, function (this: an {/* Are errors caught by ErrorBoundary guaranteed to have the component stack? */} ({ ...t, title: t.title() }))} activeTab={this.state.activeTab} onTabSelected={(tab: string) => { this.setState({ activeTab: tab }); }} />