How to use the piral.useTranslate function in piral

To help you get started, we’ve selected a few piral 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 smapiot / piral / src / samples / sample-piral / src / layout.tsx View on Github external
DashboardContainer: ({ children }) => {
    const translate = useTranslate();
    return (
      <div>
        <h1>{translate('sample')}</h1>
        <div>{children}</div>
      </div>
    );
  },
  DashboardTile: ({ children, rows, columns }) =&gt; <div>{children}</div>,
github smapiot / piral / src / samples / sample-piral / src / components / LanguagePicker.tsx View on Github external
const LanguagePickerView: React.FC = ({ selected, available }) =&gt; {
  const [open, setOpen] = React.useState(false);
  const [language, setLanguage] = useDynamicLanguage(selected, loadLanguage);
  const container = React.useRef();
  const translate = useTranslate();
  useOnClickOutside(container, () =&gt; setOpen(false));

  return (
    <div>
      <div> setOpen(!open)}&gt;
        
      </div>
      <ul>
        {available.map(lang =&gt; (
          <li> setLanguage(lang)}&gt;
             <span>{translate(lang)}</span>
          </li>
        ))}
      </ul>
    </div>
  );

piral

The all-in-one piral package.

MIT
Latest version published 6 days ago

Package Health Score

84 / 100
Full package analysis