How to use the umi-plugin-react/locale.getLocale function in umi-plugin-react

To help you get started, we’ve selected a few umi-plugin-react 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 crawlab-team / artipub / src / components / SelectLang / index.tsx View on Github external
const SelectLang: React.FC = props => {
  const { className } = props;
  const selectedLang = getLocale();
  const changeLang = ({ key }: ClickParam): void => setLocale(key, false);
  const locales = [
    'zh-CN',
    // 'zh-TW',
    'en-US',
    // 'pt-BR'
  ];
  const languageLabels = {
    'zh-CN': '简体中文',
    'zh-TW': '繁体中文',
    'en-US': 'English',
    'pt-BR': 'Português',
  };
  const languageIcons = {
    'zh-CN': '🇨🇳',
    // 'zh-TW': '🇭🇰',
github ant-design / ant-design-pro-layout / example / src / components / SelectLang / index.tsx View on Github external
const SelectLang: React.FC = props => {
  const { className } = props;
  const selectedLang = getLocale();
  const changeLang = ({ key }: ClickParam): void => setLocale(key, false);
  const locales = ['zh-CN', 'zh-TW', 'en-US', 'pt-BR'];
  const languageLabels = {
    'zh-CN': '简体中文',
    'zh-TW': '繁体中文',
    'en-US': 'English',
    'pt-BR': 'Português',
  };
  const languageIcons = {
    'zh-CN': '🇨🇳',
    'zh-TW': '🇭🇰',
    'en-US': '🇬🇧',
    'pt-BR': '🇧🇷',
  };
  const langMenu = (
github DFocusGroup / generator-umi / generators / app / templates / src / pages / o / login / index.js View on Github external
function handleRememberme(e) {
    if (e.target.checked) {
      setRememberme(true)
      return removeDoNotRememberme()
    }
    setRememberme(false)
    return setDoNotRememberme()
  }

  const { getFieldDecorator } = form

  return (
    <div>
      <div>
        
      </div>

      <div>
        <div>
          <span>
            
          </span>
        </div>
        <form>
          
            
              
                
              
              
                {getFieldDecorator('account', {</form></div></div>
github XiaoMi / thain / thain-fe / src / components / SelectLang / index.tsx View on Github external
const SelectLang: React.FC = props =&gt; {
  const { className } = props;
  const selectedLang = getLocale();
  const changeLang = ({ key }: ClickParam): void =&gt; setLocale(key);
  const locales = ['zh-CN', 'en-US'];
  const languageLabels = {
    'zh-CN': '简体中文',
    'en-US': 'English',
  };
  const languageIcons = {
    'zh-CN': '🇨🇳',
    'en-US': '🇺🇸',
  };
  const langMenu = (
    <menu>
      {locales.map(locale =&gt; (
        
          <span aria-label="{languageLabels[locale]}" role="img">
            {languageIcons[locale]}</span></menu>
github umijs / umi-plugin-block-dev / layouts / ant-design-pro / SelectLang / index.jsx View on Github external
const SelectLang = props =&gt; {
  const { className } = props;
  const selectedLang = getLocale();
  const changeLang = ({ key }) =&gt; setLocale(key);
  const locales = ['zh-CN', 'zh-TW', 'en-US', 'pt-BR'];
  const languageLabels = {
    'zh-CN': '简体中文',
    'zh-TW': '繁体中文',
    'en-US': 'English',
    'pt-BR': 'Português'
  };
  const languageIcons = {
    'zh-CN': '🇨🇳',
    'zh-TW': '🇭🇰',
    'en-US': '🇬🇧',
    'pt-BR': '🇧🇷'
  };
  const langMenu = (
github tangtanglove / fullstack-frontend / src / components / SelectLang / index.tsx View on Github external
const SelectLang: React.FC = props =&gt; {
  const { className } = props;
  const selectedLang = getLocale();
  const changeLang = ({ key }: ClickParam): void =&gt; setLocale(key, false);
  const locales = ['zh-CN', 'zh-TW', 'en-US', 'pt-BR'];
  const languageLabels = {
    'zh-CN': '简体中文',
    'zh-TW': '繁体中文',
    'en-US': 'English',
    'pt-BR': 'Português',
  };
  const languageIcons = {
    'zh-CN': '🇨🇳',
    'zh-TW': '🇭🇰',
    'en-US': '🇬🇧',
    'pt-BR': '🇧🇷',
  };
  const langMenu = (
    <menu></menu>
github umijs / umi / packages / umi-ui / client / src / components / DepsInstall / index.tsx View on Github external
const DepsInstallBtn: React.SFC = props =&gt; {
  const {
    children,
    installType,
    path,
    onClick,
    payload,
    loadingChild,
    onFailure,
    onProgress,
    onSuccess,
    ...restProps
  } = props;
  const locale = getLocale();
  const { npmClient: needNpmClient } = payload;
  const { npmClient, error } = useNpmClients();
  const [loading, setLoading] = useState(false);
  const [modalVisible, setModalVisible] = useState(false);
  const projectPath = path || window.g_uiCurrentProject.path || '';
  const projectKey = window.g_uiCurrentProject.key || '';
  const [form] = Form.useForm();

  useEffect(
    () =&gt; {
      if (Array.isArray(npmClient) &amp;&amp; npmClient.length &gt; 0) {
        form.setFieldsValue({
          npmClient: npmClient[0],
        });
      }
    },
github umijs / umi / packages / umi-ui / client / src / utils / index.tsx View on Github external
export const getLocale = () => {
  const locale = umiGetLocale() || '';
  return localeMapping[locale.toLowerCase()] || 'zh-CN';
};
github Jkanon / webmagician-ui / src / components / SelectLang / index.tsx View on Github external
const SelectLang: React.FC = props =&gt; {
  const { className } = props;
  const selectedLang = getLocale();
  const changeLang = ({ key }: ClickParam): void =&gt; setLocale(key, false);
  const locales = ['zh-CN', 'zh-TW', 'en-US', 'ja-JP'];
  const languageLabels = {
    'zh-CN': '简体中文',
    'zh-TW': '繁体中文',
    'en-US': 'English',
    'ja-JP': '日本語',
  };
  const languageIcons = {
    'zh-CN': '🇨🇳',
    'zh-TW': '🇭🇰',
    'en-US': '🇬🇧',
    'ja-JP': '🇯🇵',
  };
  const langMenu = (
    <menu></menu>

umi-plugin-react

React plugin set for umi.

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages