Migrate to lingui
Switch to "lingui" for better DX. Tried to persist existing languages as much as possible. Removed "vite-plugin-node-polyfills" because it's incompatible with "lingui"
This commit is contained in:
@@ -11,12 +11,12 @@ import Button from '@mui/material/Button';
|
||||
import Card from '@mui/material/Card';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import PushPinIcon from '@mui/icons-material/PushPin';
|
||||
import PushPinOutlinedIcon from '@mui/icons-material/PushPinOutlined';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import { SourceContentType } from '@/features/source/browse/screens/SourceMangas.tsx';
|
||||
import { GetSourcesListQuery } from '@/lib/graphql/generated/graphql.ts';
|
||||
@@ -38,7 +38,7 @@ interface IProps {
|
||||
}
|
||||
|
||||
export const SourceCard: React.FC<IProps> = (props: IProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useLingui();
|
||||
|
||||
const { source, showSourceRepo, showLanguage } = props;
|
||||
const {
|
||||
@@ -53,10 +53,10 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
|
||||
|
||||
const { isPinned } = useGetSourceMetadata(source);
|
||||
|
||||
const sourceName = Sources.isLocalSource(source) ? t('source.local_source.title') : name;
|
||||
const sourceName = Sources.isLocalSource(source) ? t`Local source` : name;
|
||||
|
||||
const updateSetting = createUpdateSourceMetadata(source, (e) =>
|
||||
makeToast(t('global.error.label.failed_to_save_changes'), 'error', getErrorMessage(e)),
|
||||
makeToast(t`Failed to save changes`, 'error', getErrorMessage(e)),
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -105,10 +105,10 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
|
||||
to={AppRoutes.sources.childRoutes.browse.path(id)}
|
||||
state={{ contentType: SourceContentType.LATEST, clearCache: true }}
|
||||
>
|
||||
{t('global.button.latest')}
|
||||
{t`Latest`}
|
||||
</Button>
|
||||
)}
|
||||
<CustomTooltip title={t(isPinned ? 'source.pin.remove' : 'source.pin.add')}>
|
||||
<CustomTooltip title={isPinned ? t`Unpin source` : t`Pin source`}>
|
||||
<IconButton
|
||||
{...MUIUtil.preventRippleProp()}
|
||||
onClick={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user