Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@epig/locale-provider

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@epig/locale-provider

国际化组件

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

locale-provider

Introduction

国际化

Installation

npm install @epig/locale-provider --save

Usage

import * as React from 'react';
import LocaleProvider, { LocaleReceiver as LR } from '@epig/locale-provider';

interface Locale {
  loginBtnText: string;
  registerBtnText: string;
}

class LocaleReceiver extends LR<Locale> {}

const defaultLocale: Locale = {
  loginBtnText: '登陆',
  registerBtnText: '注册',
};

class Login extends React.Component<any, any> {
  render() {
    return (
      <LocaleReceiver>
        {locale => (
          <div>
            <p>{locale.loginBtnText}</p>
          </div>
        )}
      </LocaleReceiver>
    );
  }
}

class App extends React.Component<any, any> {
  render() {
    return (
      <LocaleProvider locale={defaultLocale}>
        <Login />
      </LocaleProvider>
    );
  }
}

Api

LocaleProvider

propstypedefaultdescriptionrequired
localeany-语言包配置true

LocaleReceiver

propstypedefaultdescriptionrequired
children(locale: any) => React.ReactNode-子组件true

Keywords

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc