Giter Club home page Giter Club logo

component-intl-welcome's Introduction

Demonstration component 'Welcome' with locales

This is exampe library with support of internationalization according to component approach

This library exports a demonstration component 'Welcome' which uses react-intl internationalization library. The component displays a simple form and displays a localized sentence in the selected language. The sentence is reactively changing in response to a change of the data in the form.

This demonstration component currently support en, de, ru, zh locales.

The localization data is in directory ./locales in yaml format according to component approach

To integrate localization data to application locale assets configure the webpack internationalization plugin intl-webpack-plugin like this:

  var IntlPlugin = require("intl-webpack-plugin");
  module: {
    rules: [
      { test: /\.(intl)$/i,
        use: [
          IntlPlugin.loader(),
          'yaml-loader'
        ]
      }
    ]
  }
  plugins: [
    new IntlPlugin({})
  ]

And require internationalization entry point module somewhere in application:

import {} from 'component-intl-welcome/locales'

Now import component and put it on the page like this:

import React from 'react'

import Welcome from 'component-intl-welcome'
import {} from 'component-intl-welcome/locales'

const App = (props) => (
  <div>
    <h2>The "Welcome" component</h2>
    <Welcome/>
  </div>
)

To see example how to integrate this library component with locales into application and how it works see

or its source code:

component-intl-welcome's People

Contributors

oklas avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.