How to use the react-admin.translate function in react-admin

To help you get started, we’ve selected a few react-admin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kirk-Wang / Blog / react-admin-demo / src / Customers / SegmentsInput.tsx View on Github external
/**
 *  Copyright Kirk Technologies.
 */

import * as React from "react";
import { translate, SelectArrayInput } from "react-admin";

import { segments } from "../segments/data";

export const SegmentsInput = translate(({ translate: trans, addField, ...rest }: any) => (
     ({
            id: segment.id,
            name: trans(segment.name),
        }))}
    />
));

SegmentsInput.defaultProps = {
    addField: true,
    source: "groups",
};
github marmelab / react-admin / examples / graphcool-demo / src / dashboard / Welcome.js View on Github external
<button href="https://marmelab.com/react-admin">
                
                {translate('pos.dashboard.welcome.aor_button')}
            </button>
            <button href="https://github.com/marmelab/react-admin/tree/master/examples/demo">
                
                {translate('pos.dashboard.welcome.demo_button')}
            </button>
        
    
);

export default withStyles(styles)(translate(Welcome));
github Kirk-Wang / Blog / react-admin-demo / src / Customers / SegmentsField.tsx View on Github external
/**
 *  Copyright Kirk Technologies.
 */

import * as React from "react";
import Chip from "@material-ui/core/Chip";
import { translate } from "react-admin";
import { segments } from "../segments/data";

const styles: any = {
    main: { display: "flex", flexWrap: "wrap" },
    chip: { margin: 4 },
};

export const SegmentsField: any = translate(({ record, translate: trans }: any) =&gt; (
    <span style="{styles.main}">
        {record.groups &amp;&amp;
            record.groups.map((segment: any) =&gt; (
                 s.id === segment).name)}
                /&gt;
            ))}
    </span>
));

SegmentsField.defaultProps = {
    addLabel: true,
    source: "groups",
};
github bootstrap-styled / ra-ui / examples / demo / src / dashboard / MonthlyRevenue.js View on Github external
minHeight: 52,
        display: 'block',
    },
};

const MonthlyRevenue = ({ value, translate }) =&gt; (
    <div style="{styles.main}">
        
        
            <p>{translate('pos.dashboard.monthly_revenue')}</p>
            <h3>{value}</h3>
        
    </div>
);

export default translate(MonthlyRevenue);
github marmelab / react-admin / examples / graphcool-demo / src / segments / index.js View on Github external
import React from 'react';
import { Datagrid, List, FunctionField, translate } from 'react-admin';
import Icon from '@material-ui/icons/Bookmark';

import LinkToRelatedCustomers from './LinkToRelatedCustomers';

export const SegmentIcon = Icon;

export const SegmentList = translate(({ translate, ...props }) =&gt; (
    
        
            
                    translate(`resources.Segment.data.${record.name}`)
                }
            /&gt;
            
        
    
));
github notadd / next / src / users.js View on Github external
}
                medium={
                    
                        
                        
                        { permissions === 'admin' &amp;&amp;  }
                        
                        
                    
                }
            /&gt;
        ) }
    
);

const UserTitle = translate(({ record, translate }) =&gt; (
    <span>
        { record ? translate('user.edit.title', { title: record.name }) : '' }
    </span>
));

const UserCreateToolbar = ({ permissions, ...props }) =&gt; (
    
        
        { permissions === 'admin' &amp;&amp; (
github notadd / next / src / posts.js View on Github external
reference='tags'
                        source='tags'
                    &gt;
                        
                            
                        
                    
                    
                    
                
            }
        /&gt;
    
);

const PostTitle = translate(({ record, translate }) =&gt; (
    <span>
        { record ? translate('post.edit.title', { title: record.title }) : '' }
    </span>
));

const PostCreateToolbar = props =&gt; (
github Kirk-Wang / Blog / react-admin-demo / src / commands / CommandEdit.tsx View on Github external
import * as React from "react";
import {
    translate,
    AutocompleteInput,
    BooleanInput,
    DateInput,
    Edit,
    ReferenceInput,
    SelectInput,
    SimpleForm,
} from "react-admin";
import withStyles from "@material-ui/core/styles/withStyles";

import { Basket } from "./Basket";

const CommandTitle = translate(({ record, translate: trans }: any) =&gt; (
    <span>
        {trans("resources.commands.name", { smart_count: 1 })} #{record.reference}
    </span>
));

const editStyles: any = {
    clear: { clear: "both" },
};

const optionText = (choice: any) =&gt; `${choice.first_name} ${choice.last_name}`;

export const CommandEdit = withStyles(editStyles)(({ classes, ...props }: any) =&gt; (
    } {...props}&gt;
github marmelab / react-admin / examples / demo / src / AppBar.js View on Github external
import React from 'react';
import { AppBar, UserMenu, MenuItemLink, translate } from 'react-admin';
import SettingsIcon from '@material-ui/icons/Settings';

const CustomUserMenu = translate(({ translate, ...props }) =&gt; (
    
        }
        /&gt;
    
));

const CustomAppBar = props =&gt; (
    } /&gt;
);

export default CustomAppBar;