fix(ui): localize text

This commit is contained in:
Rohinish 2024-03-14 00:27:56 +05:30 committed by psychedelicious
parent c1de129bbc
commit d45931a0af
4 changed files with 39 additions and 17 deletions

View File

@ -1435,9 +1435,17 @@
"undo": "Undo" "undo": "Undo"
}, },
"workflows": { "workflows": {
"ascending": "Ascending",
"created": "Created",
"desceding": "Descending",
"workflows": "Workflows", "workflows": "Workflows",
"workflowLibrary": "Library", "workflowLibrary": "Library",
"userWorkflows": "My Workflows",
"defaultWorkflows": "Default Workflows",
"projectWorkflows": "Project Workflows",
"opened": "Opened",
"openWorkflow": "Open Workflow", "openWorkflow": "Open Workflow",
"updated": "Updated",
"uploadWorkflow": "Load from File", "uploadWorkflow": "Load from File",
"deleteWorkflow": "Delete Workflow", "deleteWorkflow": "Delete Workflow",
"unnamedWorkflow": "Unnamed Workflow", "unnamedWorkflow": "Unnamed Workflow",
@ -1448,6 +1456,9 @@
"savingWorkflow": "Saving Workflow...", "savingWorkflow": "Saving Workflow...",
"problemSavingWorkflow": "Problem Saving Workflow", "problemSavingWorkflow": "Problem Saving Workflow",
"workflowSaved": "Workflow Saved", "workflowSaved": "Workflow Saved",
"name": "Name",
"noRecentWorkflows": "No Recent Workflows",
"noUserWorkflows": "No User Workflows",
"noWorkflows": "No Workflows", "noWorkflows": "No Workflows",
"problemLoading": "Problem Loading Workflows", "problemLoading": "Problem Loading Workflows",
"loading": "Loading Workflows", "loading": "Loading Workflows",

View File

@ -3,8 +3,8 @@ import { useAppSelector } from 'app/store/storeHooks';
import { IAINoContentFallback } from 'common/components/IAIImageFallback'; import { IAINoContentFallback } from 'common/components/IAIImageFallback';
import DataViewer from 'features/gallery/components/ImageMetadataViewer/DataViewer'; import DataViewer from 'features/gallery/components/ImageMetadataViewer/DataViewer';
import { selectNodesSlice } from 'features/nodes/store/nodesSlice'; import { selectNodesSlice } from 'features/nodes/store/nodesSlice';
import { useTranslation } from 'react-i18next';
import { memo } from 'react'; import { memo } from 'react';
const selector = createMemoizedSelector(selectNodesSlice, (nodes) => { const selector = createMemoizedSelector(selectNodesSlice, (nodes) => {
const lastSelectedNodeId = nodes.selectedNodes[nodes.selectedNodes.length - 1]; const lastSelectedNodeId = nodes.selectedNodes[nodes.selectedNodes.length - 1];
@ -16,10 +16,11 @@ const selector = createMemoizedSelector(selectNodesSlice, (nodes) => {
}); });
const InspectorDataTab = () => { const InspectorDataTab = () => {
const { t } = useTranslation();
const { data } = useAppSelector(selector); const { data } = useAppSelector(selector);
if (!data) { if (!data) {
return <IAINoContentFallback label="No node selected" icon={null} />; return <IAINoContentFallback label={t('nodes.noNodeSelected')} icon={null} />;
} }
return <DataViewer data={data} label="Node Data" />; return <DataViewer data={data} label="Node Data" />;

View File

@ -8,11 +8,6 @@ import { selectOptimalDimension } from 'features/parameters/store/generationSlic
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const OPTIONS: ComboboxOption[] = [
{ label: 'None', value: 'none' },
{ label: 'Auto', value: 'auto' },
{ label: 'Manual', value: 'manual' },
];
const ParamScaleBeforeProcessing = () => { const ParamScaleBeforeProcessing = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -20,6 +15,14 @@ const ParamScaleBeforeProcessing = () => {
const boundingBoxScaleMethod = useAppSelector((s) => s.canvas.boundingBoxScaleMethod); const boundingBoxScaleMethod = useAppSelector((s) => s.canvas.boundingBoxScaleMethod);
const optimalDimension = useAppSelector(selectOptimalDimension); const optimalDimension = useAppSelector(selectOptimalDimension);
const OPTIONS: ComboboxOption[] = useMemo(() => [
{ label: t('modelManager.none'), value: 'none' },
{ label: t('common.auto'), value: 'auto' },
{ label: t('modelManager.manual'), value: 'manual' },
],
[t]
);
const onChange = useCallback<ComboboxOnChange>( const onChange = useCallback<ComboboxOnChange>(
(v) => { (v) => {
if (!isBoundingBoxScaleMethod(v?.value)) { if (!isBoundingBoxScaleMethod(v?.value)) {

View File

@ -37,20 +37,11 @@ const PER_PAGE = 10;
const zOrderBy = z.enum(['opened_at', 'created_at', 'updated_at', 'name']); const zOrderBy = z.enum(['opened_at', 'created_at', 'updated_at', 'name']);
type OrderBy = z.infer<typeof zOrderBy>; type OrderBy = z.infer<typeof zOrderBy>;
const isOrderBy = (v: unknown): v is OrderBy => zOrderBy.safeParse(v).success; const isOrderBy = (v: unknown): v is OrderBy => zOrderBy.safeParse(v).success;
const ORDER_BY_OPTIONS: ComboboxOption[] = [
{ value: 'opened_at', label: 'Opened' },
{ value: 'created_at', label: 'Created' },
{ value: 'updated_at', label: 'Updated' },
{ value: 'name', label: 'Name' },
];
const zDirection = z.enum(['ASC', 'DESC']); const zDirection = z.enum(['ASC', 'DESC']);
type Direction = z.infer<typeof zDirection>; type Direction = z.infer<typeof zDirection>;
const isDirection = (v: unknown): v is Direction => zDirection.safeParse(v).success; const isDirection = (v: unknown): v is Direction => zDirection.safeParse(v).success;
const DIRECTION_OPTIONS: ComboboxOption[] = [
{ value: 'ASC', label: 'Ascending' },
{ value: 'DESC', label: 'Descending' },
];
const WorkflowLibraryList = () => { const WorkflowLibraryList = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -60,6 +51,22 @@ const WorkflowLibraryList = () => {
const [query, setQuery] = useState(''); const [query, setQuery] = useState('');
const projectId = useStore($projectId); const projectId = useStore($projectId);
const ORDER_BY_OPTIONS: ComboboxOption[] = useMemo(() => [
{ value: 'opened_at', label: t('workflows.opened') },
{ value: 'created_at', label: t('workflows.created') },
{ value: 'updated_at', label: t('workflows.updated') },
{ value: 'name', label: t('workflows.name') },
],
[t]
);
const DIRECTION_OPTIONS: ComboboxOption[] = useMemo(() => [
{ value: 'ASC', label: t('workflows.ascending') },
{ value: 'DESC', label: t('workflows.descending') },
],
[t]
);
const orderByOptions = useMemo(() => { const orderByOptions = useMemo(() => {
return projectId ? ORDER_BY_OPTIONS.filter((option) => option.value !== 'opened_at') : ORDER_BY_OPTIONS; return projectId ? ORDER_BY_OPTIONS.filter((option) => option.value !== 'opened_at') : ORDER_BY_OPTIONS;
}, [projectId]); }, [projectId]);