How to use umi-plugin-locale - 10 common examples

To help you get started, we’ve selected a few umi-plugin-locale 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 vellengs / nestx / packages / react / src / components / GlobalHeader / RightContent.tsx View on Github external
{
            console.log(item, tabProps); // eslint-disable-line no-console
            this.changeReadState(item as NoticeItem);
          }}
          loading={fetchingNotices}
          locale={{
            emptyText: formatMessage({ id: 'component.noticeIcon.empty' }),
            clear: formatMessage({ id: 'component.noticeIcon.clear' }),
            viewMore: formatMessage({ id: 'component.noticeIcon.view-more' }),
            notification: formatMessage({ id: 'component.globalHeader.notification' }),
            message: formatMessage({ id: 'component.globalHeader.message' }),
            event: formatMessage({ id: 'component.globalHeader.event' }),
          }}
          onClear={onNoticeClear}
          onPopupVisibleChange={onNoticeVisibleChange}
          onViewMore={() => message.info('Click on view more')}
          clearClose
        >
github vellengs / nestx / packages / react / src / components / GlobalHeader / RightContent.tsx View on Github external
{
            console.log(item, tabProps); // eslint-disable-line no-console
            this.changeReadState(item as NoticeItem);
          }}
          loading={fetchingNotices}
          locale={{
            emptyText: formatMessage({ id: 'component.noticeIcon.empty' }),
            clear: formatMessage({ id: 'component.noticeIcon.clear' }),
            viewMore: formatMessage({ id: 'component.noticeIcon.view-more' }),
            notification: formatMessage({ id: 'component.globalHeader.notification' }),
            message: formatMessage({ id: 'component.globalHeader.message' }),
            event: formatMessage({ id: 'component.globalHeader.event' }),
          }}
          onClear={onNoticeClear}
          onPopupVisibleChange={onNoticeVisibleChange}
          onViewMore={() => message.info('Click on view more')}
          clearClose
        >
github umijs / umi / packages / umi-plugin-locale / examples / base / src / page / index.js View on Github external
export default () => {
  console.log(
    getLocale(),
    formatMessage(
      {
        id: 'test',
      },
      {
        name: 'antd',
      },
    ),
  );
  return (
    <div style="{{">
      <button style="{{"> {
          setLocale('en-US');
        }}</button></div>
github vellengs / nestx / packages / react / src / pages / User / Login.tsx View on Github external
login.type === 'account' &amp;&amp;
              !submitting &amp;&amp;
              this.renderMessage(formatMessage({ id: 'app.login.message-invalid-credentials' }))}
            
             void }) =&gt; {
                e.preventDefault();
                this.loginForm.validateFields(this.handleSubmit);
              }}
            /&gt;
          
          
            {login.status === 'error' &amp;&amp;
              login.type === 'mobile' &amp;&amp;
              !submitting &amp;&amp;
github vellengs / nestx / packages / react / src / pages / User / Register.tsx View on Github external
{getFieldDecorator('captcha', {
                  rules: [
                    {
                      required: true,
                      message: formatMessage({ id: 'validation.verification-code.required' }),
                    },
                  ],
                })(
                  <input placeholder="{formatMessage({" size="large">,
                )}
              
              
                <button disabled="{!!count}" size="large">
                  {count
                    ? `${count} s`
                    : formatMessage({ id: 'app.register.get-verification-code' })}
                </button>
              
github vellengs / nestx / packages / react / src / global.tsx View on Github external
return true;
    };
    const key = `open${Date.now()}`;
    const btn = (
      <button type="primary"> {
          notification.close(key);
          reloadSW();
        }}
      &gt;
        {formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
      </button>
    );
    notification.open({
      message: formatMessage({ id: 'app.pwa.serviceworker.updated' }),
      description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
      btn,
      key,
      onClose: async () =&gt; {},
    });
  });
}
github vellengs / nestx / packages / react / src / pages / User / Register.tsx View on Github external
checkPassword = (
    rule: any,
    value: { length: number },
    callback: { (arg0: string): void; (arg0: string): void; (): void },
  ) =&gt; {
    const { visible, confirmDirty } = this.state;
    if (!value) {
      this.setState({
        help: formatMessage({ id: 'validation.password.required' }),
        visible: !!value,
      });
      callback('error');
    } else {
      this.setState({
        help: '',
      });
      if (!visible) {
        this.setState({
          visible: !!value,
        });
      }
      if (value.length &lt; 6) {
        callback('error');
      } else {
        const { form } = this.props;
github vellengs / nestx / packages / react / src / components / SettingDrawer / index.tsx View on Github external
            onCopy={() => message.success(formatMessage({ id: 'app.setting.copyinfo' }))}
          >
github vellengs / nestx / packages / react / src / pages / User / Register.tsx View on Github external
checkConfirm = (rule: any, value: any, callback: { (arg0: any): void; (): void }) => {
    const { form } = this.props;
    if (value && value !== form.getFieldValue('password')) {
      callback(formatMessage({ id: 'validation.password.twice' }));
    } else {
      callback();
    }
  };