add translation keys (#246)
* Fix i18n tsc issue "t" can return null by default. This was already disabled in the config, but it had no effect on tsc. * Fix translation in "DefaultNavBar" key was missing and since this is a constant the translation wouldn't update in case the language got changed after first load. * Enable typing for i18n translation keys * Add translation keys
This commit is contained in:
@@ -17,6 +17,7 @@ import TravelExploreIcon from '@mui/icons-material/TravelExplore';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useQuery } from 'util/client';
|
||||
import { ISource } from 'typings';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
function sourceToLangList(sources: ISource[]) {
|
||||
const result: string[] = [];
|
||||
@@ -44,6 +45,7 @@ function groupByLang(sources: ISource[]) {
|
||||
}
|
||||
|
||||
export default function Sources() {
|
||||
const { t } = useTranslation();
|
||||
const { setTitle, setAction } = useContext(NavbarContext);
|
||||
|
||||
const [shownLangs, setShownLangs] = useLocalStorage<string[]>('shownSourceLangs', sourceDefualtLangs());
|
||||
@@ -70,7 +72,7 @@ export default function Sources() {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setTitle('Sources');
|
||||
setTitle(t('source.title'));
|
||||
setAction(
|
||||
<>
|
||||
<IconButton onClick={() => history.push('/sources/all/search/')} size="large">
|
||||
@@ -89,7 +91,7 @@ export default function Sources() {
|
||||
if (loading) return <LoadingPlaceholder />;
|
||||
|
||||
if (sources?.length === 0) {
|
||||
return <h3>No sources found. Install Some Extensions first.</h3>;
|
||||
return <h3>{t('source.error.label.no_sources_found')}</h3>;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user