mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
* Update zh-tw string table (till 975343d2)
* Prepare localization table
* Implement i18n for Performers & Tags
* Add "add" action strings
* Use Lodash merge for deep merging language JSONs
The original implementation does not properly merge language files, causing unexpected localization string fallback behavior.
* Localize pagination strings
* Use Field name value as null id fallback
...otherwise FormattedMessage is gonna throw when the ID is null
* Use localized "Path" string for all instances
* Localize the "Interface" tab under settings
* Localize scene & performer cards
* Rename locale folder for better compatibility with i18n-ally
* Localize majority of the categories and features
78 lines
2.0 KiB
TypeScript
78 lines
2.0 KiB
TypeScript
import React, { useState } from "react";
|
|
import { Form } from "react-bootstrap";
|
|
import { mutateExportObjects } from "src/core/StashService";
|
|
import { Modal } from "src/components/Shared";
|
|
import { useToast } from "src/hooks";
|
|
import { downloadFile } from "src/utils";
|
|
import { ExportObjectsInput } from "src/core/generated-graphql";
|
|
import { useIntl } from "react-intl";
|
|
|
|
interface IExportDialogProps {
|
|
exportInput: ExportObjectsInput;
|
|
onClose: () => void;
|
|
}
|
|
|
|
export const ExportDialog: React.FC<IExportDialogProps> = (
|
|
props: IExportDialogProps
|
|
) => {
|
|
const [includeDependencies, setIncludeDependencies] = useState(true);
|
|
|
|
// Network state
|
|
const [isRunning, setIsRunning] = useState(false);
|
|
|
|
const intl = useIntl();
|
|
const Toast = useToast();
|
|
|
|
async function onExport() {
|
|
try {
|
|
setIsRunning(true);
|
|
const ret = await mutateExportObjects({
|
|
...props.exportInput,
|
|
includeDependencies,
|
|
});
|
|
|
|
// download the result
|
|
if (ret.data && ret.data.exportObjects) {
|
|
const link = ret.data.exportObjects;
|
|
downloadFile(link);
|
|
}
|
|
} catch (e) {
|
|
Toast.error(e);
|
|
} finally {
|
|
setIsRunning(false);
|
|
props.onClose();
|
|
}
|
|
}
|
|
|
|
return (
|
|
<Modal
|
|
show
|
|
icon="cogs"
|
|
header={intl.formatMessage({ id: "dialogs.export_title" })}
|
|
accept={{
|
|
onClick: onExport,
|
|
text: intl.formatMessage({ id: "actions.export" }),
|
|
}}
|
|
cancel={{
|
|
onClick: () => props.onClose(),
|
|
text: intl.formatMessage({ id: "actions.cancel" }),
|
|
variant: "secondary",
|
|
}}
|
|
isRunning={isRunning}
|
|
>
|
|
<Form>
|
|
<Form.Group>
|
|
<Form.Check
|
|
id="include-dependencies"
|
|
checked={includeDependencies}
|
|
label={intl.formatMessage({
|
|
id: "dialogs.export_include_related_objects",
|
|
})}
|
|
onChange={() => setIncludeDependencies(!includeDependencies)}
|
|
/>
|
|
</Form.Group>
|
|
</Form>
|
|
</Modal>
|
|
);
|
|
};
|