antd#LocaleProvider JavaScript Examples

The following examples show how to use antd#LocaleProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: example.js    From scalable-form-platform with MIT License 6 votes vote down vote up
render() {
    const locale = this.state.locale;
    return (
      <Provider store={store}>
        <div className="portal">
          <LocaleProvider locale={locales[locale]}>
            <div className="xform-builder-demos">
              <div className="simple-container">
                <h2 className="block-title">不使用formCode的表单设计器</h2>
                <div className="simple-xform-container">
                  <XFormBuilder
                    platformConfigSupport={true}
                    platform="both"
                    systemTemplate="397ef9b6b4a5457695bae9b2bbab26a9"
                    jsonSchema={formSchema.jsonSchema}
                    uiSchema={formSchema.uiSchema}
                    formData={formSchema.formData}
                    bizData={formSchema.bizData}
                    sequence={formSchema.sequence}
                    namespace={xformBuilderBlock4NameSpace}
                  />
                </div>
              </div>
            </div>
          </LocaleProvider>
        </div>
      </Provider>
    );
  }
Example #2
Source File: LocaleWrapper.jsx    From spring-boot-plus-admin-react with Apache License 2.0 6 votes vote down vote up
render(){
    const appLocale = this.getAppLocale();
    // react-intl must use `-` separator
    const reactIntlLocale = appLocale.locale.split(baseSeparator).join('-');
    const LangContextValue = {
      locale: reactIntlLocale,
      reloadAppLocale: this.reloadAppLocale,
    };
    let ret = this.props.children;
    ret = (<IntlProvider locale={reactIntlLocale} messages={appLocale.messages}>
      <InjectedWrapper>
        <LangContext.Provider value={LangContextValue}>
          <LangContext.Consumer>{(value) => {
            _setLocaleContext(value);
            return this.props.children
            }}</LangContext.Consumer>
        </LangContext.Provider>
      </InjectedWrapper>
    </IntlProvider>)
     // avoid antd ConfigProvider not found
     let AntdProvider = LocaleProvider;
     const [major, minor] = `${version || ''}`.split('.');
     // antd 3.21.0 use ConfigProvider not LocaleProvider
     const isConfigProvider = Number(major) > 3 || (Number(major) >= 3 && Number(minor) >= 21);
     if (isConfigProvider) {
       try {
         AntdProvider = require('antd/lib/config-provider').default;
       } catch (e) {}
     }

     return (<AntdProvider locale={appLocale.antd ? (appLocale.antd.default || appLocale.antd) : defaultAntd}>
      {ret}
    </AntdProvider>);
    return ret;
  }
Example #3
Source File: index.js    From discern with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
//打包时,用的HashRouter并加上了basename,因为放在服务器的二级目录下
ReactDOM.render(
  <HashRouter>
    <LocaleProvider locale={zh_CN}>
      <Provider {...store}>
        <App />
      </Provider>
    </LocaleProvider>
  </HashRouter>,
  document.getElementById('root'));
Example #4
Source File: index.js    From aircon with GNU General Public License v3.0 6 votes vote down vote up
//打包时,用的HashRouter并加上了basename,因为放在服务器的二级目录下
ReactDOM.render(
  <Router history={history}>
    <LocaleProvider locale={zh_CN}>
      <Provider {...store}>
        <App />
      </Provider>
    </LocaleProvider>
  </Router>,
  document.getElementById('root')
);
Example #5
Source File: index.js    From YApi-X with MIT License 5 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <LocaleProvider locale={zhCN}>
      <App />
    </LocaleProvider>
  </Provider>,
  document.getElementById('yapi'),
)
Example #6
Source File: BasicLayout.js    From camel-store-admin with Apache License 2.0 5 votes vote down vote up
render() {
    const {
      navTheme,
      layout: PropsLayout,
      children,
      location: {pathname},
      storename,
      config,
    } = this.props;
    const {menuData} = this.state;
    const {isMobile} = this.props;
    const isTop = PropsLayout === 'topmenu';
    const routerConfig = this.matchParamsPath(pathname);
    const token = getLocalStorage('token');

    const layout = (
      <LocaleProvider locale={zh_CN}>
        <Layout>
          {isTop && !isMobile ? null : (
            <SiderMenu
              Authorized={Authorized}
              theme={navTheme}
              onCollapse={this.handleMenuCollapse}
              menuData={menuData}
              isMobile={isMobile}
              getstoreSelect={this.getstoreSelect}
              {...this.props}
            />
          )}
          <Layout
            style={{
              ...this.getLayoutStyle(),
              minHeight: '100vh',
            }}
          >
            <Header
              menuData={menuData}
              handleMenuCollapse={this.handleMenuCollapse}
              logo={logo}
              isMobile={isMobile}
              {...this.props}
            />
            <Content style={this.getContentStyle()}>
              <Authorized
                authority={routerConfig && routerConfig.authority}
                noMatch={<Exception403/>}
              >
                {token ? children : message.warning('登录超时,请重新登录!')}
              </Authorized>
            </Content>
            <Footer show={config && config.store_type === 'camel'}/>
          </Layout>
        </Layout>
      </LocaleProvider>
    );
    return (
      <React.Fragment>
        <DocumentTitle title={this.getPageTitle(pathname) + storename}>
          <ContainerQuery query={query}>
            {params => (
              <Context.Provider value={this.getContext()}>
                <div className={classNames(params)}>{layout}</div>
              </Context.Provider>
            )}
          </ContainerQuery>
        </DocumentTitle>
      </React.Fragment>
    );
  }