Skip to content

Commit

Permalink
refactor: add remaining translations
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomous committed Jul 22, 2024
1 parent a60ce36 commit 3f43f8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/react-material-ui/src/modules/crud/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Search } from '../../components/Table/types';
import CrudRoot from './CrudRoot';
import { FilterDetails } from '../../components/submodules/Filter';
import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs';
import { useTranslation } from '../../utils/i18n';

type Action = 'creation' | 'edit' | 'details' | null;

Expand Down Expand Up @@ -69,6 +70,8 @@ const CrudModule = (props: ModuleProps) => {
const [drawerViewMode, setDrawerViewMode] = useState<Action>(null);
const [selectedRow, setSelectedRow] = useState<SelectedRow>(null);

const { t } = useTranslation();

const useTableReturn = useTable(props.resource, {
callbacks: {
onError: props.onFetchError,
Expand Down Expand Up @@ -127,8 +130,11 @@ const CrudModule = (props: ModuleProps) => {
<Box mt={4}>
<Breadcrumbs
routes={[
{ href: '/', label: 'Home' },
{ href: '#', label: props.title || 'Table' },
{ href: '/', label: t('crud:homeBreadcrumbLabel') },
{
href: '#',
label: props.title || t('crud:currentBreadcrumbLabel'),
},
]}
/>
</Box>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-material-ui/src/utils/i18n/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const en_US = {
crud: {
addNew: 'Add new',
emptyTable: 'No records found',
homeBreadcrumbLabel: 'Home',
currentBreadcrumbLabel: 'Table',
},
users: {
title: 'Users',
Expand Down
2 changes: 2 additions & 0 deletions packages/react-material-ui/src/utils/i18n/locales/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const pt_BR = {
crud: {
addNew: 'Adicionar',
emptyTable: 'Dados não encontrados',
homeBreadcrumbLabel: 'Início',
currentBreadcrumbLabel: 'Tabela',
},
users: {
title: 'Usuários',
Expand Down

0 comments on commit 3f43f8c

Please sign in to comment.