diff --git a/src/frontend/src/components/buttons/StarredToggleButton.tsx b/src/frontend/src/components/buttons/StarredToggleButton.tsx index bd699f1786..89015329b2 100644 --- a/src/frontend/src/components/buttons/StarredToggleButton.tsx +++ b/src/frontend/src/components/buttons/StarredToggleButton.tsx @@ -35,7 +35,7 @@ export default function StarredToggleButton({ showNotification({ title: t`Subscription Updated`, id: 'subscription-update', - message: `Subscription ${starred ? 'removed' : 'added'}`, + message: starred ? t`Subscription removed` : t`Subscription added`, autoClose: 5000, color: 'blue' }); @@ -43,7 +43,7 @@ export default function StarredToggleButton({ }) .catch((error) => { showNotification({ - title: 'Error', + title: t`Error`, message: error.message, autoClose: 5000, color: 'red' diff --git a/src/frontend/src/components/forms/InstanceOptions.tsx b/src/frontend/src/components/forms/InstanceOptions.tsx index d59873c962..bc8107312d 100644 --- a/src/frontend/src/components/forms/InstanceOptions.tsx +++ b/src/frontend/src/components/forms/InstanceOptions.tsx @@ -23,6 +23,7 @@ import { import { ActionButton } from '@lib/components/ActionButton'; import type { HostList } from '@lib/types/Server'; import { useShallow } from 'zustand/react/shallow'; +import { translateHostName } from '../../defaults/defaultHostList'; import { Wrapper } from '../../pages/Auth/Layout'; import { useLocalState } from '../../states/LocalState'; import { useServerApiState } from '../../states/ServerApiState'; @@ -43,7 +44,7 @@ export function InstanceOptions({ ); const hostListData = Object.keys(hostList).map((key) => ({ value: key, - label: hostList[key]?.name + label: translateHostName(hostList[key]?.name) })); function SaveOptions(newHostList: HostList): void { diff --git a/src/frontend/src/components/items/LanguageSelect.tsx b/src/frontend/src/components/items/LanguageSelect.tsx index 3650603670..a975859bbf 100644 --- a/src/frontend/src/components/items/LanguageSelect.tsx +++ b/src/frontend/src/components/items/LanguageSelect.tsx @@ -49,7 +49,7 @@ export function LanguageSelect({ width = 80 }: Readonly<{ width?: number }>) { defaultValue={''} onChange={setValue} searchable - aria-label='Select language' + aria-label={t`Select language`} /> ); } diff --git a/src/frontend/src/defaults/defaultHostList.tsx b/src/frontend/src/defaults/defaultHostList.tsx index 0ed11acacb..bd463929f1 100644 --- a/src/frontend/src/defaults/defaultHostList.tsx +++ b/src/frontend/src/defaults/defaultHostList.tsx @@ -1,4 +1,18 @@ import type { HostList } from '@lib/types/Server'; +import { t } from '@lingui/core/macro'; export const defaultHostList: HostList = window.INVENTREE_SETTINGS.server_list; export const defaultHostKey = window.INVENTREE_SETTINGS.default_server; + +export function translateHostName(name: string | undefined): string { + switch (name) { + case 'Localhost': + return t`Local Server`; + case 'InvenTree Demo': + return t`InvenTree Demo`; + case 'Current Server': + return t`Current Server`; + default: + return name ?? ''; + } +} diff --git a/src/frontend/src/pages/Auth/Login.tsx b/src/frontend/src/pages/Auth/Login.tsx index f5510d5704..9e9d0098ec 100644 --- a/src/frontend/src/pages/Auth/Login.tsx +++ b/src/frontend/src/pages/Auth/Login.tsx @@ -10,7 +10,10 @@ import { removeTraceId, setApiDefaults, setTraceId } from '../../App'; import { AuthFormOptions } from '../../components/forms/AuthFormOptions'; import { AuthenticationForm } from '../../components/forms/AuthenticationForm'; import { InstanceOptions } from '../../components/forms/InstanceOptions'; -import { defaultHostKey } from '../../defaults/defaultHostList'; +import { + defaultHostKey, + translateHostName +} from '../../defaults/defaultHostList'; import { checkLoginState, doBasicLogin, @@ -29,7 +32,9 @@ export default function Login() { ); const [isLoggingIn, setIsLoggingIn] = useState(false); const hostname = - hostList[hostKey] === undefined ? t`No selection` : hostList[hostKey]?.name; + hostList[hostKey] === undefined + ? t`No selection` + : translateHostName(hostList[hostKey]?.name); const [hostEdit, setHostEdit] = useToggle([false, true] as const); const navigate = useNavigate(); const location = useLocation(); diff --git a/src/frontend/src/pages/stock/LocationDetail.tsx b/src/frontend/src/pages/stock/LocationDetail.tsx index 8d25eefbed..b8eb574561 100644 --- a/src/frontend/src/pages/stock/LocationDetail.tsx +++ b/src/frontend/src/pages/stock/LocationDetail.tsx @@ -277,7 +277,7 @@ export default function Stock() { choices: deleteOptions }, delete_sub_locations: { - label: t`Locations Action`, + label: t`Location Actions`, required: true, description: t`Action for child locations in this location`, field_type: 'choice', @@ -381,15 +381,15 @@ export default function Stock() { perm={user.hasChangeRole(UserRoles.stock_location)} actions={[ { - name: 'Scan in stock items', + name: t`Scan in stock items`, icon: , - tooltip: 'Scan item into this location', + tooltip: t`Scan item into this location`, onClick: scanInStockItem.open }, { - name: 'Scan in container', + name: t`Scan in container`, icon: , - tooltip: 'Scan container into this location', + tooltip: t`Scan container into this location`, onClick: scanInStockLocation.open } ]}